.crm-dropdown.chat-filter-dd {
  width: 100%;
  min-width: 0;
  display: block;
}
.crm-dropdown.chat-filter-dd .crm-dd-btn {
  width: 100%;
}
.crm-dropdown.chat-filter-dd .crm-dd-btn .crm-dd-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-dropdown {
  overflow: hidden;
  box-sizing: border-box;
  padding: 2px;
  border-radius: 8px;
}
.transparent-dropdown {
  overflow: hidden;
  box-sizing: border-box;
  padding: 2px;
  border-radius: 8px;
}

.dropdown-toggle.transparent-dropdown {
  transition: var(--crm-hover-transition);
}
.dropdown-toggle.transparent-dropdown:hover,
.dropdown-toggle.transparent-dropdown:focus-visible,
.dropdown-toggle.transparent-dropdown:active,
.dropdown-toggle.transparent-dropdown.show,
.dropdown-toggle.transparent-dropdown[aria-expanded="true"] {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #5b21b680;
  outline: none;
  transform: none;
  box-shadow: none;
}

.crm-dropdown .crm-dd-btn:hover,
.crm-dropdown .crm-dd-btn:focus-visible {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #5b21b680;
  outline: none;
  transform: none;
}

.transparent-dropdown .dropdown-toggle {
  transition: var(--crm-hover-transition);
}
.transparent-dropdown .dropdown-toggle:hover,
.transparent-dropdown .dropdown-toggle:focus-visible {
  background: #f8fafc;
  border-color: #e5e7eb;
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

:root {
  --crm-accent: #5b21b6;
  --crm-accent-700: #4338ca;
  --crm-accent-bg: #f8f5ff;
  --crm-accent-focus: rgba(91, 33, 182, 0.18);
}

.messanger-container {
  max-width: 1200px;
  margin: 0 auto;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
}

.message {
  margin-bottom: 5px;
  max-width: 400px;
  min-width: 150px;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  position: relative;
  color: white;
  font-weight: 500;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  transform-origin: center;
  animation: messageAppear 0.25s ease forwards;
  transform: translateY(10px);
}
.transparent-dropdown-menu .mb-2 input.form-control,
.pipeline-dropdown-menu .dropdown-search input.form-control,
.lead-dropdown-menu .dropdown-search input.form-control {
  width: 100%;
  height: 38px;
  padding: 6px 10px;
  font-size: 14px;
  box-sizing: border-box;
}

.filter-condition {
  position: relative;
}
.filter-condition .filter-condition-head {
  position: relative;
  padding-top: 15px;
}
.filter-condition .remove-condition-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.filter-condition .remove-condition-btn:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.filter-condition .remove-condition-btn svg {
  display: block;
  pointer-events: none;
}


.message-incoming {
  background: linear-gradient(263.87deg, #4a5568 0%, #2d3748 100%);
  box-shadow:
    rgba(0, 0, 0, 0.1) 0px 10px 20px,
    rgba(0, 0, 0, 0.1) 0px 10px 20px,
    #4a5568 0px -2px 4px inset,
    #2d3748 0px -8px 8px inset;
  align-self: flex-start;
  margin-right: auto;
  margin-left: 10px;
}

.message-outgoing {
  background: linear-gradient(263.87deg, #7c3aed 0%, #5b21b6 100%);
  box-shadow:
    rgba(124, 58, 237, 0.1) 0px 10px 20px,
    rgba(91, 33, 182, 0.1) 0px 10px 20px,
    #7c3aed 0px -2px 4px inset,
    #5b21b6 0px -8px 8px inset;
  align-self: flex-end;
  margin-left: auto;
  margin-right: 10px;
}

.message-item {
  margin-top: 16px;
  width: fit-content;
  min-width: 176px;
  max-width: min(500px, 100%);
  min-width: 0;
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  
  user-select: text;
  -webkit-user-select: text;
}
@media (max-width: 768px) {
  .message-item {
    margin-top: 6px;
  }
}

.message-item--outgoing {
  margin-left: auto;
  padding-left: 80px;
}
.message-item--incoming {
  margin-right: auto;
  padding-right: 80px;
}
@media (max-width: 768px) {
  .message-item--outgoing {
    padding-left: 0;
  }
  .message-item--incoming {
    padding-right: 0;
  }
  
  .message-item--outgoing.has-retry {
    padding-left: 44px;
  }
}

.message-top {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.message-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: space-between;
}
.message-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}
.message-top-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}
.message-top-name {
  font-weight: 500;
  font-size: 14px;
  color: #171926;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dark-theme .message-top-name {
  color: rgba(255, 255, 255, 0.8);
}
.message-top-sub {
  font-size: 13px;
  color: #4c4e5d;
}
.dark-theme .message-top-sub {
  color: rgba(255, 255, 255, 0.55);
}

.message-top-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 600;
  border: 1px solid rgba(229, 231, 235, 1);
  background: rgba(255, 255, 255, 0.7);
  color: #374151;
  white-space: nowrap;
}
.dark-theme .message-top-tag {
  border-color: rgba(71, 85, 105, 0.8);
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.9);
}

.message-item--outgoing .message-top-tag {
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.1);
  color: #5b21b6;
}
.dark-theme .message-item--outgoing .message-top-tag {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.14);
  color: rgba(221, 214, 254, 0.95);
}

.message-top-by {
  font-size: 12px;
  font-weight: 500;
  color: rgba(76, 78, 93, 0.95);
  white-space: nowrap;
}
.dark-theme .message-top-by {
  color: rgba(203, 213, 225, 0.8);
}

.message-item .message {
  margin: 4px 0 0 0;
  padding: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: 20px;
}
.message-item .message.message-incoming,
.message-item .message.message-outgoing {
  align-self: stretch;
  margin-left: 0;
  margin-right: 0;
  position: relative;
  overflow: hidden;
  transition: background 0.24s ease, box-shadow 0.24s ease, transform 0.24s ease, filter 0.24s ease;
}


.message-retry-btn {
  position: absolute;
  left: -44px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(220, 53, 69, 0.35);
  background: rgba(255, 255, 255, 0.92);
  color: #dc3545;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  transition: var(--crm-hover-transition);
  -webkit-appearance: none;
  appearance: none;
}
.message-retry-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}
.message-retry-btn:hover {
  background: #fff;
  border-color: rgba(220, 53, 69, 0.55);
  transform: translateY(-50%) scale(1.03);
}
.message-retry-btn:active {
  transform: translateY(-50%) scale(0.98);
}
.message-retry-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.dark-theme .message-retry-btn {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(220, 53, 69, 0.5);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}
.message-item--outgoing .message {
  border-top-right-radius: 3.5px;
}
.message-item--incoming .message {
  border-top-left-radius: 3.5px;
}

.message-item .message-header {
  display: none !important;
}

.message-item .message-content.message__content {
  padding-top: 12px;
  min-width: 0;
}
.message-item .message-content.message__content > * {
  margin-left: 12px;
  margin-right: 12px;
}
.message-reply-preview {
  display: block;
  width: auto;
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: none;
  border-left: 3px solid #8b5cf6;
  border-radius: 10px;
  background: #f5f3ff;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.message-reply-preview:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
}
.message-reply-preview:hover {
  transform: translateY(-1px);
}
.message-reply-preview__title {
  font-size: 12px;
  font-weight: 600;
  color: #6d28d9;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-reply-preview__text {
  font-size: 12px;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.message-item--outgoing .message-reply-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 10px 14px;
  border-left-width: 4px;
  border-left-color: rgba(221, 214, 254, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(124, 58, 237, 0.08);
}
.message-item--outgoing .message-reply-preview:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 100%);
  border-left-color: rgba(233, 213, 255, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 10px 24px rgba(124, 58, 237, 0.12);
}
.message-item--outgoing .message-reply-preview::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 8px;
  width: 2px;
  height: calc(100% - 22px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(221, 214, 254, 0.95) 0%, rgba(196, 181, 253, 0.78) 100%);
}
.message-item--outgoing .message-reply-preview__title {
  color: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.message-item--outgoing .message-reply-preview__text {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}
.message-item--incoming .message-reply-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px 10px 14px;
  border-left-width: 4px;
  border-left-color: rgba(191, 219, 254, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(15, 23, 42, 0.10);
}
.message-item--incoming .message-reply-preview:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0.10) 100%);
  border-left-color: rgba(147, 197, 253, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 10px 24px rgba(15, 23, 42, 0.14);
}
.message-item--incoming .message-reply-preview::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 8px;
  width: 2px;
  height: calc(100% - 22px);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(191, 219, 254, 0.95) 0%, rgba(125, 211, 252, 0.78) 100%);
}
.message-item--incoming .message-reply-preview__title {
  color: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  letter-spacing: 0.01em;
}
.message-item--incoming .message-reply-preview__text {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.message-item .message-translation {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-wrap;
  word-break: break-word;
}

.message-item--outgoing .message-translation {
  color: rgba(255, 255, 255, 0.92);
}

.message-item .message-translation__label {
  font-weight: 400;
  font-size: 11px;
  margin-right: 6px;
  color: rgba(255, 255, 255, 0.68);
}

.message-item--incoming .message-translation--incoming {
  font-weight: 400;
}

.crm-context-menu {
  position: fixed;
  z-index: 2147483000;
  display: none;
  min-width: 220px;
  max-width: min(320px, 92vw);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 24, 39, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.crm-context-menu__item {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
  padding: 10px 10px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-context-menu__item-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.72);
  flex: 0 0 16px;
}

.crm-context-menu__item-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.crm-context-menu__item--danger {
  color: rgba(248, 113, 113, 0.95); 
}

.crm-context-menu__item--danger .crm-context-menu__item-icon {
  color: rgba(248, 113, 113, 0.95);
}

.crm-context-menu__item--danger:hover,
.crm-context-menu__item--danger:focus {
  background: rgba(220, 38, 38, 0.14);
  color: rgba(254, 202, 202, 0.98);
}

.crm-context-menu__item--danger:hover .crm-context-menu__item-icon,
.crm-context-menu__item--danger:focus .crm-context-menu__item-icon {
  color: rgba(254, 202, 202, 0.98);
}

.crm-context-menu__item-label {
  min-width: 0;
  flex: 1 1 auto;
}

.crm-context-menu__item:hover,
.crm-context-menu__item:focus {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.crm-context-menu__sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.10);
  margin: 6px 6px;
}

.crm-context-menu__sep--lg {
  margin: 14px 6px;
}


.message-edited-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  vertical-align: middle;
  color: currentColor;
}
.message-edited-flag svg {
  display: block;
  width: 14px;
  height: 14px;
}


.message-item--pinned {
  position: relative;
}


.message-item--pinned .message-top {
  margin-bottom: 4px;
  padding-left: 12px;
}

.message-item--pinned .message-top-name {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.message-item--pinned .message {
  position: relative;
}

.message-item--pinned.message-item--incoming .message {
  border-top-left-radius: 14px;
}

.message-item--pinned.message-item--outgoing .message {
  border-top-right-radius: 14px;
}

.message-item--pinned .message::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.22);
}

.message-item--pinned.message-item--incoming .message::before {
  left: 0;
}

.message-item--pinned.message-item--outgoing .message::before {
  right: 0;
  border-radius: 999px 0 0 999px;
}


#reply-preview {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
  background: #f5f3ff;
  width: 100%;
  flex: 0 0 100%;
  max-width: 100%;
  box-sizing: border-box;
}
#reply-preview .reply-preview__body {
  min-width: 0;
  flex: 1;
  max-width: 100%;
}
#reply-preview-title {
  font-size: 12px;
  font-weight: 600;
  color: #6d28d9;
}
#reply-preview-text {
  font-size: 13px;
  color: #374151;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  max-height: 3.8em;
  overflow: auto;
}
#reply-preview-cancel {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}


#reply-preview[data-edit-mode="true"] {
  border-color: #f59e0b;
  background: #fffbeb;
}
#reply-preview[data-edit-mode="true"] #reply-preview-title {
  color: #b45309;
}


.crm-edit-media-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px dashed #c4b5fd;
  border-radius: 10px;
  background: #faf5ff;
}
.crm-edit-media-strip__thumb-wrap {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: #e9d5ff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crm-edit-media-strip__count-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  min-width: 1.1em;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  background: #5b21b6;
  color: #fff;
  border-radius: 6px;
  line-height: 1.25;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.crm-edit-media-strip__thumb-wrap img,
.crm-edit-media-strip__thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.crm-edit-media-strip__label {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #5b21b6;
  line-height: 1.35;
}
.crm-edit-media-strip__actions {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 46%;
  min-width: 132px;
}
.crm-edit-media-strip__file-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0.01;
}
.crm-edit-media-strip__choose-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1.5px solid #7c3aed;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
  color: #5b21b6;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(91, 33, 182, 0.08);
  letter-spacing: 0.01em;
  line-height: 1.2;
  transition: background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}
.crm-edit-media-strip__choose-btn:hover {
  background: #f3e8ff;
  border-color: #6d28d9;
  color: #4c1d95;
  box-shadow: 0 2px 6px rgba(91, 33, 182, 0.12);
}
.crm-edit-media-strip__choose-btn:focus,
.crm-edit-media-strip__choose-btn:focus-within {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}
.crm-edit-media-strip__file-name {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
  max-width: 100%;
  text-align: right;
  word-break: break-word;
  hyphens: auto;
}

.message-translated-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.8;
  vertical-align: middle;
}

.push-translation-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
  color: rgba(107, 114, 128, 1);
}

.message-item .message-footer {
  margin-top: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.7);
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  gap: 8px;
}

.message-footer__left {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.message-footer__right {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.message-deleted-badge {
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.75;
  color: #dc3545;
  white-space: nowrap;
}

.message-buttons-wrap {
  width: 100%;
}
.message-buttons-under {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.message-buttons-under-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message-buttons-under-list.is-hidden {
  display: none;
}
.message-buttons-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
  user-select: none;
}
.message-buttons-toggle__text {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 700;
  text-align: left;
}
.message-buttons-toggle__icons {
  display: inline-flex;
  align-items: center;
  gap: 0;
}
.message-buttons-toggle .msgbtn-ico {
  width: 16px;
  height: 16px;
  fill: currentColor;
  opacity: 0.9;
}
.message-buttons-toggle .msgbtn-ico--hide {
  display: none;
}
.message-buttons-toggle[aria-expanded="true"] .msgbtn-ico--show {
  display: none;
}
.message-buttons-toggle[aria-expanded="true"] .msgbtn-ico--hide {
  display: block;
}

.message-item--outgoing .message-buttons-toggle {
  border-color: rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.08);
  color: #5b21b6;
}
.dark-theme .message-buttons-toggle {
  border-color: rgba(71, 85, 105, 0.7);
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.92);
}
.dark-theme .message-item--outgoing .message-buttons-toggle {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.14);
  color: rgba(221, 214, 254, 0.95);
}
.message-action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  color: #111827;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.message-action-btn:disabled {
  opacity: 1;
  cursor: default;
}
.message-action-btn__text {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-action-btn .msgbtn-ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: currentColor;
  opacity: 0.85;
}

.message-action-btn--next .msgbtn-ico path {
  stroke: currentColor;
  stroke-width: 22;
  stroke-linejoin: round;
  stroke-linecap: round;
  paint-order: stroke;
}

.message-item--outgoing .message-action-btn {
  border-color: rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.08);
  color: #5b21b6;
}
.message-item--incoming .message-action-btn {
  border-color: #e6e6e6;
  background: #ffffff;
  color: #111827;
}

.dark-theme .message-action-btn {
  border-color: rgba(71, 85, 105, 0.7);
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.92);
}
.dark-theme .message-item--outgoing .message-action-btn {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.14);
  color: rgba(221, 214, 254, 0.95);
}

.message-text {
  margin-top: 10px;

  white-space: pre-wrap;
  word-break: break-word;
}

.message-text a,
.message-translation a {
  color: rgba(147, 197, 253, 0.98);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.message-text a:hover,
.message-translation a:hover {
  color: rgba(191, 219, 254, 0.98);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  gap: 15px;
}

.message-sender {
  font-weight: 800;
  color: rgb(188 188 188 / 90%);
}

.message-time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85em;
}

.chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
  margin-left: 8px;
}

.message-body {
  word-wrap: break-word;
  color: white;
  font-size: 13px;
  line-height: 1.4;
}

.message .message-header .push-badge,
.message .message-header .badge.push-badge {
  display: none !important;
}

.chat-messages {
  flex: 1;
  padding: 15px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior-x: contain;
  background-color: #f5f7fa;
  display: flex;
  flex-direction: column;
  transition: var(--crm-hover-transition);
  position: relative;
}

.chat-messages-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 247, 250, 0.86);
  backdrop-filter: blur(2px);
  z-index: 10;
}
.chat-messages-loading.is-hidden {
  display: none !important;
}


@supports (-webkit-touch-callout: none) {
  .chat-messages-loading {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    opacity: 1;
    visibility: visible;
    transition: opacity 140ms ease, visibility 0s linear 0s;
    will-change: opacity;
  }
  .chat-messages-loading.is-hidden {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 140ms ease, visibility 0s linear 140ms;
  }
}
.chat-messages-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}
.chat-spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 3px solid rgba(91, 33, 182, 0.18);
  border-top-color: var(--crm-accent);
  animation: chatSpin 0.8s linear infinite;
}
@keyframes chatSpin {
  to {
    transform: rotate(360deg);
  }
}
.chat-messages-loading-text {
  font-size: 13px;
  color: #374151;
  font-weight: 600;
}

.last-btn {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(var(--chat-input-safe-bottom, 92px) + env(safe-area-inset-bottom) + 10px);
  z-index: 30;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #111827;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: var(--crm-hover-transition);
  max-width: min(520px, calc(100% - 24px));
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.last-btn__icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--crm-accent);
}
.last-btn__text {
  line-height: 1;
}
.last-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.last-btn:active {
  transform: translate(-50%, 1px);
}

.chat-empty-state {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

.chat-empty-state.is-hidden {
  display: none !important;
}

.chat-empty-state-card {
  width: min(600px, 100%);
  height: min(400px, 60vh);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
}

.chat-empty-state-logo {
  width: 100%;
  max-width: 208px;
  height: auto;
  opacity: 0.95;
  margin-bottom: 20px;
}

.chat-empty-state-text {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 18px;
  color: #1f2937;
}

@keyframes messageAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-list-container {
  position: absolute;
  inset: 0;
  height: 100%;
  overflow-y: auto;
  padding-top: calc(12px + 56px + 10px);
  padding-bottom: calc(12px + 52px + 10px);
  transition: var(--crm-hover-transition);
  scrollbar-width: none !important;
  scrollbar-color: transparent transparent;
  -ms-overflow-style: none;
}
.chat-list-container::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
.chat-list-container::-webkit-scrollbar-thumb {
  background: transparent !important;
}
.chat-list-container::-webkit-scrollbar-track {
  background: transparent !important;
}

@keyframes chatAppear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  box-shadow: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  transition:
    var(--crm-hover-transition),
    max-height 220ms ease,
    opacity 180ms ease,
    padding-top 220ms ease,
    padding-bottom 220ms ease,
    border-bottom-width 220ms ease;
  max-height: var(--chat-item-max-height, 160px);
  will-change: max-height, opacity, transform, padding;
}

.chat-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.chat-left .chat-info {
  min-width: 0;
  flex: 1 1 auto;
}

.crm-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  flex: 0 0 36px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(263.87deg, #7c3aed 0%, #5b21b6 100%);
  box-shadow: rgba(124, 58, 237, 0.18) 0px 6px 12px;
  border: 1px solid rgba(91, 33, 182, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  user-select: none;
}
.crm-avatar__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;

  
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
}
.crm-avatar__fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  -webkit-text-fill-color: currentColor;
  font-size: inherit;
  line-height: 1;
  text-rendering: geometricPrecision;
  position: absolute;
  inset: 0;
  z-index: 1;
  -webkit-font-smoothing: antialiased;
}

.crm-avatar.has-image .crm-avatar__img {
  display: block;
}
.crm-avatar.has-image .crm-avatar__fallback {
  display: none;
}

.crm-avatar--chat {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  overflow: visible;
}

.chat-source-icon {
  position: absolute;
  right: -3px;
  bottom: -3px;
  z-index: 4;
  width: 17px;
  height: 17px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}

.chat-source-icon__svg {
  display: block;
  width: 100%;
  height: 100%;
  flex: 0 0 100%;
}

.chat-source-icon--website {
  padding: 2px;
}

.chat-source-icon--website .chat-source-icon__svg {
  fill: #111827;
}
.crm-avatar--lead {
  width: 40px;
  height: 40px;
  flex-basis: 40px;
}

.chat-item.hidden {
  opacity: 0;
  transform: scaleY(0.98);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-width: 0;
  pointer-events: none;
}

@keyframes chatDisappear {
  to {
    opacity: 0;
    transform: translateY(-10px);
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom-width: 0;
  }
}

.chat-item.moving-up {
  transform: translateY(-10px);
  opacity: 0.8;
}

.chat-item.moving {
  transition: var(--crm-hover-transition);
  z-index: 10;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

@keyframes scaleIn {
  from {
    transform: scale(0.5);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes scaleOut {
  to {
    transform: scale(0.5);
    opacity: 0;
  }
}

.chat-item.updating {
  background-color: rgba(245, 245, 245, 0.8);
  transition: var(--crm-hover-transition);
}

.inactive-chat-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  background-color: var(--red-btn-color);
  color: white;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.4;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
  animation:
    badgeFadeIn 0.3s ease,
    badgeShadowPulse 2s infinite;
}


.chat-item-tags .inactive-chat-badge {
  margin-left: 0;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  line-height: 1;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(15, 23, 42, 0.18);
  animation: none;
}

.ci-tag--inactive {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #b91c1c;
}

html.dark-theme .ci-tag--inactive {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

@keyframes badgeShadowPulse {
  0% {
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
  }

  50% {
    box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
  }

  100% {
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
  }
}

@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: translateX(5px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.chat-item.active {
  background-color: #f8f5ff;
  border-left: 3px solid #7c3aed;
  position: relative;
}

.chat-item.visual-inactive {
  background-color: var(--red-btn-bg);
}
.chat-item.visual-inactive.active {
  background-color: var(--red-btn-bg);
  border-left: 3px solid var(--red-btn-color);
}
.chat-item.visual-inactive.active::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: var(--red-btn-color);
  border-radius: 2px 0 0 2px;
}

.chat-item:hover:not(.active) {
  background-color: #f9f9f9;
  transition: var(--crm-hover-transition);
}

.chat-item.active .chat-name {
  color: #5b21b6;
  font-weight: 600;
}

.chat-item.active .chat-preview {
  color: #6b46c1;
}

.chat-item.active .chat-time {
  color: var(--primary);
  font-weight: 500;
}

.chat-item.active::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  background: #7c3aed;
  border-radius: 2px 0 0 2px;
}

.chat-item.unread {
  background-color: #f0f4ff;
}

.chat-item.chat-item--pinned:not(.active) {
  position: relative;
}

.chat-item.chat-item--pinned:not(.active)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #d97706;
  pointer-events: none;
}

.chat-item.unread .chat-name {
  font-weight: 700;
}

.chat-input {
  padding: 15px;

  padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(263.87deg, #ffffff 0%, #f8fafc 100%);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
}

.action-btn.send-msg-btn {
  transition: var(--crm-hover-transition);
  margin-left: 10px;
  height: 45px;
  width: 45px;
  align-self: flex-end;
  padding: 6px 10px;
}

.file-info {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 8px 12px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
  width: 100%;
  flex: 0 0 100%;
  order: 99;
}

.file-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.file-name {
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90%;
}

.file-remove-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.file-remove-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.input-with-icon input,
.input-with-icon textarea {
  width: 100%;
  padding: 6px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: var(--crm-hover-transition);
  background-color: #f9f9f9;
}

.chat-textarea {
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
  min-height: 45px;
  max-height: calc(1.4em * 8 + 12px);
  white-space: pre-wrap;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chat-textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.push-card {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.push-card[role="button"] {
  cursor: pointer;
}
.push-card:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border-color: #e0e7ff;
}
.push-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
  border-color: #c7d2fe;
}
.push-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.push-card__title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.push-card__author {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.push-card__tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
}
.icon-btn {
  border: none;
  background: #f3f4f6;
  color: #374151;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover {
  background: #e5e7eb;
}
.icon-btn.push-refresh {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--crm-hover-transition);
  will-change: transform;
  transform-origin: center;
}
.icon-btn.push-refresh:hover {
  background: #f9fafb;
  color: #4b5563;
  border-color: #d1d5db;
  transform: translateZ(0) scale(1.01);
}
.icon-btn.push-refresh:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}
.icon-btn.push-refresh svg {
  width: 16px;
  height: 16px;
  display: block;
}
.icon-btn.push-refresh svg path {
  fill: currentColor;
}
.icon-btn.push-refresh.is-loading svg {
  animation: crm-spin 0.9s linear infinite;
}

.push-card__tools .status-pill {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}
.status-success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}
.status-failed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.status-processing {
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
}
.status-default {
  background: #f3f4f6;
  color: #6b7280;
}

.status-success::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.707a1 1 0 00-1.414-1.414L9 10.172 7.707 8.879a1 1 0 10-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.707a1 1 0 00-1.414-1.414L9 10.172 7.707 8.879a1 1 0 10-1.414 1.414l2 2a1 1 0 001.414 0l4-4z' clip-rule='evenodd'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.status-failed::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM7.293 7.293a1 1 0 011.414 0L10 8.586l1.293-1.293a1 1 0 111.414 1.414L11.414 10l1.293 1.293a1 1 0 01-1.414 1.414L10 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L8.586 10 7.293 8.707a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M10 18a8 8 0 100-16 8 8 0 000 16zM7.293 7.293a1 1 0 011.414 0L10 8.586l1.293-1.293a1 1 0 111.414 1.414L11.414 10l1.293 1.293a1 1 0 01-1.414 1.414L10 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L8.586 10 7.293 8.707a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.status-processing::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 2a8 8 0 100 16v-2a6 6 0 110-12V2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 2a8 8 0 100 16v-2a6 6 0 110-12V2z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;

  animation: crm-spin 0.9s linear infinite;
  transform-origin: 50% 50%;
  will-change: transform;
}
.status-default::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M18 10A8 8 0 11.001 9.999 8 8 0 0118 10zM9 4a1 1 0 112 0v6a1 1 0 01-.293.707l-3 3a1 1 0 11-1.414-1.414L9 9.586V4z' clip-rule='evenodd'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' d='M18 10A8 8 0 11.001 9.999 8 8 0 0118 10zM9 4a1 1 0 112 0v6a1 1 0 01-.293.707l-3 3a1 1 0 11-1.414-1.414L9 9.586V4z' clip-rule='evenodd'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

@keyframes crm-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .status-processing::before {
    animation: none;
  }
}
.push-card__progress {
  margin-top: 8px;
}
.progress {
  height: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}
.progress .progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: var(--crm-hover-transition);
}
.progress .progress-bar.gradient {
  background: linear-gradient(90deg, #7c3aed 0%, #5b21b6 60%, #312e81 100%);
}

.progress.progress--split {
  display: flex;
  background: transparent;
}
.progress.progress--split .progress-bar {
  border-radius: 0;
  transition: var(--crm-hover-transition);
}
.progress.progress--split .progress-bar--done {
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}
.progress.progress--split .progress-bar--rest {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}
.progress .progress-bar--solo {
  border-radius: 999px !important;
}
.progress .progress-bar--rest-pending {
  background: linear-gradient(90deg, #e5e7eb 0%, #cbd5e1 70%, #e5e7eb 100%);
}
.progress .progress-bar--rest-scheduled {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.18) 0%, rgba(91, 33, 182, 0.28) 45%, rgba(49, 46, 129, 0.18) 100%);
  background-size: 200% 100%;
  animation: pushScheduledPulse 1.8s ease-in-out infinite;
}
.progress .progress-bar--rest-failed {
  background: linear-gradient(90deg, #fecaca 0%, #fca5a5 60%, #f87171 100%);
}
.push-card__stats {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: #374151;
}
.push-card__stats .failed {
  color: #ef4444;
}

.push-card__stats .failed {
  display: none !important;
}
.push-card__stats .status-pill {
  margin-left: auto;
}

.push-card__stats .scheduled-at {
  color: #4b5563;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.16);
  white-space: nowrap;
}

.status-pill.status-scheduled {
  background: rgba(124, 58, 237, 0.1);
  color: #5b21b6;
  border: 1px solid rgba(124, 58, 237, 0.22);
}

@keyframes pushScheduledPulse {
  0% {
    background-position: 0% 50%;
    filter: saturate(1);
  }
  50% {
    background-position: 100% 50%;
    filter: saturate(1.2);
  }
  100% {
    background-position: 0% 50%;
    filter: saturate(1);
  }
}
.push-card__footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b7280;
}
.push-card__footer .spacer {
  flex: 1;
}
.text-btn {
  border: none;
  background: none;
  color: #7c3aed;
  cursor: pointer;
  padding: 4px 6px;
}
.text-btn:hover {
  text-decoration: underline;
}

.push-card__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px 0;
}


.pipeline-dropdown-menu .dropdown-toolbar,
.lead-dropdown-menu .dropdown-toolbar {
  padding: 0;
  border-bottom: 0;
}

.pipeline-dropdown-menu .dropdown-toolbar .select-all-btn,
.lead-dropdown-menu .dropdown-toolbar .select-all-btn {
  display: flex;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 8px;
  color: var(--bs-dropdown-link-color, #212529);
  cursor: pointer;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  align-items: center;
  transition: var(--crm-hover-transition);
}
.pipeline-dropdown-menu .dropdown-toolbar .select-all-btn:hover,
.pipeline-dropdown-menu .dropdown-toolbar .select-all-btn:focus,
.lead-dropdown-menu .dropdown-toolbar .select-all-btn:hover,
.lead-dropdown-menu .dropdown-toolbar .select-all-btn:focus {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #5b21b680;
}

.pipeline-dropdown-menu .dropdown-toolbar .select-all-btn.is-active,
.lead-dropdown-menu .dropdown-toolbar .select-all-btn.is-active {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #5b21b680;
}

@media (max-width: 640px) {
  .push-card {
    padding: 10px;
  }

  .push-card__header {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .push-card__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .push-card__tools {
    justify-content: flex-end;
  }
  .status-pill {
    font-size: 11px;
    padding: 3px 6px;
  }
  .icon-btn.push-refresh {
    width: 28px;
    height: 28px;
  }
  .push-card__progress {
    margin-top: 6px;
  }
  .progress {
    height: 6px;
  }
  .push-card__stats {
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .push-card__tools {
    flex-direction: row;
    gap: 6px;
  }
  .push-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }
  .push-card__footer .spacer {
    display: none;
  }
}

.push-groups-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.push-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}
.push-filter {
  position: relative;
}
.push-filter .filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-size: 13px;
  transition: var(--crm-hover-transition);
  will-change: transform;
  transform-origin: center;
}
.push-filter .filter-btn:hover {
  background: #f9fafb;
  transform: translateY(-1px) scale(1.01);
}
.push-filter .filter-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 15;
  min-width: 180px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.12);
  padding: 6px;
  display: none;

  max-height: clamp(160px, 40vh, 320px);
  overflow-y: auto;
  overflow-x: hidden;

  width: auto;
  overscroll-behavior: contain;

  -ms-overflow-style: none;
  scrollbar-width: none;
}
.push-filter .filter-menu::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.push-filter.open .filter-menu {
  display: block;
}
.push-filter .filter-menu .item {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.push-filter .filter-menu .item:hover {
  background: #f3f4f6;
}

.push-filter .filter-menu .item.is-active {
  background: #ede9fe;
  color: #4c1d95;
}

.push-filter.align-right .filter-menu {
  left: auto;
  right: 0;
}

.push-groups-toolbar .push-refresh {
  margin-left: auto;
  flex: 0 0 auto;
}

.push-filter .filter-menu .item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--crm-accent-focus);
  border-radius: 8px;
}
.push-details-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.push-details-meta {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.push-details-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.push-details-meta .meta-label {
  color: #6b7280;
  font-weight: 600;
}
.push-details-meta .meta-value {
  color: #111827;
}
.push-row {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid #f3f4f6;
  border-radius: 10px;
  flex-wrap: wrap;
}
.push-row {
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.push-row:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.push-row.is-disabled {
  cursor: default;
  opacity: 0.7;
}
.push-row.is-disabled:hover {
  background: transparent;
  border-color: #f3f4f6;
  box-shadow: none;
}

.push-row .badge {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-right: 5px;
}
.push-row .st-ok {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.push-row .st-err {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}
.push-row .st-pending {
  background: #f3f4f6;
  color: #6b7280;
}
.push-row .row-chat {
  flex: 1;
  color: #111827;
  font-weight: 500;
}
.push-row .chat-plat {
  color: #6b7280;
  font-weight: 400;
}
.push-row .row-error {
  color: #b91c1c;
  font-size: 12px;
  flex-basis: 100%;
  padding: 0 8px;
}
.list-loading,
.empty-list {
  color: #6b7280;
  padding: 8px;
}

.tooltip.crm-tooltip .tooltip-inner {
  background-color: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.tooltip.crm-tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: #111827;
}
.tooltip.crm-tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: #111827;
}
.tooltip.crm-tooltip.bs-tooltip-start .tooltip-arrow::before {
  border-left-color: #111827;
}
.tooltip.crm-tooltip.bs-tooltip-end .tooltip-arrow::before {
  border-right-color: #111827;
}

.message.is-push .message-header .badge.push-badge {
  background: #fff;
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.3);
}
.message.is-push .message-header .badge.push-badge.push-badge--buttons {
  background: #fff;
  color: #5b21b6;
  border: 1px solid rgba(91, 33, 182, 0.35);
}
.message.is-push .message-header .badge.push-badge.push-badge--pin {
  background: #fff;
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.35);
}

.message-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.message-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(124, 58, 237, 0.25);
  background: #fff;
  color: #5b21b6;
  text-decoration: none;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.message-btn--next {
  border-style: dashed;
}

.with-attach-btn {
  padding-right: 14px !important;
  width: 100%;
}

.attach-btn-inside {
  position: absolute;
  right: 65px;
  bottom: 5px;
  transform: none;
  cursor: pointer;
  padding: 8px;
  color: #6b7280;
  transition: var(--crm-hover-transition), right 0.2s ease;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.attach-btn-inside:hover {
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px) scale(1.02);
}

.more-actions-btn {
  right: 95px;
  border: none;
  background: none;
}

.emoji-btn {
  right: 155px;
  border: none;
  background: none;
}

/* Фокус инпута: ряд кнопок уезжает влево, чтобы не перекрываться
   иконкой расширения DeepL у правого края поля. */
#message-input:focus ~ .lead-macros-btn {
  right: 215px;
}
#message-input:focus ~ .emoji-btn {
  right: 185px;
}
#message-input:focus ~ .comments-panel-btn {
  right: 155px;
}
#message-input:focus ~ .more-actions-btn {
  right: 125px;
}
#message-input:focus ~ label.attach-btn-inside {
  right: 95px;
}


html.dark-theme emoji-picker.picker,
html.dark-theme emoji-picker {
  color-scheme: dark;
  --background: var(--bg-elevated);
  --border-color: var(--border-strong);
  --border-radius: 12px;
  --input-border-color: var(--border-strong);
  --input-font-color: var(--text);
  --input-placeholder-color: var(--text-light);
  --button-hover-background: rgba(167, 139, 250, 0.14);
  --button-active-background: rgba(167, 139, 250, 0.22);
  --category-font-color: var(--text);
  --indicator-color: #a78bfa;
  --outline-color: rgba(167, 139, 250, 0.65);
}

.attach-btn-inside svg {
  width: 18px;
  height: 18px;
}


.attach-btn-inside svg *:not(defs):not(defs *)[stroke="#000"],
.attach-btn-inside svg *:not(defs):not(defs *)[stroke="#000000"],
.attach-btn-inside svg *:not(defs):not(defs *)[stroke="black"],
.attach-btn-inside svg *:not(defs):not(defs *)[stroke="rgb(0,0,0)"],
.attach-btn-inside svg *:not(defs):not(defs *)[stroke="rgb(0, 0, 0)"] {
  stroke: currentColor;
}
.attach-btn-inside svg *:not(defs):not(defs *)[fill="#000"],
.attach-btn-inside svg *:not(defs):not(defs *)[fill="#000000"],
.attach-btn-inside svg *:not(defs):not(defs *)[fill="black"],
.attach-btn-inside svg *:not(defs):not(defs *)[fill="rgb(0,0,0)"],
.attach-btn-inside svg *:not(defs):not(defs *)[fill="rgb(0, 0, 0)"] {
  fill: currentColor;
}



.send-btn {
  padding: 10px 14px;
  background: #00ad64;
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  transition: var(--crm-hover-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-textarea {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chat-textarea::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.input-with-icon .chat-textarea.with-attach-btn {
  padding-bottom: 56px;
}

.input-with-icon .chat-textarea.with-attach-btn:placeholder-shown:not(:focus) {
  height: 43px !important;
  min-height: 43px;
  max-height: 43px;

  padding-top: 0;
  padding-bottom: 0;
  line-height: 43px;
  overflow-y: hidden;
}

.input-with-icon .chat-textarea.with-attach-btn:focus,
.input-with-icon .chat-textarea.with-attach-btn:not(:placeholder-shown) {
  line-height: 1.4;
  min-height: 45px;
  max-height: calc(1.4em * 8 + 12px);
  overflow-y: auto;

  padding-top: 6px;
  padding-bottom: 56px;
}

.chat-input .input-with-icon::after {
  content: "";
  position: absolute;
  right: 60px;
  bottom: 4px;
  height: 38px;
  width: 170px;
  background: linear-gradient(
    90deg,
    rgba(249, 249, 249, 0) 0%,
    rgba(249, 249, 249, 1) 40%
  );
  border-bottom-right-radius: 8px;
  pointer-events: none;
  z-index: 1;
  transition: width 0.2s ease;
}
.chat-input .input-with-icon:has(#message-input:focus)::after {
  width: 200px;
}
.input-with-icon .chat-textarea.with-attach-btn {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.input-with-icon .chat-textarea.with-attach-btn::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.chat-sidebar {
  width: 300px;
  background: #fff;
  border-right: 1px solid var(--border);
  height: 100%;
  overflow: hidden;
  position: relative;
  transition: var(--crm-hover-transition);
}

.chat-layout .chat-sidebar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chat-layout .chat-sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}


.chat-layout {
  display: flex;

  height: var(--app-vh, 100dvh);

  overflow-x: hidden;
  overscroll-behavior-y: contain;
  position: relative;
}


.app-header + .chat-layout {
  height: calc(var(--app-vh, 100dvh) - var(--app-header-height, 64px));
}


.chat-item:hover {
  background: #f8f9fa;
}

.chat-info {
  flex: 1;
  overflow: hidden;
}

.chat-info-header {
  display: flex;
  align-items: center;
  flex-direction: row;
  margin-bottom: 4px;
  min-width: 0;
  flex: 1;
}

.chat-name-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.chat-item-pin-icon {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: #d97706;
  line-height: 0;
}

.chat-item--pinned .chat-item-pin-icon {
  display: inline-flex;
}

.chat-item.active .chat-item-pin-icon {
  color: #7c3aed;
}

.chat-item-pin-icon__svg {
  width: 14px;
  height: 14px;
  display: block;
}

.chat-name-wrap .chat-name {
  flex: 1;
  min-width: 0;
  flex-shrink: 1;
}

.chat-name {
  display: flex;
  align-items: center;
  font-weight: 600;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.chat-info-status {
  display: flex;
  min-width: 0;
  flex-shrink: 1;
}

.chat-preview {
  font-size: 13px;
  color: var(--text-light);
  max-width: 20ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-count {
  background: var(--green-btn-color);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.chat-time {
  font-size: 12px;
  color: var(--text-light);
  margin-left: 8px;
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}


.chat-main .chat-source-tabs,
.chat-main .automation-runs-bar {
  transition: opacity 180ms ease, transform 180ms ease;
  will-change: opacity, transform;
}
.chat-main.is-opening .chat-source-tabs,
.chat-main.is-opening .automation-runs-bar {
  opacity: 0;
  transform: translateY(8px);
}

.chat-layout {
  overflow-x: hidden;
}

.chat-header-top .back-btn {
  display: none;
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #374151;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  align-items: center;
  gap: 6px;
  height: 32px;
  width: 32px;
}
.chat-header-top .back-btn svg {
  display: inline-block;
}
.chat-header-top .back-btn-label {
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 768px) {
  .chat-header-top .back-btn-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .chat-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .chat-header-top .back-btn {
    display: inline-flex;
  }

  .chat-header-top-right {
    margin-left: auto;
  }

  .chat-header-top .pipeline-stage-change-wrapper {
    flex: 0 0 0;
    width: 0;
    min-width: 0;
    margin: 0;
  }
}


@media (max-width: 480px) {
  .chat-header-top .lead-status-badge {
    display: none !important;
  }

  .chat-header-top .lead-name .lead-mobile-status-pill {
    display: inline-flex;
  }
}

.chat-header-top .lead-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-header-top #pipeline-stage-icon-btn {
  min-width: 36px;
}

.chat-header-top #pipeline-stage-icon-btn .chat-quick-action-btn__label {
  display: none;
}

@media (min-width: 992px) {
  .chat-header-top #pipeline-stage-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    max-width: min(360px, 32vw);
    padding: 0 12px;
  }

  .chat-header-top #pipeline-stage-icon-btn svg {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
  }

  .chat-header-top #pipeline-stage-icon-btn .chat-quick-action-btn__label {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
  }
}


.pipeline-stage-change-wrapper .dropdown-menu.pipeline-dropdown-menu.portal {
  position: fixed !important;
  inset: auto auto auto auto;
  transform: none !important;
  z-index: 3000;
}

.info-btn.is-half {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #4c1d95;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.04),
    0 0 0 3px rgba(196, 181, 253, 0.25);
}
.info-btn.is-half img {
  filter: none;
}

.info-btn.is-full {
  background: #5b21b6;
  border-color: #4c1d95;
  color: #ffffff;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 0 0 3px rgba(91, 33, 182, 0.2);
}
.info-btn.is-full img {
  filter: invert(1) brightness(1.6) contrast(0.95);
}

.lead-info-panel {
  --handle-height: 18px;
  --closed-offset: 10px;
  --half-height: 38vh;
  --full-height: 60vh;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;

  height: var(--full-height, 60vh);
  min-height: 320px;
  background: #ffffff;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
  
  transform: translate3d(0, calc(100% - var(--handle-height)), 0);
  transition:
    transform 380ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 380ms cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 200;
  display: block;

  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}


@media (max-width: 768px) {
  .lead-info-panel {
    transition:
      transform 520ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 520ms cubic-bezier(0.22, 1, 0.36, 1);
  }
}

.lead-info-panel.state-closed {
  transform: translate3d(
    0,
    calc(100% - var(--handle-height) - var(--closed-offset)),
    0
  );

  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.06);
}
.lead-info-panel.state-half {
  transform: translate3d(0, calc(100% - var(--half-height)), 0);
}
.lead-info-panel.state-full {
  transform: translate3d(0, calc(100% - var(--full-height)), 0);
}

@media (prefers-reduced-motion: reduce) {
  .lead-info-panel {
    transition: none !important;
  }
}
.lead-info-panel .lead-info-grabber {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  z-index: 2;
  height: calc(var(--handle-height) + var(--closed-offset));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: ns-resize;
  user-select: none;

  pointer-events: none;
  touch-action: none;
}

.lead-info-panel .lead-info-grabber .grabber-bar {
  pointer-events: auto;
}

.lead-info-panel .grabber-bar {
  display: block;
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
}

.lead-info-panel .lead-info-content {
  padding: 16px 16px 70px 16px;
  height: calc(100% - (var(--handle-height) + var(--closed-offset)));
  overflow: auto;
}

.lead-info-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  align-items: stretch;
  position: relative;
  z-index: 3;
  background: transparent;
  padding: 16px 16px 10px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lead-info-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #ffffff;

  margin-top: -16px;
  padding: 16px 0 8px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.lead-info-header .lead-info-tabs {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  background: transparent;
  padding-bottom: 0;
  box-shadow: none;
  margin: 0;
}

.lead-info-header::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
  background: #ffffff;
  pointer-events: none;
}
.lead-tab-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: var(--crm-hover-transition);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: auto;
  text-align: center;
}
.lead-tab-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.lead-tab-btn.active {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #4c1d95;
}
.lead-info-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 10px;
}
.lead-info-toolbar .toolbar-hint {
  font-size: 12px;
  color: #6b7280;
  margin-left: auto;
}
.domain-input-label {
  font-size: 12px;
  color: #4b5563;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.domain-input {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
}
.lead-tab-content {
  display: none;
}
.lead-tab-content.active {
  display: block;
}
.lead-tab-empty {
  font-size: 13px;
  color: #6b7280;
  padding: 6px 0;
}

.lead-orders-table,
.lead-verifications-table,
.lead-bindings-table,
.lead-bindings-available-table,
.lead-bindings-used-table,
.lead-paidpairs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.lead-orders-table th,
.lead-orders-table td,
.lead-verifications-table th,
.lead-verifications-table td,
.lead-bindings-table th,
.lead-bindings-table td,
.lead-bindings-available-table th,
.lead-bindings-available-table td,
.lead-bindings-used-table th,
.lead-bindings-used-table td,
.lead-paidpairs-table th,
.lead-paidpairs-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
}
.lead-orders-table th,
.lead-verifications-table th,
.lead-bindings-table th,
.lead-paidpairs-table th {
  background: #f8fafc;
  font-weight: 600;
}

select.status-select,
select.order-status-select {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
}
.tx-links a {
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
}
.tx-links a:hover {
  text-decoration: underline;
}
.identity-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
}
.identity-summary .label {
  color: #6b7280;
  margin-right: 6px;
}
.lead-bindings-wrap {
  display: grid;
  gap: 12px;
}
.lead-bindings-wrap .bindings-list h3,
.lead-bindings-wrap .paid-pairs h3 {
  margin: 6px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Ubuntu,
    Cantarell,
    Noto Sans,
    Arial,
    "Apple Color Emoji",
    "Segoe UI Emoji";
}
.lead-bindings-wrap .identity-summary {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.lead-bindings-wrap .identity-summary .identity-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lead-bindings-wrap .identity-summary .identity-line .label {
  min-width: 140px;
  color: #374151;
  font-weight: 600;
}
.lead-bindings-wrap .identity-summary .domain-input {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
}
.lead-bindings-wrap .identity-summary .action-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
@media (min-width: 768px) {
  .lead-bindings-wrap .identity-summary {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.crm-dd-menu .crm-dd-search {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.crm-dropdown.tg-identity-dd {
  width: 100%;
  min-width: 0;
}

#tg-bind-dd {
  width: 100%;
}


.lead-bindings-wrap .identity-summary .identity-line.tg-bind-line {
  flex-direction: column;
  align-items: flex-start !important;
}

.crm-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 4px 6px;
}
.crm-stepper .stepper-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--crm-hover-transition);
  will-change: transform;
  transform-origin: center;
}
.crm-stepper .stepper-btn:hover {
  background: #f3f4f6;
  transform: translateZ(0) scale(1.01);
}

.stepper-btn {
  transition: var(--crm-hover-transition);
  will-change: transform;
  transform-origin: center;
}
.stepper-btn:hover:not([disabled]):not(.disabled):not([aria-disabled="true"]) {
  transform: translateZ(0) scale(1.01);
}

.push-filter .filter-btn[disabled],
.push-filter .filter-btn.disabled,
.push-filter .filter-btn[aria-disabled="true"],
.icon-btn.push-refresh[disabled],
.icon-btn.push-refresh.disabled,
.icon-btn.push-refresh[aria-disabled="true"],
.orders-clear-btn[disabled],
.orders-clear-btn.disabled,
.orders-clear-btn[aria-disabled="true"],
.crm-stepper .stepper-btn[disabled],
.crm-stepper .stepper-btn.disabled,
.crm-stepper .stepper-btn[aria-disabled="true"] {
  pointer-events: none;
  transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .push-filter .filter-btn,
  .icon-btn.push-refresh,
  .orders-clear-btn,
  .crm-stepper .stepper-btn,
  .stepper-btn {
    transition: var(--crm-hover-transition);
    transform: none !important;
  }
}

.stepper-btn[disabled],
.stepper-btn.disabled,
.stepper-btn[aria-disabled="true"] {
  pointer-events: none;
  transform: none !important;
}
.crm-stepper .stepper-value {
  min-width: 36px;
  text-align: center;
  font-weight: 600;
  color: #1f2937;
}

.lead-tab-content#lead-tab-profile .profile-statuses {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.lead-tab-content#lead-tab-profile .profile-statuses .status-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  position: relative;
  flex-direction: column;
}
.lead-tab-content#lead-tab-profile .profile-statuses .status-row > label {
  min-width: 140px;
  color: #374151;
  font-family: var(--font-family-text) !important;
  font-size: 14px;
}
.lead-tab-content#lead-tab-profile
  .profile-statuses
  select.status-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 8px 36px 8px 10px;
  font-size: 12px;
  color: #1f2937;
  line-height: 1.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
}

.lead-tab-content#lead-tab-profile .profile-statuses .status-row::after {
  content: none;
}
.lead-tab-content#lead-tab-profile .lead-verifications-table {
  font-size: 12px;
}
.lead-tab-content#lead-tab-profile .lead-verifications-table th {
  background: #f8fafc;
  font-weight: 600;
}
.lead-tab-content#lead-tab-profile .lead-verifications-table td,
.lead-tab-content#lead-tab-profile .lead-verifications-table th {
  padding: 6px 8px;
}

.lead-orders-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.lead-orders-domains {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px 0;
}
.lead-orders-filters {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "search clear"
    "status arb";
  gap: 8px;
  margin: 0 0 8px 0;
}
.lead-orders-filters .orders-search-input {
  grid-area: search;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  min-width: 180px;
}
.lead-orders-filters .orders-clear-btn {
  grid-area: clear;
  appearance: none;
}
.lead-orders-filters .orders-status-filter {
  grid-area: status;
}
.lead-orders-filters .orders-arb-filter {
  grid-area: arb;
}

.lead-orders-filters select.orders-status-filter,
.lead-orders-filters select.orders-arb-filter,
select.order-status-select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  border-radius: 8px !important;
  padding: 6px 34px 6px 10px !important;
  font-size: 12px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 10px 6px !important;
}



select.order-status-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  padding: 6px 34px 6px 10px;
  font-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
}
.orders-no-results {
  font-size: 12px;
  color: #6b7280;
  padding: 6px 0;
}
.lead-orders-domains .domain-chip {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.lead-orders-domains .domain-chip:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.lead-orders-domains .domain-chip:active {
  transform: translateY(1px);
}
.lead-orders-domains .domain-chip.active {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #4c1d95;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.25);
}
.order-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.order-card-date {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
}
.order-card-id {
  font-size: 11px;
  color: #6b7280;
}
.order-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.order-card.binding-card .order-card-body {
  grid-template-columns: 1fr;
  gap: 12px;
}
.order-card.binding-card .order-card-body > div {
  display: grid;
  gap: 6px;
}
.order-card.binding-card .order-card-body > div > div {
  margin-bottom: 0;
}

.order-card.binding-card .order-card-body .kv-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.order-card.binding-card .order-card-body .kv-line .rank-badge {
  text-align: center;
}

.lead-bindings-used-cards .order-card.binding-card {
  margin-bottom: 10px;
}

.lead-bindings-available-cards .order-card.binding-card {
  margin-bottom: 10px;
}

.avail-assign-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 10px;
}
.lead-bindings-available-cards {
  border-top: 1px dashed #e5e7eb;
  padding-top: 10px;
}

.binding-card-actions {
  margin-top: 8px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-direction: column;
}
.binding-card-actions .crm-dropdown {
  min-width: 0;
  display: contents;
}
.binding-card-actions .action-btn {
  width: 100%;
}

.rank-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  border: 1px solid transparent;
}
.rank-badge.vip {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}
.rank-badge.private {
  background: #ede9fe;
  color: #4c1d95;
  border-color: #a78bfa;
}
.rank-badge.regular {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.order-card .approx-usd {
  display: none !important;
}
.order-asset {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.order-asset .label {
  font-size: 11px;
  color: #6b7280;
}
.order-asset .value {
  font-size: 13px;
  color: #1f2937;
  font-weight: 600;
}
.order-card-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.order-card-status .status-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.order-card-status .status-block label {
  font-size: 11px;
  color: #6b7280;
}
.order-card-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.order-card-toggle {
  font-size: 12px;
  color: #2563eb;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}


.lead-automation-runs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.lead-automation-empty {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}


.lead-widget-site-rows {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}

.lead-widget-site-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  line-height: 1.35;
}

.lead-widget-site-row:last-child {
  border-bottom: none;
}

.lead-widget-site-row .label {
  flex: 0 0 auto;
  color: #6b7280;
  font-weight: 500;
}

.lead-widget-site-row .label::after {
  content: ":";
}

.lead-widget-site-row .value {
  flex: 1 1 auto;
  min-width: 0;
  color: #111827;
  word-break: break-word;
}

/* Compact copy chip: same footprint as tracker .tt-ip-copy (22×22, 14px icon). */
.lead-widget-site-row .lead-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-light, #626b75);
  cursor: pointer;
  flex: 0 0 22px;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}

.lead-widget-site-row .lead-copy-btn:hover,
.lead-widget-site-row .lead-copy-btn:focus-visible {
  color: var(--primary);
  background: var(--primary-light);
  outline: none;
}

.lead-widget-site-row .lead-copy-btn .btn-icon {
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 !important;
}

.lead-widget-site-row .lead-copy-btn--done {
  color: var(--green-btn-color, #166534);
  background: var(--green-btn-bg, transparent);
}

.lead-widget-site-row .lead-copy-btn--error {
  color: var(--red-btn-color, #b42334);
}

.lead-widget-param-add-area {
  margin-top: 10px;
}

/* Кнопка без стилей выглядела как системный элемент формы: пунктирная
   рамка отделяет «добавить» от списка уже переданных параметров. */
.widget-param-add-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}

.widget-param-add-trigger svg {
  flex: 0 0 auto;
}

.widget-param-add-trigger:hover {
  border-color: #a78bfa;
  color: #6d28d9;
  background: rgba(124, 58, 237, 0.06);
}

.widget-param-add-trigger:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.45);
  outline-offset: 2px;
}

.widget-param-add-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.widget-param-add-form input {
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-family: inherit;
  font-size: 12px;
}

.widget-param-add-form input:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.widget-param-add-form .action-btn {
  width: 100%;
  justify-content: center;
  font-size: 12px;
}



.lead-actions-conversion-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.lead-actions-conversion-label {
  display: block;
  width: 100%;
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

.lead-actions-conversion-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.lead-actions-conversion-controls #lead-actions-conversion-dd {
  flex: 8 1 0;
  min-width: 0;
}

.lead-actions-conversion-controls #lead-actions-send {
  flex: 2 1 0;
  min-width: 0;
}


.lead-profile-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}
.lead-profile-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
.lead-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.lead-profile-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lead-profile-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #374151;
  line-height: 1.2;
}
.lead-profile-username {
  color: #2563eb;
  font-weight: 600;
}
.lead-profile-sub .muted {
  color: #6b7280;
}
.lead-profile-sub .dot {
  color: #9ca3af;
}
.lead-profile-section {
  margin-top: 12px;
}
.order-card-details {
  display: none;
  margin-top: 8px;
  font-size: 12px;
  color: #374151;
  border-top: 1px dashed #e5e7eb;
  padding-top: 8px;
}
.order-card.expanded .order-card-details {
  display: block;
}
.order-detail-line {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}
.order-detail-line .label {
  width: 120px;
  color: #6b7280;
}
.hash-link {
  color: #2563eb;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
.hash-link:hover {
  text-decoration: underline;
}

.crm-dropdown {
  position: relative;
  display: inline-block;
  background: transparent;
  border: none;
  padding: 0;
}
.crm-dropdown .crm-dd-btn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #1f2937;
  border-radius: 8px;
  padding: 6px 34px 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  width: 100%;
  text-align: left;
  position: relative;
  transition: var(--crm-hover-transition);
  will-change: transform;
  min-width: 166px;
}


.crm-dropdown .crm-dd-btn[disabled]:hover,
.crm-dropdown .crm-dd-btn[disabled]:focus,
.crm-dropdown .crm-dd-btn[disabled]:focus-visible {
  background: #f9fafb;
  border-color: #e5e7eb;
  box-shadow: none;
  transform: none;
}
.crm-dropdown .crm-dd-btn::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239ca3af' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E");
  background-size: 10px 6px;
  background-repeat: no-repeat;
  background-position: center;
}
.crm-dropdown .crm-dd-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  display: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}

.crm-dropdown.open .crm-dd-menu {
  display: block;
}
.crm-dd-menu {
  display: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;

  overflow-x: hidden;
  padding: 6px;

  scrollbar-width: none;
  -ms-overflow-style: none;
  will-change: transform;
}
.crm-dd-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.slash-macros-menu {
  min-width: 260px;
  max-width: 520px;
  animation: fadeInScale 120ms ease;
}
.slash-macros-menu .crm-dd-option {
  white-space: nowrap;
}
.slash-macros-menu .crm-dd-option.selected {
  background: #ede9fe;
  color: #4c1d95;
}
.lead-macros-menu {
  min-width: 260px;
  max-width: 520px;
  animation: fadeInScale 120ms ease;
}
.lead-macros-menu .crm-dd-option.selected {
  background: #ede9fe;
  color: #4c1d95;
}
.lead-macro-option {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  min-width: 0;
}
.lead-macro-option .lm-key {
  flex: 0 0 auto;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lead-macro-option .lm-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-light, #6b7280);
}
.lead-macro-option .lm-alias {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text-light, #9ca3af);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lead-macros-menu .lead-macros-hint {
  padding: 8px 12px;
  border-top: 1px solid var(--border, #e5e7eb);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-light, #6b7280);
}
.lead-macros-menu .lead-macros-hint code {
  font-size: 11px;
}
.lead-macros-menu .lead-macros-note {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-light, #6b7280);
}
.lead-macros-menu .lead-macros-group {
  padding: 6px 12px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-light, #6b7280);
}
/* Кнопка «{ }» — единственный видимый вход в список макросов лида:
   про ввод «{» без неё никто не догадывается. */
.lead-macros-btn {
  right: 185px;
  border: none;
  background: none;
}
.lead-macros-btn__glyph {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: -1px;
}
.manual-flows-menu {
  min-width: 260px;
  max-width: 520px;
  animation: fadeInScale 120ms ease;
}
.manual-flows-menu .crm-dd-option {
  white-space: normal;
}
.manual-flow-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.manual-flow-option__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.manual-flow-option__name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.manual-flow-option__badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}
.manual-flow-option__meta {
  font-size: 11px;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manual-flow-badge {
  font-size: 10px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 2px 6px;
  font-weight: 600;
}
.manual-flow-badge.is-manual {
  background: rgba(14, 165, 233, 0.15);
  color: #0369a1;
}
.manual-flow-badge.is-published {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
}
.manual-flow-badge.is-draft {
  background: rgba(249, 115, 22, 0.16);
  color: #b45309;
}
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.crm-dd-menu {
  display: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
}
.crm-dd-option {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
  color: #111827;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--crm-hover-transition);
}
.crm-dd-option:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  color: var(--primary);
}
.crm-dd-option.selected {
  background: #ede9fe;
  color: #4c1d95;
}

.crm-dd-option .pair-option {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.slash-macros-menu .slash-macro-option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.slash-macros-menu .slash-macro-option .sm-text {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #111827;
}
.slash-macros-menu .slash-macro-option .sm-text .sm-prefix {
  font-weight: 700;
}
.slash-macros-menu .slash-macro-option .sm-att {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
}
.slash-macros-menu .slash-macro-option .sm-att svg {
  display: block;
  width: 14px;
  height: 14px;
}
.crm-dd-option .pair-tokens {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.crm-dd-option .pair-token {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}
.crm-dd-option .pair-token .ticker {
  font-weight: 700;
  color: #111827;
}
.crm-dd-option .pair-token .chain {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.15;
}
.crm-dd-option .pair-main {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.crm-dd-option .pair-id {
  font-size: 11px;
  color: #6b7280;
}
.crm-dd-option .pair-raw {
  color: #374151;
}

.lead-orders-filters .crm-dropdown.orders-status-filter {
  grid-area: status;
}
.lead-orders-filters .crm-dropdown.orders-arb-filter {
  grid-area: arb;
}

.lead-orders-filters .crm-dropdown.orders-status-filter,
.lead-orders-filters .crm-dropdown.orders-arb-filter {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

.crm-dropdown.status-select,
.crm-dropdown.order-status-select {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  width: 100% !important;
}

@media (min-width: 768px) {
  .lead-orders-cards {
    grid-template-columns: 1fr;
  }
}

.ver-section-title {
  margin: 6px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}
.lead-verifications-cards {
  display: flex;
  gap: 10px;
}
.ver-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid transparent;
}
.status-badge {
  align-self: flex-start;
  max-width: max-content;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-badge span {
  text-transform: uppercase;
}
.status-badge svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: 0.9;
}
.status-badge.sb-success {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.status-badge.sb-danger {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}
.status-badge.sb-warn {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}
.status-badge.sb-info {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}
.status-badge.sb-frozen {
  color: #475569;
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.status-badge.sb-muted {
  color: #6b7280;
  background: #f3f4f6;
  border-color: #e5e7eb;
}

.order-card-header .order-card-id {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.order-id-copy {
  background: none;
  border: 1px solid transparent;
  color: #6b7280;
  padding: 2px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 0;
}
.order-id-copy:hover {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #374151;
}
.order-id-copy.copied {
  color: #16a34a;
}

.lead-bindings-wrap {
  overflow-x: hidden;
}
.ver-card.loading,
.ver-empty {
  font-size: 12px;
  color: #6b7280;
}
.ver-card-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.ver-card-header .ver-id {
  font-size: 12px;
  color: #6b7280;
}
.ver-card-header .ver-type {
  font-size: 13px;
  color: #1f2937;
  font-weight: 600;
}
.ver-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  color: #374151;
  background: #f9fafb;
  white-space: nowrap;
}
.ver-status-verified {
  color: #065f46;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
}
.ver-status-rejected {
  color: #7f1d1d;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.35);
}
.ver-status-in_review {
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.35);
}
.ver-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ver-card-body .ver-meta .label {
  font-size: 11px;
  color: #6b7280;
  margin-right: 6px;
}
.ver-card-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.action-btn.approve-btn {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.action-btn.reject-btn {
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.action-btn.secondary {
  width: 100%;
}

.ver-modal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.ver-doc-box {
  background: #0b0b0b;
  border-radius: 8px;
  padding: 8px;
}
.ver-doc-box .doc-label {
  color: #e5e7eb;
  font-size: 12px;
  margin-bottom: 6px;
}
.ver-doc-box img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}
.ver-modal-details {
  background: #111827;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 10px;
}
.ver-modal-details h5 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #f3f4f6;
}
.ver-modal-details .detail-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  margin: 4px 0;
}
.ver-modal-details .detail-row .label {
  color: #9ca3af;
  min-width: 120px;
}
.ver-modal-loading,
.ver-modal-error {
  color: #e5e7eb;
  font-size: 14px;
}

@media (min-width: 768px) {
  .lead-verifications-cards {
    grid-template-columns: 1fr 1fr;
  }
  .ver-modal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  /* Панель лида — справочная, а не рабочая область: широкая колонка
     съедает место у переписки. */
  .chat-main {
    --lead-panel-width: min(360px, 92vw);
    overflow-x: hidden;
  }
  .lead-info-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: var(--lead-panel-width, min(360px, 92vw));
    height: 100%;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 12px;
    transform: translateX(100%);
    
    transition: var(--crm-hover-transition);
  }
  .lead-info-panel .lead-info-grabber {
    display: none;
  }
  .lead-info-panel .lead-info-content {
    height: 100%;
  }
  .lead-info-panel.state-closed {
    transform: translateX(100%);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
  .lead-info-panel.state-half {
    transform: translateX(0%);
  }
  .lead-info-panel.state-full {
    transform: translateX(0%);
  }

  .chat-main {
    transition: var(--crm-hover-transition);
  }

  .chat-main:has(.lead-info-panel.state-half),
  .chat-main:has(.lead-info-panel.state-full) {
    padding-right: var(--lead-panel-width, min(360px, 92vw));
  }

  .chat-main.lead-info-open {
    padding-right: var(--lead-panel-width, min(360px, 92vw));
  }
}

.chat-source-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 15;
  overflow-x: visible;
  overflow-y: visible;
  overscroll-behavior-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

  -webkit-mask-image: none;
  mask-image: none;
}



.chat-source-tabs.is-empty {
  display: none;
}

.chat-source-tabs {
  position: sticky;
  top: 0;
}
.chat-source-tabs::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 16px;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(248, 249, 250, 0.65),
    rgba(248, 249, 250, 0)
  );
}
.chat-source-tabs-label {
  font-size: 12px;
  color: #6b7280;
  margin-right: 6px;
  white-space: nowrap;
}
.chat-source-tabs::-webkit-scrollbar {
  height: 6px;
}
.chat-source-tabs::-webkit-scrollbar-thumb {
  background: #5b21b6;
  border-radius: 8px;
}
.chat-source-tabs .tab-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #374151;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--crm-hover-transition);
  display: inline-flex;
  align-items: center;
}
.chat-source-tabs .tab-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px) scale(1.02);
}
.chat-source-tabs .tab-btn:active {
  transform: translateY(1px);
}
.chat-source-tabs .tab-btn.active {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #4c1d95;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.25);
}
.chat-source-tabs .tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

.chat-source-tabs .tab-btn .tab-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--green-btn-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  vertical-align: middle;
}

.chat-source-tabs .tab-btn .tab-unread.is-zero {
  display: none;
}

.unread-count {
  display: inline-grid;
  place-items: center;
  line-height: 20px;
}
@media (max-width: 640px) {
  .chat-source-tabs {
    padding: 13px 10px;
    gap: 6px;

    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .chat-source-tabs .tab-btn {
    flex: 0 0 auto;
  }
  .chat-source-tabs .tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
}

.chat-layout,
.chat-layout * {
  scrollbar-width: thin;
  scrollbar-color: #5b21b6 transparent;
}
.chat-layout {
  -webkit-text-size-adjust: 100%;
}
.chat-layout::-webkit-scrollbar,
.chat-layout *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.chat-layout::-webkit-scrollbar-thumb,
.chat-layout *::-webkit-scrollbar-thumb {
  background-color: #5b21b6;
  border-radius: 8px;
  background-clip: padding-box;
  border: 2px solid transparent;
}
.chat-layout::-webkit-scrollbar-track,
.chat-layout *::-webkit-scrollbar-track {
  background: transparent;
}

.chat-source-tabs {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.chat-source-tabs::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.automation-runs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #eef2ff;
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}
.automation-runs-bar[hidden] {
  display: none !important;
}
.automation-run-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  font-size: 12px;
  color: #111827;
  max-width: 100%;
  cursor: default;
  user-select: none;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
}
.automation-run-pill:hover {
  border-color: #d1d5db;
  box-shadow: 0 10px 20px rgba(17, 24, 39, 0.06);
}
.automation-run-pill__name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.automation-run-pill__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.automation-run-pill__status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  box-shadow: 0 0 0 2px rgba(156, 163, 175, 0.15);
}
.automation-run-pill--waiting .automation-run-pill__status {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.automation-run-pill--waiting .automation-run-pill__status::before {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}
.automation-run-pill--running .automation-run-pill__status {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.automation-run-pill--running .automation-run-pill__status::before {
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.14);
  animation: crmPulseDot 1.2s ease-in-out infinite;
}
@keyframes crmPulseDot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: 0.78; }
  100% { transform: scale(1); opacity: 1; }
}
.automation-run-pill__stop {
  margin-left: auto;
  appearance: none;
  background-color: var(--red-btn-bg);
  color: var(--red-btn-color);
  border: 1px solid var(--red-btn-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--crm-hover-transition);
  box-shadow: none;
}
.automation-run-pill__stop:hover {
  background-color: var(--red-btn-hover-bg);
  border-color: var(--red-btn-hover-border);
  transform: translateY(-1px);
}
.automation-run-pill__stop:active {
  transform: translateY(0px) scale(0.99);
}
.automation-run-pill__stop:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}
.automation-run-pill__stop:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .chat-header {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .lead-info-container {
    width: 100%;
  }
  .lead-main-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .lead-main-info-right {
    align-self: stretch;
    display: flex;
    gap: 8px;
  }
}

.chat-source-tabs .tab-btn::before,
.chat-source-tabs .tab-btn::after {
  content: none !important;
}

.message-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: #a0aec0;
}

.message-footer,
.message-item .message-footer {
  align-items: center;
}
.message-footer {
  line-height: 1;
}
.message-status {
  display: flex;
  align-items: center;
  line-height: 0;
}
.message-status svg {
  display: block;
}
.message-time {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.message-status {
  display: flex;
  align-items: center;
  gap: 5px;
}

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.message-status .delivered {
  color: #38a169;

  font-size: 14px;
}

.message-status .blocked {
  color: #e53e3e;

  font-size: 14px;
  position: relative;
  cursor: pointer;
}

.actions-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 15px;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  color: #4b5563;
}

.filter-arrow {
  transition: var(--crm-hover-transition);
  margin-left: 8px;
}

.actions-header.active .filter-arrow {
  transform: rotate(180deg);
}

.filters-content {
  max-height: 0;
  overflow: hidden;
  transition: var(--crm-hover-transition);
  background: #f8fafc;
}

.filters-content.active {
  max-height: 500px;
  border-bottom: none;

  overflow: hidden;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-content.active {
  animation: fadeIn 0.3s ease forwards;
}

.filters-content.active
  :is(.filter-group:last-child, .filter-group:last-of-type) {
  margin-bottom: 30px;
}

.chat-filters {
  padding: 12px;
  background: #f8fafc;
  border-bottom: none;
}

.filter-group {
  margin-bottom: 10px;
}

.filter-group label {
  display: flex;
  margin-bottom: 5px;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
}

#filters-tab .sidebar-msg-search-wrap {
  position: relative;
}

#filters-tab .sidebar-msg-search-field {
  position: relative;
}

#filters-tab .sidebar-global-msg-search-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 29px;
  min-height: 29px;
  box-sizing: border-box;
  padding: 6px 34px 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#filters-tab .sidebar-global-msg-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

#filters-tab .sidebar-global-msg-search-input::placeholder {
  color: #1f2937;
  opacity: 1;
}

#filters-tab .sidebar-msg-search-field.crm-clearable .sidebar-global-msg-search-input[data-clearable="1"] {
  padding-right: 34px !important;
}

#filters-tab .sidebar-global-msg-search-input:focus {
  border-color: rgba(91, 33, 182, 0.45);
  box-shadow: 0 0 0 2px rgba(91, 33, 182, 0.12);
}

#filters-tab .sidebar-msg-search-wrap.is-loading .sidebar-global-msg-search-input {
  padding-right: 36px;
}

#filters-tab .sidebar-msg-search-wrap.is-loading .sidebar-msg-search-field::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  margin-top: -7px;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(91, 33, 182, 0.25);
  border-top-color: rgba(91, 33, 182, 0.85);
  border-radius: 50%;
  animation: crmSidebarMsgSearchSpin 0.65s linear infinite;
  pointer-events: none;
}

@keyframes crmSidebarMsgSearchSpin {
  to {
    transform: rotate(360deg);
  }
}

html.dark-theme #filters-tab .sidebar-global-msg-search-input {
  background: var(--bg-soft-2, #1e293b);
  border-color: var(--border, #334155);
  color: var(--text-main, #f1f5f9);
}

html.dark-theme #filters-tab .sidebar-global-msg-search-input::placeholder {
  color: var(--text-main, #f1f5f9);
}

html.dark-theme #filters-tab .sidebar-global-msg-search-input:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
}

html.dark-theme #filters-tab .sidebar-msg-search-wrap.is-loading .sidebar-msg-search-field::after {
  border-color: rgba(167, 139, 250, 0.35);
  border-top-color: rgba(167, 139, 250, 0.95);
}

.crm-tags-filter.crm-dropdown.chat-filter-dd {
  width: 100%;
  min-width: 0;
  display: block;
}
.crm-tags-filter .crm-dd-btn.tags-filter-btn {
  width: 100%;
}
.crm-tags-filter .tags-filter-menu {
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow: hidden;
  padding: 6px;
}
.crm-tags-filter .tags-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.crm-tags-filter .tags-filter-actions {
  display: flex;
  gap: 6px;
  padding: 6px 6px 4px;
  flex-wrap: wrap;
}
.crm-tags-filter .tags-filter-actions .action-btn {
  flex: 1 1 auto;
  font-size: 12px;
  padding: 6px 10px;
}
.crm-tags-filter .crm-dd-option .checkmark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  transition: var(--crm-hover-transition);
}
.crm-tags-filter .crm-dd-option.selected .checkmark {
  background: #5b21b6 !important;
  border-color: #5b21b6 !important;
  color: #fff;
}
.crm-tags-filter .crm-dd-option .checkmark span {
  display: none !important;
}
.crm-tags-filter .crm-dd-option .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.crm-tags-filter .crm-dd-option.selected .checkmark::after {
  display: block;
}
.crm-tags-filter .crm-dd-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.crm-tags-filter .crm-dd-option:hover {
  background: rgba(15, 23, 42, 0.04);
}
.crm-tags-filter .crm-dd-option.disabled {
  cursor: default;
}
.crm-tags-filter .crm-dd-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.crm-tags-filter .crm-dd-option .label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}
.crm-tags-filter .crm-dd-search.tags-search {
  width: calc(100% - 12px);
  margin: 4px 6px 8px;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}


.crm-dd-menu.tags-filter-menu {
  display: flex;
  flex-direction: column;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  border-radius: 12px;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.crm-dd-menu.tags-filter-menu .crm-dd-options,
.crm-dd-menu.tags-filter-menu .crm-dd-options.tags-options,
.crm-dd-menu.tags-filter-menu .tags-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}
.crm-dd-menu.tags-filter-menu .crm-clearable,
.crm-dd-menu.tags-filter-menu .tags-filter-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-white, #fff);
}
.crm-dd-menu.tags-filter-menu .tags-filter-actions {
  top: 52px;
  padding-top: 6px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}


.crm-dd-menu.tags-filter-menu .crm-clearable,
.crm-dd-menu.tags-filter-menu .tags-filter-actions {
  position: static;
  top: auto;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  border-bottom: 0;
  box-shadow: none;
}
.crm-dd-menu.tags-filter-menu .tags-filter-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  padding: 8px 0 8px;
  flex-wrap: nowrap;
}
.crm-dd-menu.tags-filter-menu .tags-filter-actions .action-btn {
  flex: 1 1 0;
  min-width: 0;
  font-size: 12px;
  padding: 6px 10px;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
  color: var(--primary);
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected:hover {
  background: #ede9fe;
  color: #4c1d95;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option .checkmark,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  min-width: 14px;
  min-height: 14px;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  transition: var(--crm-hover-transition);
}
.crm-dd-menu.tags-filter-menu .crm-dd-option .checkmark span,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark span {
  display: none !important;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.selected .checkmark,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected .checkmark {
  background: #5b21b6 !important;
  border-color: #5b21b6 !important;
  color: #fff;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option .checkmark::after,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.selected .checkmark::after,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected .checkmark::after {
  display: block;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option .label,
.crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}
.crm-dd-menu.tags-filter-menu .crm-clearable {
  display: block;
  width: 100%;  
  box-sizing: border-box;
  position: relative;
}
.crm-dd-menu.tags-filter-menu .crm-clearable .crm-dd-search.tags-search,
.crm-dd-menu.tags-filter-menu .crm-dd-search.tags-search {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.crm-dd-menu.tags-filter-menu .crm-dd-option.disabled {
  cursor: default;
}
.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt:hover {
  background: rgba(148, 163, 184, 0.12);
  transform: none;
  color: #e2e8f0;
}
.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected:hover {
  background: rgba(91, 33, 182, 0.25);
  color: #e9d5ff;
}
.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-option .checkmark,
.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark {
  border-color: #64748b;
}


.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu {
  display: flex;
  flex-direction: column;
  max-height: 280px;
  overflow: hidden;
  padding: 6px;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-options {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.crm-dropdown.chat-filter-dd .tags-filter-actions {
  display: flex;
  gap: 6px;
  padding: 6px 6px 4px;
  flex-wrap: wrap;
}
.crm-dropdown.chat-filter-dd .tags-filter-actions .action-btn {
  flex: 1 1 auto;
  font-size: 12px;
  padding: 6px 10px;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt:hover {
  background: rgba(15, 23, 42, 0.04);
  transform: none;
  color: #111827;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected:hover {
  background: #ede9fe;
  color: #4c1d95;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  transition: var(--crm-hover-transition);
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected .checkmark {
  background: #5b21b6 !important;
  border-color: #5b21b6 !important;
  color: #fff;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark::after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected .checkmark::after {
  display: block;
}
.crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .label {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}

.filter-reset {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 15px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 10px;
}

.messanger.tab-buttons {
  display: flex;
  gap: 8px;
  padding: 6px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.messanger.tab-btn {
  border: none;
  background: #ffffff;
  color: #374151;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: var(--crm-hover-transition);
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.messanger.tab-btn:hover:not(.active) {
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px) scale(1.02);
}

.messanger.tab-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.messanger.tab-btn.active {
  background: linear-gradient(90deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

.messanger.tab-btn.active:hover {
  filter: brightness(0.98);
}

.messanger.tab-content {
  display: none;
  padding: 12px;
}

.messanger.tab-content.active {
  display: block;
}

.messanger.pushes-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

.macros-tabs,
.comments-tabs {
  display: flex;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
  width: 100%;
}
.macros-tab-btn,
.comments-tab {
  appearance: none;
  border: none;
  background: #ffffff;
  color: #374151;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  transition: var(--crm-hover-transition);
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  height: 100%;
}
.macros-tab-btn:hover:not(.active),
.comments-tab:hover:not(.active) {
  background-color: rgba(91, 33, 182, 0.2);
  color: var(--primary);
}
.macros-tab-btn:focus-visible,
.comments-tab:focus-visible {
  outline: none;
}

.macros-tab-btn.active:hover,
.comments-tab.active:hover {
  filter: brightness(0.98);
}

@media (max-width: 640px) {
  .macros-tab-btn {
    padding: 7px 10px;
    font-size: 12px;
  }
}



#manager-settings-tab .translation-settings__label,
#filters-tab .filter-group__label {
  font-size: 13px;
  color: #4a5568;
  margin-bottom: 6px;
  display: block;
}

#manager-settings-tab .translation-settings__select,
#filters-tab .filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background-color: #f8fafc;
  background-image: url('data:image/svg+xml;utf8,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="%23666" stroke-width="2" stroke-linecap="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 12px 8px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  font-size: 14px;
  color: #2d3748;
  transition: var(--crm-hover-transition);
}

#manager-settings-tab .setting-context {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #edf2f7;
}

#manager-settings-tab .context-badge {
  display: inline-block;
  padding: 4px 8px;
  background-color: #f8fafc;
  border-radius: 6px;
  font-size: 12px;
  color: #4a5568;
  border: 1px solid #e2e8f0;
}

#manager-settings-tab .translation-settings__select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #edf2f7;
}

.filter-select[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

#pushes-tab .empty-state {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  margin-top: 20px;
  margin-bottom: 20px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.push-groups-list {
  display: flex;
  margin-top: 13px;
  flex-direction: column;
  gap: 5px;
  min-height: 200px;
}

.push-group-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.push-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.push-group-progress {
  margin: 10px 0;
}

.progress-stats {
  font-size: 0.8em;
  margin-top: 5px;
}

.push-group-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.8em;
  color: #666;
}

.badge {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8em;
}

.badge-completed {
  background-color: var(--green-btn-color);
  color: white;
}

.badge-in_progress {
  background-color: var(--info-btn-color);
  color: white;
}

.badge-not_started {
  background-color: #6c757d;
  color: white;
}

.badge-partially_completed {
  background-color: #ffc107;
  color: #212529;
}

.badge-empty {
  background-color: #f8f9fa;
  color: #212529;
  border: 1px solid #dee2e6;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
}

.custom-multiselect {
  position: relative;
  width: 100%;
}

.select-box {
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 8px 12px;
  background: white;
  cursor: pointer;
}

.selected-text {
  color: #4a5568;
}

.checkboxes-container {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 5px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pipeline-group {
  margin-bottom: 8px;
}

.pipeline-label {
  display: block;
  font-weight: 600;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
}

.stage-label {
  display: block;
  padding: 3px 0;
  font-weight: 400;
}

.condition-value-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
}

.form-section {
  padding: 16px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}


.filter-conditions-container {
  margin-bottom: 15px;
}

.condition-type-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.form-group.condition-param {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
}

.form-group.condition-param label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  color: #4a5568;
  font-weight: 500;
}

.form-input,
.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  background: white;
}

.chat-header {
  background: #f8f9fa;
  border-bottom: 1px solid #eaeaea;
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

@media (min-width: 769px) {
  .chat-header-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 12px;
  }
  .chat-header-top-left {
    min-width: 0;
  }
  .chat-header-top-right {
    justify-self: end;
  }

  .chat-header-top .lead-status-badge .badge {
    white-space: nowrap;
  }

  .chat-header-top .lead-name {
    display: flex;
    gap: 6px;
    min-width: 0;
  }
  .chat-header-top .lead-first-name,
  .chat-header-top .lead-username {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.chat-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.chat-header-top-left {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
}
.chat-header-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.meta-window-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.09);
  color: #16803c;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}

.meta-window-pill__icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.meta-window-pill.is-warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.11);
  color: #a86105;
}

.meta-window-pill.is-closed {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.11);
  color: #64748b;
}

.chat-input.is-meta-window-closed .input-with-icon {
  opacity: 0.7;
}

.chat-input.is-meta-window-closed .attach-btn-inside.is-disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.chat-input.is-meta-window-closed #message-input {
  cursor: not-allowed;
}

html.dark-theme .meta-window-pill {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

html.dark-theme .meta-window-pill.is-warning {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(245, 158, 11, 0.13);
  color: #fcd34d;
}

html.dark-theme .meta-window-pill.is-closed {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(148, 163, 184, 0.09);
  color: #94a3b8;
}

@media (max-width: 720px) {
  .meta-window-pill {
    max-width: 154px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.chat-header-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.lead-info-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-main-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lead-main-info-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}


@media (max-width: 436px) {
  .chat-header #lead-avatar,
  .chat-header .crm-avatar--lead {
    display: none !important;
  }
  .chat-header .lead-main-info-left {
    gap: 0;
  }
}

.lead-main-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lead-name {
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
  font-size: 18px;
  font-weight: 500;
}

.lead-name .lead-mobile-status-pill {
  display: none;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  user-select: none;
  white-space: nowrap;
  flex: 0 0 auto;
}
.lead-name .lead-mobile-status-pill.is-active {
  color: #166534;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.32);
}
.lead-name .lead-mobile-status-pill.is-inactive {
  color: #991b1b;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.32);
}

html.dark-theme .lead-name .lead-mobile-status-pill.is-active {
  color: #86efac;
}

html.dark-theme .lead-name .lead-mobile-status-pill.is-inactive {
  color: #fca5a5;
}

.lead-first-name {
  font-size: 16px;
  font-weight: 600;
}

.lead-username {
  color: var(--text-light);
  font-size: 14px;
}

.lead-secondary-info {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: #495057;
}

.lead-secondary-info > div {
  display: flex;
  gap: 5px;
}

.lead-secondary-info span:first-child {
  font-weight: 500;
}

.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}





.lead-created {
  color: var(--text-light);
  font-size: 10px;
}

.selected-pipeline-stage {
  font-size: 10px;
}

.dropdown-menu .pipeline-name {
  font-size: 14px;
  color: var(--text);
}


.pipeline-stage-change-wrapper {
  position: relative;
  width: 0;
  height: 0;
  min-width: 0;
  margin: 0;
}

.pipeline-dropdown-menu,
.lead-dropdown-menu {
  width: 100%;
  max-width: min(420px, calc(100vw - 32px));

  max-height: 60vh;

  overflow: hidden;
  flex-direction: column;
  padding: 8px;
  border-radius: 8px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
}

.dropdown-menu.show.pipeline-dropdown-menu,
.dropdown-menu.show.lead-dropdown-menu {
  display: flex;
}


.pipeline-dropdown-menu,
.pipeline-dropdown-menu .pipelines-container,
.pipeline-dropdown-menu .pipeline-item,
.pipeline-dropdown-menu .stages-container,
.pipeline-dropdown-menu .stage-item,
.lead-dropdown-menu,
.lead-dropdown-menu .lead-items-container,
.lead-dropdown-menu .lead-item,
.lead-dropdown-menu .lead-item-header {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.lead-dropdown-menu .lead-item:not(:last-child) {
  margin-bottom: 5px;
}
.lead-dropdown-menu .lead-item:last-child {
  margin-bottom: 0;
}

.dropdown-search {
  margin-bottom: 8px;
}

.dropdown-search input {
  border-radius: 6px;
  font-size: 13px;
  height: 32px;
}

.pipeline-item {
  margin-bottom: 4px;
}

.pipeline-dropdown-menu .pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 0;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  transition: var(--crm-hover-transition);
}

.pipeline-dropdown-menu .pipeline-header:hover {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #5b21b680;
}

.toggle-stages-btn {
  background: none;
  border: none;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--crm-hover-transition);
  
  color: #374151;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.toggle-stages-btn svg,
.toggle-stages-btn svg path {
  stroke: currentColor;
}

.toggle-stages-btn.active {
  transform: rotate(180deg);
}

.pipeline-header .form-check-input,
.lead-item-header .form-check-input,
.select-all-btn .form-check-input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.filter-group .form-check {
  margin-left: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-group .form-check .form-check-input {
  margin-top: 0;
  flex: 0 0 auto;
}
.filter-group .form-check .form-check-label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.pipeline-header .pipeline-name,
.select-all-btn span {
  font-size: 13px;
  line-height: 1.2;
}

.pipeline-dropdown-menu .lead-id-item .pipeline-header,
.lead-dropdown-menu .lead-id-item .lead-item-header {
  display: flex;
  width: 100%;
  text-align: left;
  background: transparent;
  padding: 8px;
  color: var(--bs-dropdown-link-color, #212529);
  cursor: pointer;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  align-items: center;
  transition: var(--crm-hover-transition);
}
.pipeline-dropdown-menu .lead-id-item .pipeline-header:hover,
.lead-dropdown-menu .lead-id-item .lead-item-header:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #5b21b680;
}
.pipeline-dropdown-menu .lead-id-item.is-selected .pipeline-header,
.lead-dropdown-menu .lead-id-item.is-selected .lead-item-header {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #5b21b680;
}

.pipeline-dropdown-menu .pipeline-item.is-selected .pipeline-header {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #5b21b680;
}
.pipeline-dropdown-menu .lead-id-name,
.lead-dropdown-menu .lead-id-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.pipeline-dropdown-menu .lead-id-main,
.lead-dropdown-menu .lead-id-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.pipeline-dropdown-menu .lead-id-title,
.lead-dropdown-menu .lead-id-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pipeline-dropdown-menu .lead-id-meta,
.lead-dropdown-menu .lead-id-meta {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 7px;
  flex: 0 0 auto;
  margin-left: auto;
}
.pipeline-dropdown-menu .lead-id-sub,
.lead-dropdown-menu .lead-id-sub {
  font-size: 12px;
  line-height: 1.2;
  color: #64748b;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-all-btn.btn {
  font-size: 13px;
  line-height: 1.2;
}

.pipeline-dropdown-menu .stages-container {
  display: none;
  margin-left: 5px;
  border-left: 2px solid #dee2e6;
  margin-top: 0;
  margin-bottom: 0;
  transition: var(--crm-hover-transition);
}

.pipeline-dropdown-menu .pipeline-header,
.lead-dropdown-menu .lead-item-header {
  gap: 8px;
}

.pipeline-dropdown-menu .pipeline-header > .d-flex,
.lead-dropdown-menu .lead-item-header > .d-flex {
  flex: 1 1 auto;
  min-width: 0;
}
.pipeline-dropdown-menu .pipeline-name,
.pipeline-dropdown-menu .stage-content {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-dropdown-menu .pipelines-container,
.lead-dropdown-menu .lead-items-container {
  overflow-y: auto;

  max-height: calc(60vh - 90px);

  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pipeline-dropdown-menu .pipelines-container::-webkit-scrollbar,
.lead-dropdown-menu .lead-items-container::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.pipeline-dropdown-menu .stage-item {
  margin-right: 10px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: var(--crm-hover-transition);
}

.pipeline-dropdown-menu .stage-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.pipeline-dropdown-menu .stage-item.is-selected {
  color: var(--primary);
  background: var(--primary-light);
}
 
.stage-item.active {
  background-color: #e9f7ef;
  font-weight: 500;
}

.stage-content {
  display: flex;
  align-items: center;
}

.pipeline-dropdown-menu .stage-content .stage-checkbox {
  margin-top: 0 !important;
  flex: 0 0 auto;
}

.pipeline-dropdown-menu .stage-content .form-check-label {
  margin: 0;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
}

.stage-item.active .stage-content {
  color: #5b21b6;
}

.pipeline-header.current {
  background-color: #f8f5ff;
  border-left: 3px solid #5b21b6 !important;
}

.transparent-dropdown-menu .list-group label.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.transparent-dropdown-menu .list-group label.dropdown-item:hover {
  background-color: #f8fafc;
}

.transparent-dropdown-menu .list-group label.dropdown-item.is-selected {
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #5b21b680;
}

.transparent-dropdown-menu .list-group label.dropdown-item:active {
  background-color: #f1f5f9;
  color: inherit;
}

.transparent-dropdown-menu .list-group label.dropdown-item:focus-within {
  outline: none !important;
  border: 1px solid #5b21b680;
}

.transparent-dropdown-menu .list-group label.dropdown-item {
  -webkit-tap-highlight-color: transparent;
}

.transparent-dropdown-menu .list-group label.dropdown-item .form-check-input {
  margin: 0;
}

.transparent-dropdown .dropdown-toggle {
  transition: var(--crm-hover-transition);
}
.transparent-dropdown .dropdown-toggle:hover,
.transparent-dropdown .dropdown-toggle:focus-visible {
  background: #f8fafc;
  border-color: #e5e7eb;
}

.transparent-dropdown .dropdown-toggle[disabled],
.transparent-dropdown .dropdown-toggle.disabled,
.transparent-dropdown .dropdown-toggle[aria-disabled="true"] {
  pointer-events: none;
}
.transparent-dropdown .dropdown-toggle[disabled]:hover,
.transparent-dropdown .dropdown-toggle.disabled:hover,
.transparent-dropdown .dropdown-toggle[aria-disabled="true"]:hover,
.transparent-dropdown .dropdown-toggle[disabled]:focus,
.transparent-dropdown .dropdown-toggle.disabled:focus,
.transparent-dropdown .dropdown-toggle[aria-disabled="true"]:focus,
.transparent-dropdown .dropdown-toggle[disabled]:focus-visible,
.transparent-dropdown .dropdown-toggle.disabled:focus-visible,
.transparent-dropdown .dropdown-toggle[aria-disabled="true"]:focus-visible {
  background: inherit;
  border-color: inherit;
  box-shadow: none;
}

.form-check-input.pipeline-checkbox:checked {
  background-color: #5b21b6 !important;
  border-color: #5b21b6 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 10.5l3 3 7-7' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}
.form-check-input.pipeline-checkbox:checked:focus,
.form-check-input.pipeline-checkbox:checked:focus-visible {
  background-color: #5b21b6 !important;
  border-color: #5b21b6 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 10.5l3 3 7-7' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

.form-check-input.pipeline-checkbox:focus {
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.18) !important;
}

.stage-item.current-stage {
  background-color: #f8f5ff;
  color: #5b21b6;
  font-weight: 500;
  border-radius: 0;
}

@media (prefers-reduced-motion: reduce) {
  .action-btn,
  .chat-source-tabs .tab-btn,
  .messanger.tab-btn,
  .crm-dropdown .crm-dd-btn,
  .select-all-btn.btn,
  .transparent-dropdown .dropdown-toggle {
    transition: var(--crm-hover-transition);
    transform: none !important;
    box-shadow: none !important;
  }
}

.highlight {
  background-color: #ffeb3b;
  color: #000;
  padding: 0 2px;
  border-radius: 2px;
}

.push-group-header .h4 {
  font-size: 14px;
  font-weight: 600;
}

.chat-search-container {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  z-index: 12;
  padding: 10px;
  margin: 0;
  background: #e7eef7;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}

.chat-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-search-row .input-with-icon {
  flex: 1 1 auto;
  min-width: 0;
}

.chat-quick-action-btn {
  flex: 0 0 auto;
}


.chat-search-row .info-btn.chat-quick-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.chat-search-row .info-btn.chat-quick-action-btn svg {
  width: 18px;
  height: 18px;
}


.chat-list__footer .info-btn.chat-quick-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}


:where(#baseModal, #pushes-tab) #createPushForm .message-pin-check {
  display: flex;
  align-items: center;
  gap: 5px;
}
:where(#baseModal, #pushes-tab) #createPushForm .message-pin-check .form-check-label {
  margin-bottom: 0 !important;
}
:where(#baseModal, #pushes-tab) #createPushForm .message-pin-check .form-check-input {
  margin-top: 0;
}


:where(#baseModal, #pushes-tab) #createPushForm .push-button-row {
  position: relative;
}
:where(#baseModal, #pushes-tab) #createPushForm .push-button-row__grid {
  align-items: start;
}
:where(#baseModal, #pushes-tab) #createPushForm .push-button-row__grid > .mb-2.d-flex.align-items-end.justify-content-end {
  align-items: flex-start !important;
  margin-bottom: 0 !important;
}
:where(#baseModal, #pushes-tab) #createPushForm .push-button-row .push-btn-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
}

.info-btn.is-active {
  background: var(--primary);
  border-color: var(--primary-dark);
  color: #ffffff;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.15),
    0 0 0 3px rgba(91, 33, 182, 0.2);
}
.info-btn.is-active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
}

.chat-search-container .input-with-icon {
  position: relative;
}


.crm-clearable {
  position: relative;
}


.crm-input-clear-btn {
  position: absolute;
  right: 4px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #64748b;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  font-size: 20px;
  padding: 0;
  transition: var(--crm-hover-transition);
  -webkit-appearance: none;
  appearance: none;
}
.crm-clearable.has-value .crm-input-clear-btn {
  display: inline-flex;
}
.crm-input-clear-btn:hover {
  background: #f1f5f9;
  color: #e53e3e;
}
.crm-input-clear-btn:active {
  transform: scale(0.98);
}
.crm-clearable [data-clearable="1"] {
  padding-right: 40px !important;
}

#chat-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 32px;
  border-radius: 10px;
  font-size: 14px;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
}

.chat-actions-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 67%);
  z-index: 2490;
}

.filters-content.popover-mode {
  position: fixed;
  z-index: 2500;
  max-height: min(80vh, 720px) !important;
  overflow: auto !important;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
  transform: translateY(-4px);
  opacity: 0;
  transition:
    opacity 140ms ease,
    transform 180ms ease;
  will-change: transform, opacity;
}
.filters-content.popover-mode.popover-open {
  opacity: 1;
  transform: translateY(0);
}


.chat-list__footer {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 10px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  margin: 0;
  background: #e7eef7;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow:
    0 10px 26px rgba(15, 23, 42, 0.14),
    0 0 0 1px rgba(15, 23, 42, 0.04);
}
.chat-list__footer-count {
  padding: 6px 6px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list__footer-settings-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #334155;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.chat-list__footer-settings-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: rgba(91, 33, 182, 0.25);
}
.chat-list__footer-settings-btn:active {
  transform: translateY(1px);
}
.chat-list__footer-settings-btn.is-active {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #4c1d95;
  box-shadow: 0 0 0 3px rgba(196, 181, 253, 0.25);
}

.media-type-selector {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  border: 1px solid var(--border);
}

.media-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: var(--crm-hover-transition);
}

.media-type-option:hover {
  background: rgba(255, 255, 255, 0.2);
}

.media-type-option input[type="radio"] {
  margin: 0;
}

.message-media {
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
  touch-action: pan-y;
}

.message-photo {
  width: min(240px, 100%);
  border-radius: 8px;
  display: block;
  height: auto;
  max-width: 100%;
}

.message-sticker {
  width: min(160px, 100%);
  background: transparent;
}

.message-sticker-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 72px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-light, rgba(255, 255, 255, 0.06));
  font-size: 42px;
  line-height: 1;
}

.message-video {
  width: min(240px, 100%);
  border-radius: 8px;
  display: block;
  background: #000;
  max-width: 100%;
}

.crm-dt-picker {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.crm-dt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}
@media (max-width: 520px) {
  .crm-dt-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@supports (-webkit-touch-callout: none) {
  .crm-dt-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .crm-dt-grid > .crm-dt-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .crm-dt-input[type="date"],
  .crm-dt-input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 100%;
    max-inline-size: 100%;
    min-inline-size: 0;
    min-width: 0;
  }
}

.crm-dt-grid > .crm-dt-col {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.crm-dt-input[type="date"],
.crm-dt-input[type="time"] {
  display: block;
  width: 100%;
  max-width: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  min-width: 0;
  box-sizing: border-box;
}

.message-audio {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
  width: calc(100% - 24px);
  max-width: calc(100% - 24px);
  box-sizing: border-box;
  touch-action: pan-y;
}

.audio-player {
  width: 100%;
  max-width: 100%;
  display: block;
}

.message-document {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  max-width: 280px;
}

.document-icon {
  width: 40px;
  height: 40px;
  background: #4a5568;
  color: white;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-size {
  font-size: 11px;
  opacity: 0.7;
  margin: 2px 0;
}

.document-download {
  color: #4299e1;
  font-size: 12px;
  text-decoration: none;
  display: inline-block;
  margin-top: 4px;
}

.document-download:hover {
  text-decoration: underline;
}

.alert-message {
  padding: 12px 16px;
  margin: 8px 0;
  border-radius: 4px;

  border-left: 5px solid #d35400;

  background-color: rgba(255, 165, 0, 0.15);

  color: #d35400;
  font-size: 14px;
  line-height: 1.4;

  animation: fadeIn 0.3s ease-in-out;
}

.alert-message p {
  margin: 6px 0;
}

.alert-message strong {
  font-weight: 600;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.media-modal {
  display: none;
  position: fixed;
  z-index: var(--z-modal, 1000);
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.2s ease-out;

  overflow: hidden;
  cursor: zoom-out;
}

.media-modal-content {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  box-sizing: border-box;

  overflow: auto;
}

.modal-media {
  display: block;

  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  background: #000;
}

.media-modal-close {
  position: absolute;

  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: var(--crm-hover-transition);
  line-height: 1;
}

.media-modal-close:hover {
  color: #bbb;
}

body.media-modal-open {
  overflow: hidden;
}

.media-modal:has(.media-modal-toolbar) .media-modal-close {
  display: none;
}

.media-modal-toolbar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: calc(var(--z-modal, 1000) + 2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 10px 36px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  pointer-events: auto;
  cursor: default;
}

.media-modal-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    color 0.15s ease;
  flex: 0 0 auto;
  box-shadow: none;
  line-height: 1;
}

.media-modal-btn:hover,
.media-modal-btn:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  transform: translateY(-1px);
  outline: none;
}

.media-modal-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.12);
}

.media-modal-btn svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.media-modal-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: rgba(255, 255, 255, 0.18);
  flex: 0 0 auto;
}

.media-modal-btn--close {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

.media-modal-btn--close:hover,
.media-modal-btn--close:focus-visible {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(248, 113, 113, 0.42);
  color: #fff;
}

.media-modal-toolbar[data-mode="video"] .media-modal-btn:not(.media-modal-btn--close),
.media-modal-toolbar[data-mode="video"] .media-modal-sep {
  display: none;
}

@media (max-width: 768px) {
  .media-modal-toolbar {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
    flex-wrap: wrap;
    justify-content: center;
  }

  .media-modal-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-media {
  animation: zoomIn 0.25s ease-out;
}

@keyframes zoomIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}


.date-separator {
  text-align: center;
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  position: relative;
}
.date-separator:before,
.date-separator:after {
  content: "";
  position: absolute;
  top: 50%;
  width: 35%;
  height: 1px;
  background: linear-gradient(to right, transparent, #d1d5db);
}
.date-separator:before {
  left: 0;
}
.date-separator:after {
  right: 0;
  transform: scaleX(-1);
}

.system-message {
  display: flex;
  justify-content: flex-start;
  margin: 8px 0;
  padding: 0;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  max-width: 100%;
  position: relative;
  margin-left: 10px;
  font-family: inherit;
}
.system-message .system-message-inner {
  background: linear-gradient(145deg, #f8fafc, #f1f5f9);
  color: #475569;
  font-size: 10px;
  line-height: 1.4;
  padding: 20px 20px 10px 20px;
  border-radius: 14px;
  max-width: 100%;
  width: auto;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 1px #e2e8f0;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  text-align: center;
  font-weight: 500;
  font-family: Manrope, sans-serif;
}
.dark-theme .system-message .system-message-inner {
  background: linear-gradient(145deg, #1e293b, #334155);
  color: #e2e8f0;
  border-color: #334155;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 0 0 1px #334155;
}
.system-message .system-message-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.system-message .system-message-meta {
  text-align: right;
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.6;
  font-weight: 400;
}

.system-message.message-incoming,
.system-message.message-outgoing {
  background: transparent;
}
.system-message .message-header,
.system-message .message-content,
.system-message .message-footer {
  display: none !important;
}
.message.new-message.system-message .system-message-inner {
  animation: none;
}

.system-message.variant-success .system-message-inner {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
  max-width: 100%;
}
.system-message.variant-info .system-message-inner {
  background: #eff6ff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}
.system-message.variant-warning .system-message-inner {
  background: #fff7ed;
  color: #92400e;
  border-color: #fed7aa;
}
.system-message.variant-warning .system-message-text a {
  color: #92400e;
  text-decoration: underline;
}
.system-message.variant-warning .copy-btn {
  border-color: rgba(146, 64, 14, 0.25);
  background: #fff7ed;
  color: #92400e;
}
.system-message.variant-warning .copy-btn:hover {
  background: #ffedd5;
}
.system-message.variant-warning .copy-btn.copied {
  color: #166534;
  background: rgba(22, 101, 52, 0.08);
  border-color: rgba(22, 101, 52, 0.35);
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.16);
}
.system-message.variant-danger .system-message-inner {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.system-message.system-message--generic {
  justify-content: center;
  margin-left: 0;
  width: 100%;
}
.system-message.system-message--generic .system-message-inner {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  max-width: min(860px, 100%);
  align-items: center;
}
.system-message.system-message--generic .system-message-meta {
  text-align: center;
  font-size: 0.675rem;
  line-height: 1.25rem;
  color: rgba(107, 114, 128, 0.85);
  opacity: 1;
  margin: 0;
  letter-spacing: 0.01em;
  order: 0;
}
.system-message.system-message--generic .system-message-text {
  text-align: center;
  font-size: 0.675rem;
  line-height: 1.25rem;
  color: #111827;
  margin: 0;
  order: 1;
}
.system-message.system-message--generic .system-message-by {
  text-align: center;
  font-size: 0.675rem;
  line-height: 1.15rem;
  color: rgba(107, 114, 128, 0.85);
  margin-top: 2px;
  margin-bottom: 0;
  order: 0;
}

.system-message.system-message--generic.system-message--channel .system-message-text,
.system-message.system-message--generic.system-message--automation .system-message-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dark-theme .system-message.system-message--generic .system-message-meta {
  color: rgba(148, 163, 184, 0.85);
}
.dark-theme .system-message.system-message--generic .system-message-text {
  color: #e5e7eb;
}

.system-message .channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(91, 33, 182, 0.08);
  color: #4c1d95;
  border: 1px solid rgba(91, 33, 182, 0.25);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.system-message.variant-success .channel-badge {
  background: rgba(16, 185, 129, 0.08);
  color: #065f46;
  border-color: rgba(16, 185, 129, 0.3);
}
.system-message.variant-warning .channel-badge {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.35);
}
.dark-theme .system-message .channel-badge {
  background: rgba(91, 33, 182, 0.18);
  color: #e9d5ff;
  border-color: rgba(91, 33, 182, 0.45);
}

.system-message .automation-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.3);
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.dark-theme .system-message .automation-badge {
  background: rgba(37, 99, 235, 0.18);
  color: #dbeafe;
  border-color: rgba(37, 99, 235, 0.45);
}

.system-message .system-message-stage-change {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.system-message .system-message-stage-change__title {
  text-wrap: balance;
  max-width: 42em;
}
.system-message .system-message-stage-change__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
  width: 100%;
}
.system-message .stage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.7rem;
  line-height: 1.35;
  word-break: break-word;
  text-align: center;
}
.system-message .stage-pill--from {
  background: rgba(225, 29, 72, 0.09);
  color: #9f1239;
  border: 1px solid rgba(225, 29, 72, 0.32);
}
.system-message .stage-pill--to {
  background: rgba(5, 150, 105, 0.09);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.32);
}
.system-message .stage-pill-arrow {
  color: rgba(107, 114, 128, 0.95);
  font-weight: 700;
  flex-shrink: 0;
}
.dark-theme .system-message .stage-pill--from {
  background: rgba(251, 113, 133, 0.12);
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.38);
}
.dark-theme .system-message .stage-pill--to {
  background: rgba(52, 211, 153, 0.12);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.38);
}
.dark-theme .system-message .stage-pill-arrow {
  color: rgba(148, 163, 184, 0.9);
}

.nowrap {
  white-space: nowrap !important;
}
.system-message .chain-pill,
.system-message .approx-usd {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.04);
  color: #6b7280;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.dark-theme .system-message .chain-pill,
.dark-theme .system-message .approx-usd {
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
  border-color: #475569;
}
.system-message .tx-link {
  color: #2563eb;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  white-space: nowrap;
  margin-right: 5px;
}
.system-message .tx-link:hover {
  text-decoration: underline;
}
.system-message .arb-order-badge {
  margin-bottom: 2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  text-align: center;
}

.system-message .chain-arrow {
  margin: 0 6px;
  opacity: 0.65;
}

.system-message .copy-btn {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #f8fafc;
  color: #374151;
  border-radius: 6px;
  padding: 2px;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--crm-hover-transition);
}
.system-message .copy-btn:hover {
  background: #f1f5f9;
}
.system-message .copy-btn:active {
  background: #e5e7eb;
}
.system-message .copy-btn .icon-clipboard {
  width: 14px;
  height: 14px;
  display: inline-block;
}
.system-message .copy-btn.copied {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.45);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.16);
}
.arb-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.action-btn.reject-btn:hover,
.action-btn.reject-btn:focus-visible {
  background-color: var(--red-btn-hover-bg);
  border-color: var(--red-btn-hover-border);
  color: var(--red-btn-color);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.action-btn.loading {
  opacity: 0.7;
  pointer-events: none;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.status-pill .status-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
}
.status-pill .status-text {
  display: inline-block;
  line-height: 14px;
}

.system-message-inner .system-message-text > .status-pill {
  display: block;
  width: max-content;
  margin: 8px auto 0;
}

.system-message-inner .system-message-text {
  white-space: normal !important;
}

.arb-order-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #1f2937;
  background: linear-gradient(145deg, #fff, #f3f4f6);
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
  margin-bottom: 10px;
}
.dark-theme .arb-order-badge {
  color: #e5e7eb;
  background: linear-gradient(145deg, #1f2937, #111827);
  border-color: #374151;
}
.arb-order-badge b {
  font-weight: 900;
  color: inherit;
}


.system-message.action-card-message {
  width: 100%;
  justify-content: flex-start;
  margin-left: 10px;
}

.system-message.action-card-message .action-card-inner {
  width: min(480px, calc(100vw - 32px));
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border-radius: 14px;
  background:
    radial-gradient(circle at top left, rgba(40, 167, 69, 0.08), transparent 34%),
    linear-gradient(145deg, #ffffff, #f8fafc);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow:
    0 12px 28px rgba(15, 23, 42, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.78) inset;
  color: #1f2937;
}

.system-message.action-card-message .action-card-body {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
}

.action-card-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin: -10px -12px 0;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.045), transparent 58%),
    rgba(248, 250, 252, 0.82);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.action-card-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.action-card-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: -0.01em;
}

.action-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(40, 167, 69, 0.12);
  box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.15) inset;
  color: #15803d;
  flex: 0 0 auto;
}

.action-card-icon__svg {
  display: block;
  width: 14px;
  height: 14px;
}

.action-card-icon--deposit {
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15) inset;
}

.action-card-icon--withdrawal {
  color: #c2410c;
  background: rgba(249, 115, 22, 0.12);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.15) inset;
}

.action-card-icon--resolved {
  color: #15803d;
  background: rgba(40, 167, 69, 0.14);
  box-shadow: 0 0 0 1px rgba(40, 167, 69, 0.18) inset;
}

.action-card-icon--rejected {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.16) inset;
}

.action-card-id-badge {
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: #334155;
  background: rgba(255, 255, 255, 0.72);
  flex: 0 0 auto;
}

.action-card-ext-id {
  display: inline-block;
  max-width: min(540px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.action-card-subtitle {
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 600;
}

.system-message-inner .system-message-text .action-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.action-card-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  align-items: start;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.72);
}

.action-card-field--link {
  grid-column: 1 / -1;
}

.action-card-field__label {
  color: #64748b;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.action-card-field__value {
  min-width: 0;
  color: #0f172a;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
  word-break: break-word;
}

.action-card-field__value b {
  font-weight: 800;
}

.action-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--info-btn-color);
  background: var(--info-btn-bg);
  border: 1px solid var(--info-btn-border);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: var(--crm-hover-transition);
}

.action-card-link:hover,
.action-card-link:focus-visible {
  color: var(--info-btn-color);
  background: var(--info-btn-hover-bg);
  border-color: var(--info-btn-hover-border);
  transform: translateY(-1px);
  text-decoration: none;
}

.action-card-link-hint {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-card-media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-card-media-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 8px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.035);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.action-card-media-preview {
  appearance: none;
  display: block;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  cursor: zoom-in;
  overflow: hidden;
}

.action-card-media-thumb {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.action-card-media-preview:hover .action-card-media-thumb {
  transform: scale(1.035);
  filter: saturate(1.05) contrast(1.03);
}

.action-card-media-caption {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
  padding: 0;
}

.action-card-media-label {
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.action-card-media-link {
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.system-message-inner .system-message-text .action-card-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 0;
}

.action-card-buttons .action-card-btn {
  width: 100%;
  min-height: 36px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.005em;
}

.action-card-buttons .action-card-btn--approve {
  box-shadow: 0 8px 18px rgba(40, 167, 69, 0.08);
}

.action-card-buttons .action-card-btn--reject {
  box-shadow: 0 8px 18px rgba(220, 53, 69, 0.08);
}

.system-message-inner .system-message-text .action-card-status {
  align-self: flex-start;
  margin: 0;
  font-size: 11px;
  padding: 6px 10px;
}

.action-card-meta {
  padding: 0 12px 8px;
  margin-top: -2px;
}

.action-card-inner--compact,
.system-message.action-card-message .action-card-inner.action-card-inner--compact {
  width: min(420px, calc(100vw - 32px));
}

.action-card-inner--compact .action-card-media-preview,
.action-card-inner--compact .action-card-media-thumb {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
}

html.dark-theme .system-message.action-card-message .action-card-inner {
  background:
    radial-gradient(circle at top left, rgba(134, 239, 172, 0.12), transparent 34%),
    linear-gradient(145deg, #111827, #1e293b);
  color: #e5e7eb;
  border-color: rgba(71, 85, 105, 0.75);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.36),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

html.dark-theme .action-card-header {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.08), transparent 62%),
    rgba(15, 23, 42, 0.62);
  border-bottom-color: rgba(71, 85, 105, 0.62);
}

html.dark-theme .action-card-title,
html.dark-theme .action-card-field__value,
html.dark-theme .action-card-media-label {
  color: #f8fafc;
}

html.dark-theme .action-card-subtitle,
html.dark-theme .action-card-field__label {
  color: #94a3b8;
}

html.dark-theme .action-card-field,
html.dark-theme .action-card-media-card {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(71, 85, 105, 0.58);
}

html.dark-theme .action-card-id-badge {
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
}

@media (max-width: 620px) {
  .system-message.action-card-message .action-card-inner {
    width: 100%;
  }

  .system-message-inner .system-message-text .action-card-grid {
    grid-template-columns: 1fr;
  }

  .action-card-field--link {
    grid-column: auto;
  }

  .system-message-inner .system-message-text .action-card-buttons {
    grid-template-columns: 1fr;
  }
}

.arb-manager-info {
  margin-top: 6px;
  font-size: 11px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(17, 24, 39, 0.02);
  border: 1px dashed #e5e7eb;
  border-radius: 8px;
  padding: 6px 8px;
  flex-direction: column;
}
.arb-manager-info .mgr-name {
  font-weight: 700;
  color: #374151;
}
.arb-manager-info .mgr-action {
  font-weight: 600;
}
.arb-manager-info .mgr-time {
  opacity: 0.85;
}
.dark-theme .arb-manager-info {
  color: #cbd5e1;
  border-color: #334155;
  background: rgba(148, 163, 184, 0.08);
}
.dark-theme .arb-manager-info .mgr-name {
  color: #e2e8f0;
}

.notif-settings {
  background: var(--panel-bg, #fff);
  border: 1px solid var(--panel-border, rgba(0, 0, 0, 0.06));
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.notif-settings .ts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.notif-settings .ts-title {
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong, #1f2937);
  max-width: 75%;
}
.notif-settings .ts-title .ts-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: var(--brand, #5b21b6);
}
.notif-settings .ts-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}

.crm-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}
.crm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.crm-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  border-radius: 999px;
  background: #e5e7eb;
  transition: var(--crm-hover-transition);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.crm-switch-slider:before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--crm-hover-transition);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.crm-switch input:checked + .crm-switch-slider {
  background: var(--brand, #5b21b6);
}
.crm-switch input:checked + .crm-switch-slider:before {
  transform: translateX(20px);
}

.crm-range {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.crm-range .range-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted, #6b7280);
  display: inline-flex;
}
#notif-volume-range {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  outline: none;
  padding: 0;
  border: none;
  vertical-align: middle;

  background: linear-gradient(
    to right,
    var(--brand, #5b21b6) 0%,
    var(--brand, #5b21b6) var(--range-fill, 0%),
    #e5e7eb var(--range-fill, 0%),
    #e5e7eb 100%
  );
}

#notif-volume-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--brand, #5b21b6) 0%,
    var(--brand, #5b21b6) var(--range-fill, 0%),
    #e5e7eb var(--range-fill, 0%),
    #e5e7eb 100%
  );
}
#notif-volume-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand, #5b21b6);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

  margin-top: -6px;
}
#notif-volume-range::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
#notif-volume-range:focus {
  outline: none;
}
#notif-volume-range:focus::-webkit-slider-thumb {
  box-shadow:
    0 0 0 4px rgba(91, 33, 182, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

#notif-volume-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
}
#notif-volume-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--brand, #5b21b6);
}
#notif-volume-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand, #5b21b6);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
#notif-volume-range:focus::-moz-range-thumb {
  box-shadow:
    0 0 0 4px rgba(91, 33, 182, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

#notif-volume-range::-ms-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
  border-color: transparent;
  color: transparent;
}
#notif-volume-range::-ms-fill-lower {
  background: var(--brand, #5b21b6);
  border-radius: 999px;
}
#notif-volume-range::-ms-fill-upper {
  background: #e5e7eb;
  border-radius: 999px;
}
#notif-volume-range::-ms-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand, #5b21b6);
  cursor: pointer;
}
#notif-volume-range:focus::-ms-thumb {
  box-shadow: 0 0 0 4px rgba(91, 33, 182, 0.18);
}
.ts-value-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand, #5b21b6);
  background: rgba(91, 33, 182, 0.08);
  border: 1px solid rgba(91, 33, 182, 0.15);
  padding: 2px 8px;
  border-radius: 999px;
}

.is-hidden {
  display: none;
}
.text-muted {
  color: var(--text-muted, #6b7280);
}
.text-xs {
  font-size: 12px;
}
.mt-8 {
  margin-top: 8px;
}
.mt-10 {
  margin-top: 10px;
}
.mt-15 {
  margin-top: 15px;
}
.label-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
.error-message {
  display: none;
  color: red;
  margin-top: 5px;
}

.arb-action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.arb-action-buttons .action-btn {
  margin: 0;
  width: 100%;
}
.verification-selector {
  position: relative;
  display: flex;
  width: 100%;
}
.verification-selector > .action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #ede9fe;
  color: #4c1d95;
  border: 1px solid #c4b5fd;
  width: 100%;
}
.verification-selector > .action-btn:hover {
  background: #e9d5ff;
}
.verification-menu {
  position: absolute;

  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  min-width: 260px;
  list-style: none;
  margin: 0;

  padding: 2px;

  display: grid !important;
  grid-auto-rows: min-content;
  gap: 0 !important;
  row-gap: 0 !important;
  column-gap: 0 !important;

  line-height: 0;
  font-size: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 50;
}
.verification-menu.is-hidden {
  display: none !important;
}
.verification-menu li {
  display: flex;
  align-items: center;

  gap: 4px;
  padding: 4px 8px;
  line-height: 1.1;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
  color: #111827;
  transition: var(--crm-hover-transition);

  font-size: 14px;
}

.verification-menu {
  column-gap: 0;
  row-gap: 0;
  gap: 0;
  white-space: normal;
}

.verification-menu li + li {
  margin-top: 0;
}

.verification-menu li[data-vtype]::before {
  display: inline-block;
  width: 1.1em;
  text-align: center;
  font-size: 0.95em;
  line-height: 1;
}
.verification-menu li:hover {
  background: #f5f3ff;
  color: #4c1d95;
}
.verification-menu li[data-vtype="identity"]::before {
  content: "🪪";
}
.verification-menu li[data-vtype="address"]::before {
  content: "🏠";
}
.verification-menu li[data-vtype="source_of_funds"]::before {
  content: "💼";
}

.system-message-inner .system-message-text .arb-action-buttons {
  margin-top: 0;
}
.system-message-inner .system-message-text .arb-grid {
  margin-bottom: 6px;
}
.system-message-inner .system-message-text .status-pill {
  margin-top: 18px;
}

.arb-action-buttons.verification-actions {
  gap: 10px;
}
@media (max-width: 560px) {
  .verification-menu {
    min-width: 220px;
  }
  .arb-action-buttons {
    gap: 6px;
  }
}

@media (max-width: 576px) {
  .lead-info-tabs {
    padding: 30px 16px 10px 16px;
    gap: 5px;
  }
  .lead-info-panel .lead-info-content {
    padding: 5px 16px 55px;
  }
  .chat-input {
    padding: 15px 15px calc(40px + env(safe-area-inset-bottom, 0px)) 15px;
  }
  .media-modal-content {
    padding: 12px;
  }
  .media-modal-close {
    font-size: 32px;
  }
}

@media (max-width: 480px) {
  .chat-input {
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .chat-input .input-with-icon {
    align-items: flex-end;
  }
  .input-with-icon .chat-textarea.with-attach-btn:placeholder-shown:not(:focus) {
    height: 82px !important;
    min-height: 82px;
    max-height: 82px;
    padding: 10px 12px 50px !important;
    line-height: 1.4;
  }
  .input-with-icon .chat-textarea.with-attach-btn:focus,
  .input-with-icon .chat-textarea.with-attach-btn:not(:placeholder-shown) {
    min-height: 82px;
    padding: 10px 12px 50px !important;
  }
  .chat-input .input-with-icon::after {
    display: none;
  }
  .action-btn.send-msg-btn {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    position: fixed;
    top: var(--crm-mobile-header-height, 60px);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(var(--app-vh, 100dvh) - var(--crm-mobile-header-height, 60px));
    overflow: hidden;
  }
  .chat-sidebar {
    width: 100%;
    height: 100%;
    display: block;
  }
  .chat-main {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 100%;
    flex-direction: column;
  }

  .chat-layout.chat-open .chat-sidebar {
    display: none;
  }
  .chat-layout.chat-open .chat-main {
    display: flex;
  }

  .chat-header {
    padding: 12px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 768px) {
  .chat-header .pipeline-stage-change-wrapper {
    margin-left: 0 !important;
    width: 100%;
  }

  .chat-header .pipeline-stage-change-wrapper select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='currentColor' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
    width: 100%;
  }

  .chat-header .pipeline-stage-change-wrapper .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .chat-header .pipeline-stage-change-wrapper .dropdown-toggle::after {
    margin-left: auto;
  }
}
.crm-dropdown.chat-filter-dd {
  width: 100%;
  min-width: 0;
  display: block;
}
.crm-dropdown.chat-filter-dd .crm-dd-btn {
  width: 100%;
}
.crm-dropdown.chat-filter-dd .crm-dd-btn .crm-dd-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crm-dropdown .crm-dd-btn[disabled] {
  background: #f9fafb;
  color: #9ca3af;
  border-color: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.8;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: inherit;
  font: inherit;

  --crm-accent: #5b21b6;
}

.checkbox-container input[type="checkbox"] {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent;
}
.checkbox-container input[type="checkbox"]:hover,
.checkbox-container input[type="checkbox"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

@supports selector(.checkbox-container:has(input:checked)) {
  .checkbox-container {
    position: relative;
  }

  .checkbox-container input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
  }

  .checkbox-container::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    border: 1.5px solid var(--crm-border, #d1d5db);
    border-radius: 6px;
    background: var(--crm-bg, #ffffff);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
    transition: var(--crm-hover-transition);
    align-self: center;
  }

  .checkbox-container::after {
    content: none !important;
  }

  .checkbox-container:has(input[type="checkbox"]:checked)::before {
    background: var(--crm-accent, #5b21b6);
    border-color: var(--crm-accent, #5b21b6);
    box-shadow:
      0 4px 10px rgba(91, 33, 182, 0.2),
      inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 9px;
  }

  .checkbox-container:has(input[type="checkbox"]:focus-visible)::before {
    outline: 2px solid rgba(91, 33, 182, 0.35);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.15);
  }

  .checkbox-container:has(input[type="checkbox"][disabled]) {
    cursor: not-allowed;
    opacity: 0.8;
  }
  .checkbox-container:has(input[type="checkbox"][disabled])::before {
    background: #f9fafb;
    border-color: #e5e7eb;
    box-shadow: none;
  }

  @media (prefers-color-scheme: dark) {
    .checkbox-container::before {
      background: #0b0f16;
      border-color: #2a3240;
      box-shadow: none;
    }
    .checkbox-container:has(input[type="checkbox"]:checked)::before {
      background: var(--crm-accent, #5b21b6);
      border-color: var(--crm-accent, #5b21b6);
    }
  }
}

@media (max-width: 1024px) {
  .lead-info-tabs {
    padding: 30px 16px 10px 16px;
  }
}

#reset-filters {
  position: relative;
  z-index: 1;
}

.filters-content .buttons-wrapper {
  display: flex;
  align-items: stretch;
  gap: 6px;
}




#lead-actions-conversion-dd {
  display: flex;
}

#lead-actions-conversion-dd > .crm-dropdown {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.push-groups__more {
  overflow: visible;
}
.push-groups__more .action-btn {
  will-change: auto;
}
.push-groups__more .action-btn:hover,
.push-groups__more .action-btn:focus-visible {
  transform: none !important;
  box-shadow: none;
}

.macros-panel {
  position: fixed;
  z-index: 1600;
  width: min(355px, calc(100vw - 16px));
  height: min(360px, calc(100vh - 16px));
  height: min(360px, calc(100dvh - 16px));
  display: none;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.15);
  overflow: hidden;
}
.macros-panel.open {
  display: block;
}
.macros-panel__content {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.macros-panel__content::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.macros-empty {
  padding: 10px;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.comments-panel .comments-header {
  display: flex;
  position: sticky;
  top: 0;
  background: #fff;
  padding: 0 0 6px;
  z-index: 2;
  gap: 6px;
  flex-direction: column;
}
.comments-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.comments-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}
.comments-add-form {
  margin-right: 8px;
  margin-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 6px;
}
.comments-add-form.hidden {
  display: none;
}
.comments-add-text {
  width: 100%;
  resize: vertical;
  min-height: 54px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  line-height: 1.4;
  background: #fff;
  color: #111827;
}
.comments-add-text:focus {
  outline: none;
  border-color: rgba(67, 97, 238, 0.45);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}
.comments-add-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.comments-list-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 8px 10px;
}
.comment-empty,
.macros-empty {
  font-size: 12px;
  padding: 12px 8px;
  text-align: center;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
}
.comment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  position: relative;
}
.comment-item.done {
  background-color: var(--green-btn-bg);
  color: var(--green-btn-color);
  border: 1px solid var(--green-btn-border);
}
.comment-item.done .comment-text {
  text-decoration: line-through;
  opacity: 0.7;
}
.comment-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comment-meta {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #6b7280;
}
.comment-meta .author {
  font-weight: 600;
  color: #374151;
}
.comment-meta .dt {
  font-variant-numeric: tabular-nums;
}
.comment-text {
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
  color: #1f2937;
}
.comment-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}
.comment-done-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  height: 100%;
  position: relative;
}

.comment-done-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: inline-block;
  position: relative;
  background: linear-gradient(145deg, #f1f5f9, #ffffff);
  border: 1px solid #d1d5db;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.04),
    0 0 0 2px rgba(124, 58, 237, 0);
  transition: var(--crm-hover-transition);
}
.comment-item.done .comment-done-checkbox:not(:checked) {
  background: linear-gradient(145deg, #e2e8f0, #f8fafc);
}
.comment-done-checkbox:hover {
  border-color: #9ca3af;
}
.comment-done-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.55);
}
.comment-done-checkbox:active {
  transform: scale(0.92);
}
.comment-done-checkbox:checked {
  background: linear-gradient(145deg, #7c3aed, #5b21b6);
  border-color: #5b21b6;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 0 0 2px rgba(124, 58, 237, 0.3);
}
.comment-done-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
  opacity: 0;
  animation: commentCheckmarkFade 0.25s forwards 0.05s;
}
@keyframes commentCheckmarkFade {
  to {
    opacity: 1;
  }
}

.comment-done-checkbox:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.4);
}

.comment-item:not(.done) .comment-done-checkbox {
  animation: commentPulse 1.4s ease-in-out 1.2s 2 alternate;
}
@keyframes commentPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
  }
}

.comment-done-toggle label,
.comment-done-toggle input {
  cursor: pointer;
}

.comment-done-checkmark {
  display: none;
}

.badge-done {
  display: inline-block;
  font-size: 11px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 8px;
  background: #d1fae5;
  color: #065f46;
  font-weight: 600;
  border: 1px solid #10b981;
}
@media (max-width: 640px) {
  .comments-add-text {
    min-height: 64px;
  }
}

.macros-header,
.comments-panel .comments-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 8px 6px 8px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.macros-list-wrap {
  padding: 0 8px 10px;
}

.macros-tab-btn,
.comments-tab {
  background: #fff;
  color: #111827;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.macros-tab-btn[aria-selected="true"],
.comments-tab[aria-selected="true"] {
  background-color: var(--primary-light);
  color: var(--primary);
  transition: var(--crm-hover-transition);
}
.macros-search {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #111827;
  background: #fafafa;
}
.macros-search::placeholder {
  color: #9ca3af;
}
.macros-search:focus {
  outline: none;
  border-color: rgba(67, 97, 238, 0.35);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
  background: #fff;
}

.macros-list-wrap {
  will-change: transform, opacity;
}
@keyframes macrosSlideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-16px);
  }
}
@keyframes macrosSlideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes macrosSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes macrosSlideInRight {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.macros-list-wrap.slide-out.dir-left {
  animation: macrosSlideOutLeft 0.16s ease both;
}
.macros-list-wrap.slide-out.dir-right {
  animation: macrosSlideOutRight 0.16s ease both;
}
.macros-list-wrap.slide-in.dir-left {
  animation: macrosSlideInLeft 0.18s ease both;
}
.macros-list-wrap.slide-in.dir-right {
  animation: macrosSlideInRight 0.18s ease both;
}

.comments-list-wrap {
  will-change: transform, opacity;
}
@keyframes commentsSlideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-16px);
  }
}
@keyframes commentsSlideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(16px);
  }
}
@keyframes commentsSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes commentsSlideInRight {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.comments-list-wrap.slide-out.dir-left {
  animation: commentsSlideOutLeft 0.16s ease both;
}
.comments-list-wrap.slide-out.dir-right {
  animation: commentsSlideOutRight 0.16s ease both;
}
.comments-list-wrap.slide-in.dir-left {
  animation: commentsSlideInLeft 0.18s ease both;
}
.comments-list-wrap.slide-in.dir-right {
  animation: commentsSlideInRight 0.18s ease both;
}

@keyframes commentExitRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}
.comment-item.anim-exit-right {
  animation: commentExitRight 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.macros-header .action-btn {
  will-change: auto;
}
.macros-header .action-btn:hover,
.macros-header .action-btn:focus-visible {
  box-shadow: none;
}


.macros-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-auto-rows: min-content;
  gap: 8px;
}
.macros-item {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: #111827;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  transition: var(--crm-hover-transition);
}
.macros-item:hover {
  background: rgba(91,33,182,0.2);
  border: 1px solid var(--primary-border);
}
.macros-item:active {
  transform: translateY(1px);
}
.macros-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.18);
}
.macros-item .mi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.macros-item .mi-title {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  color: #1f2937;
}
.macros-item .mi-title .mi-attachments {
  display: inline-flex;
  gap: 6px;
  margin-left: 3px;
  color: var(--primary);
  vertical-align: middle;
}
.macros-item .mi-title .mi-attachments svg {
  display: block;
}
.macros-item .mi-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.macros-item .mi-actions .mi-edit-btn,
.macros-item .mi-actions .mi-delete-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  padding: 0;
}
.macros-item .mi-actions .mi-edit-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}
.macros-item .mi-actions .mi-delete-btn:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.macros-item .mi-actions .mi-delete-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}
.macros-item .mi-actions .mi-confirm-actions {
  display: inline-flex;
  gap: 6px;
}
.macros-item .mi-actions .mi-confirm-btn,
.macros-item .mi-actions .mi-cancel-btn {
  appearance: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
}

.macros-item.confirm-open .mi-actions .mi-delete-btn {
  display: none;
}
.macros-item.confirm-open .mi-actions .mi-edit-btn {
  display: none;
}


.macros-item .mi-text {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  word-break: break-word;
}

.file-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-picker__button {
  align-self: flex-start;
}
.file-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: #374151;
}
.file-chip {
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 9999px;
  padding: 4px 8px;
}

@media (max-width: 640px) {
  .macros-panel {
    width: min(355px, calc(100vw - 16px));
    height: min(360px, calc(100vh - 16px));
    height: min(360px, calc(100dvh - 16px));
  }
  .macros-header {
    grid-template-columns: 1fr;
  }

  .macros-panel.centered-mobile {
    left: 50%;
    transform: translateX(-50%);
  }
}

.comments-panel-btn {
  border: none;
  background: none;
  right: 125px;
}
.comments-panel-btn.has-comments-pending::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #dc2626;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
  animation: commentPendingPulse 2.4s ease-in-out infinite;
}
@keyframes commentPendingPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 2px #fff;
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.35);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 2px #fff;
  }
}

.chat-tag-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  flex-wrap: nowrap;
}
.chat-tag-display {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.chat-tag-list {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 100%;
}
.chat-tag-list:empty {
  display: none;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}
.tag-pill:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}
.tag-pill-label {
  pointer-events: none;
}
.tag-pill-remove {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  width: 16px;
  height: 16px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
}
.tag-pill-remove:hover,
.tag-pill-remove:focus-visible {
  color: #b91c1c;
  background: #fee2e2;
  border-color: #fecaca;
  outline: none;
}
.chat-tag-edit-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed #d1d5db;
  background: #ffffff;
  color: #6b7280;
  font-size: 0;
  position: relative;
  padding: 0;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  transition: var(--crm-hover-transition);
}

.chat-tag-edit-btn::before {
  content: "";
  width: 14px;
  height: 14px;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2028%2028'%3E%3Cg%3E%3Cg%3E%3Cpath%20fill='black'%20d='M25.969%201.029h-10a1%201%200%200%200-.707.293L13.183%203.4A6.991%206.991%200%201%201%203.4%2013.183l-1.381%201.382a3.488%203.488%200%200%200%200%204.928l6.486%206.486a3.484%203.484%200%200%200%204.928%200l13.243-13.243a1%201%200%200%200%20.293-.707v-10a1%201%200%200%200-1-1zM22%208a2%202%200%201%201%202-2%202%202%200%200%201-2%202z'/%3E%3Cpath%20fill='black'%20d='M9%2014a5%205%200%201%200-5-5%205.006%205.006%200%200%200%205%205zM7%208h1V7a1%201%200%200%201%202%200v1h1a1%201%200%200%201%200%202h-1v1a1%201%200%200%201-2%200v-1H7a1%201%200%200%201%200-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2028%2028'%3E%3Cg%3E%3Cg%3E%3Cpath%20fill='black'%20d='M25.969%201.029h-10a1%201%200%200%200-.707.293L13.183%203.4A6.991%206.991%200%201%201%203.4%2013.183l-1.381%201.382a3.488%203.488%200%200%200%200%204.928l6.486%206.486a3.484%203.484%200%200%200%204.928%200l13.243-13.243a1%201%200%200%200%20.293-.707v-10a1%201%200%200%200-1-1zM22%208a2%202%200%201%201%202-2%202%202%200%200%201-2%202z'/%3E%3Cpath%20fill='black'%20d='M9%2014a5%205%200%201%200-5-5%205.006%205.006%200%200%200%205%205zM7%208h1V7a1%201%200%200%201%202%200v1h1a1%201%200%200%201%200%202h-1v1a1%201%200%200%201-2%200v-1H7a1%201%200%200%201%200-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
@supports (-webkit-touch-callout: none) {
  .chat-tag-edit-btn::before {
    width: 15px;
    height: 15px;
  }
}
.chat-tag-edit-btn:hover,
.chat-tag-edit-btn:focus-visible {
  background: #f9fafb;
  border-color: #cbd5e1;
  color: #374151;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  outline: none;
}
.chat-tag-edit-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}


.crm-chat-tag-modal.modal-body {
  display: grid;
  gap: 14px;
  padding: 0;
}
.crm-chat-tag-modal__label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-strong, #111827);
}
.crm-chat-tag-modal__input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong, #e5e7eb);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-white, #fff);
  color: var(--text-strong, #111827);
}
.crm-chat-tag-modal__input::placeholder {
  color: var(--text-light, #9ca3af);
}
.crm-chat-tag-modal__hint {
  color: var(--text-light, #6b7280);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.35;
}

.tag-pill-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 2px;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  z-index: 3000;
}
.tag-pill-dropdown.open {
  display: flex;
  animation: tagDdFade 0.12s ease;
}
.tag-pill-dropdown.portal {
  position: fixed !important;
  margin-top: 0;
  left: 0;
  top: 0;
}
.tag-dd-btn {
  appearance: none;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1.2;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  color: #374151;
}
.tag-dd-btn:hover,
.tag-dd-btn:focus-visible {
  background: #eef2ff;
  border-color: #c7d2fe;
  outline: none;
  color: #1e3a8a;
}
.tag-dd-btn.edit {
  background-color: rgba(67, 97, 238, 0.1);
  color: var(--primary);
  border: 1px solid rgba(67, 97, 238, 0.2);
}

@keyframes tagDdFade {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


.chat-item-tags {
  flex: 0 0 100%;
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 2px 3px 0;
}
.chat-item-tags::-webkit-scrollbar {
  display: none;
}
.ci-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(15, 23, 42, 0.18);
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.ci-tag:hover {
  opacity: 0.96;
  transform: translateY(-1px);
  filter: saturate(1.08) brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 3px 8px rgba(15, 23, 42, 0.2);
}
.chat-item.active .ci-tag {
  border-color: rgba(124, 58, 237, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 8px rgba(124, 58, 237, 0.14);
}

html.dark-theme .chat-messages-loading {
  background: var(--overlay-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

html.dark-theme .chat-messages-loading-text,
html.dark-theme .chat-empty-state-text,
html.dark-theme .comments-title,
html.dark-theme .push-card__title {
  color: var(--text-strong);
}

html.dark-theme .chat-item {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.dark-theme .last-btn,
html.dark-theme .push-card,
html.dark-theme .macros-panel,
html.dark-theme .comments-panel .comments-header,
html.dark-theme .tag-pill-dropdown {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

html.dark-theme .tag-pill {
  background: var(--bg-soft-2);
  border-color: var(--border);
  color: var(--text-strong);
}
html.dark-theme .tag-pill:hover {
  background: var(--bg-soft-3);
  border-color: var(--border-strong);
}
html.dark-theme .tag-pill-remove {
  color: var(--text-light);
}
html.dark-theme .tag-pill-remove:hover,
html.dark-theme .tag-pill-remove:focus-visible {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(248, 113, 113, 0.35);
}
html.dark-theme .chat-tag-edit-btn {
  background: var(--bg-soft-2);
  border-color: var(--border-strong);
  color: var(--text-light);
}
html.dark-theme .chat-tag-edit-btn:hover,
html.dark-theme .chat-tag-edit-btn:focus-visible {
  background: var(--bg-soft-3);
  border-color: var(--primary-border);
  color: var(--text-strong);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
}
html.dark-theme .tag-dd-btn {
  background: var(--bg-soft-2);
  border-color: var(--border);
  color: var(--text-strong);
}
html.dark-theme .tag-dd-btn:hover,
html.dark-theme .tag-dd-btn:focus-visible {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: #e9d5ff;
}
html.dark-theme .tag-dd-btn.edit {
  background: rgba(124, 58, 237, 0.22);
  color: #c4b5fd;
  border-color: rgba(124, 58, 237, 0.38);
}

html.dark-theme .crm-chat-tag-modal__label {
  color: var(--text-strong);
}
html.dark-theme .crm-chat-tag-modal__input {
  background: var(--bg-soft-2);
  border-color: var(--border-strong);
  color: var(--text-strong);
}
html.dark-theme .crm-chat-tag-modal__input::placeholder {
  color: var(--text-light);
}
html.dark-theme .crm-chat-tag-modal__hint {
  color: var(--text-light);
}


html.dark-theme .chat-empty-state .chat-empty-state-card {
  background: var(--bg-soft) !important;
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .chat-empty-state .chat-empty-state-text {
  color: var(--text-strong);
}

html.dark-theme .last-btn {
  color: var(--text);
}

html.dark-theme .push-card:hover {
  border-color: var(--primary-border);
}

html.dark-theme .push-card__author {
  color: var(--text-light);
}

html.dark-theme .macros-empty,
html.dark-theme .comment-empty {
  background: var(--bg-soft-2);
  border: 1px dashed var(--border-strong);
  color: var(--text-light);
}

html.dark-theme .icon-btn {
  background: var(--bg-soft-2);
  color: var(--text);
}

html.dark-theme .icon-btn:hover {
  background: var(--bg-soft-3);
}

html.dark-theme .icon-btn.push-refresh {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-light);
}

html.dark-theme .icon-btn.push-refresh:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  color: var(--text);
}

html.dark-theme .status-default {
  background: var(--bg-soft-2);
  color: var(--text-light);
}

html.dark-theme .checkbox-container::before {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: none;
}

html.dark-theme .checkbox-container:has(input[type="checkbox"][disabled])::before {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .crm-switch-slider {
  background: var(--bg-soft-3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

html.dark-theme .tag-dd-btn {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .tag-dd-btn:hover,
html.dark-theme .tag-dd-btn:focus-visible {
  background: rgba(167, 139, 250, 0.16);
  border-color: var(--primary-border);
  color: #ddd6fe;
}


html.dark-theme .chat-container {
  background: var(--bg-elevated);
  border-color: var(--border);
}

html.dark-theme .chat-sidebar {
  background: var(--bg-elevated);
  border-right-color: var(--border);
}

html.dark-theme .chat-header {
  background: var(--bg-elevated);
  border-bottom-color: var(--border);
}

html.dark-theme .chat-messages {
  background-color: var(--bg-light);
}

html.dark-theme .chat-messages-loading-inner {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}


html.dark-theme .chat-input {
  background: linear-gradient(263.87deg, var(--bg-elevated) 0%, var(--bg-soft) 100%);
  border-top-color: var(--border);
}

html.dark-theme .input-with-icon input,
html.dark-theme .input-with-icon textarea {
  background-color: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .chat-input textarea::placeholder {
  color: #c5cedc;
  opacity: 1;
}

html.dark-theme .chat-input .attach-btn-inside {
  color: #cbd5e1;
}

html.dark-theme .chat-input .input-with-icon::after {
  background: linear-gradient(90deg, rgba(32, 38, 53, 0) 0%, rgba(32, 38, 53, 1) 40%);
}

html.dark-theme .file-info {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .file-name {
  color: var(--text-light);
}

html.dark-theme .file-remove-btn {
  color: var(--text-light);
}


html.dark-theme .chat-item:hover:not(.active) {
  background-color: var(--bg-soft);
}

html.dark-theme .chat-item.active {
  background-color: rgba(167, 139, 250, 0.12);
}

html.dark-theme .chat-item.active .chat-name {
  color: #c4b5fd;
}

html.dark-theme .chat-item .chat-item-pin-icon {
  color: #fbbf24;
}

html.dark-theme .chat-item.active .chat-item-pin-icon {
  color: #c4b5fd;
}

html.dark-theme .chat-item.active .chat-preview {
  color: #a78bfa;
}

html.dark-theme .chat-item.active .chat-time {
  color: #a78bfa;
}

html.dark-theme .chat-item.unread {
  background-color: rgba(99, 102, 241, 0.08);
}

html.dark-theme .chat-preview {
  color: var(--text-light);
}

html.dark-theme .chat-time {
  color: var(--text-light);
}


html.dark-theme .unread-count,
html.dark-theme .chat-source-tabs .tab-btn .tab-unread {
  background: #166534;
  color: #ffffff;
}


html.dark-theme .chat-source-tabs {
  background: var(--bg-elevated);
  border-bottom-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

html.dark-theme .chat-source-tabs::after {
  background: linear-gradient(to bottom, rgba(32, 38, 53, 0.65), rgba(32, 38, 53, 0));
}

html.dark-theme .chat-source-tabs-label {
  color: var(--text-light);
}

html.dark-theme .chat-source-tabs .tab-btn {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

html.dark-theme .chat-source-tabs .tab-btn:hover {
  background: var(--bg-soft-2);
  border-color: var(--border-strong);
}

html.dark-theme .chat-source-tabs .tab-btn.active {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.12);
}


html.dark-theme .lead-info-panel {
  background: var(--bg-elevated);
  border-color: var(--border);
}

html.dark-theme .lead-info-header {
  background: var(--bg-elevated);
  box-shadow: 0 1px 0 var(--border);
}

html.dark-theme .lead-info-header::after {
  background: var(--bg-elevated);
}

html.dark-theme .lead-info-tabs {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

html.dark-theme .lead-tab-btn {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

html.dark-theme .lead-tab-btn:hover {
  background: var(--bg-soft-2);
  border-color: var(--border-strong);
}

html.dark-theme .lead-tab-btn.active {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
}

html.dark-theme .lead-info-toolbar {
  border-bottom-color: var(--border);
}

html.dark-theme .lead-info-toolbar .toolbar-hint {
  color: var(--text-light);
}

html.dark-theme .lead-info-panel .grabber-bar {
  background: var(--bg-soft-3);
}


html.dark-theme .lead-profile-top {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .lead-profile-name {
  color: var(--text-strong);
}

html.dark-theme .lead-profile-sub {
  color: var(--text);
}

html.dark-theme .lead-profile-username {
  color: #818cf8;
}

html.dark-theme .lead-profile-sub .muted {
  color: var(--text-light);
}

html.dark-theme .lead-username {
  color: var(--text-light);
}

html.dark-theme .lead-secondary-info {
  color: var(--text-light);
}


html.dark-theme .lead-widget-site-row {
  border-bottom-color: var(--border);
}

html.dark-theme .lead-widget-site-row .label {
  color: var(--text-light);
}

html.dark-theme .lead-widget-site-row .value {
  color: var(--text);
}

html.dark-theme .lead-widget-site-row .lead-copy-btn {
  color: var(--text-light);
}

html.dark-theme .lead-widget-site-row .lead-copy-btn:hover,
html.dark-theme .lead-widget-site-row .lead-copy-btn:focus-visible {
  color: var(--primary-ink, #e9d5ff);
  background: var(--primary-light);
}

html.dark-theme .widget-param-add-trigger {
  border-color: var(--border);
  color: var(--text-light);
}

html.dark-theme .widget-param-add-trigger:hover {
  border-color: rgba(167, 139, 250, 0.55);
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.12);
}

html.dark-theme .widget-param-add-form input {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .widget-param-add-form input::placeholder {
  color: var(--text-light);
}


html.dark-theme .order-card {
  background: var(--bg-soft);
  border-color: var(--border);
  box-shadow: none;
}

html.dark-theme .order-card-date {
  color: var(--text);
}

html.dark-theme .order-card-id {
  color: var(--text-light);
}

html.dark-theme .order-asset .label {
  color: var(--text-light);
}

html.dark-theme .order-asset .value {
  color: var(--text);
}

html.dark-theme .order-card-status .status-block label {
  color: var(--text-light);
}

html.dark-theme .order-card-details {
  color: var(--text);
  border-top-color: var(--border);
}

html.dark-theme .order-detail-line .label {
  color: var(--text-light);
}

html.dark-theme .order-card-toggle {
  color: #818cf8;
}

html.dark-theme .hash-link {
  color: #818cf8;
}

html.dark-theme .order-id-copy {
  color: var(--text-light);
}

html.dark-theme .order-id-copy:hover {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}


html.dark-theme .lead-orders-filters .orders-search-input {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .lead-orders-filters select.orders-status-filter,
html.dark-theme .lead-orders-filters select.orders-arb-filter,
html.dark-theme select.order-status-select {
  background-color: var(--bg-elevated) !important;
  border-color: var(--border) !important;
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23cbd5e1' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E") !important;
}

html.dark-theme .lead-orders-domains .domain-chip {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

html.dark-theme .lead-orders-domains .domain-chip:hover {
  background: var(--bg-soft-2);
  border-color: var(--border-strong);
}

html.dark-theme .lead-orders-domains .domain-chip.active {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}

html.dark-theme .orders-no-results {
  color: var(--text-light);
}


html.dark-theme .domain-input-label {
  color: var(--text-light);
}

html.dark-theme .domain-input {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}


html.dark-theme .crm-dropdown .crm-dd-btn {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .crm-dropdown .crm-dd-btn:hover,
html.dark-theme .crm-dropdown .crm-dd-btn:focus-visible {
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.45);
  box-shadow: none;
  transform: none;
}

html.dark-theme .crm-dd-option:hover {
  background: rgba(167, 139, 250, 0.12);
}

html.dark-theme .crm-tags-filter .crm-dd-option:hover {
  background: rgba(167, 139, 250, 0.12);
}



html.dark-theme .crm-dropdown .crm-dd-btn[disabled],
html.dark-theme .crm-dropdown .crm-dd-btn[disabled]:hover,
html.dark-theme .crm-dropdown .crm-dd-btn[disabled]:focus,
html.dark-theme .crm-dropdown .crm-dd-btn[disabled]:focus-visible {
  background: var(--bg-soft-2);
  border-color: var(--border);
  color: var(--text-light);
  cursor: not-allowed;
  opacity: 0.92;
  box-shadow: none;
  transform: none;
}

html.dark-theme .crm-dd-menu {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .crm-dd-option {
  color: var(--text);
}

html.dark-theme .crm-dd-option.selected {
  background: rgba(167, 139, 250, 0.18);
  color: #ddd6fe;
}

html.dark-theme .crm-dd-search {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .crm-tags-filter .crm-dd-search.tags-search,
html.dark-theme .crm-dd-menu.tags-filter-menu .crm-clearable .crm-dd-search.tags-search,
html.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-search.tags-search {
  background: var(--bg-soft, #1e293b);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
  color: var(--text, #e2e8f0);
}

html.dark-theme .crm-tags-filter .crm-dd-search.tags-search:focus,
html.dark-theme .crm-dd-menu.tags-filter-menu .crm-clearable .crm-dd-search.tags-search:focus,
html.dark-theme .crm-dd-menu.tags-filter-menu .crm-dd-search.tags-search:focus {
  border-color: rgba(167, 139, 250, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

html.dark-theme .crm-dd-search::placeholder {
  color: #94a3b3;
  opacity: 1;
}

html.dark-theme .crm-dd-option .pair-token .ticker {
  color: var(--text);
}

html.dark-theme .crm-dd-option .pair-token .chain {
  color: var(--text-light);
}

html.dark-theme .crm-dd-option .pair-id {
  color: var(--text-light);
}

html.dark-theme .crm-dd-option .pair-raw {
  color: var(--text);
}


html.dark-theme .push-filter .filter-btn {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

html.dark-theme .push-filter .filter-btn:hover {
  background: var(--bg-soft);
}

html.dark-theme .push-filter .filter-menu {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .push-filter .filter-menu .item {
  color: var(--text);
}

html.dark-theme .push-filter .filter-menu .item:hover {
  background: var(--bg-soft);
}

html.dark-theme .push-filter .filter-menu .item.is-active {
  background: rgba(167, 139, 250, 0.18);
  color: #ddd6fe;
}


html.dark-theme .push-row {
  border-color: var(--border);
}

html.dark-theme .push-row:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}

html.dark-theme .push-row .row-chat {
  color: var(--text);
}

html.dark-theme .push-row .chat-plat {
  color: var(--text-light);
}

html.dark-theme .push-row .st-pending {
  background: var(--bg-soft);
  color: var(--text-light);
}

html.dark-theme .push-details-meta {
  color: var(--text-light);
}

html.dark-theme .push-details-meta .meta-label {
  color: var(--text-light);
}

html.dark-theme .push-details-meta .meta-value {
  color: var(--text);
}


html.dark-theme .progress {
  background: var(--bg-soft-2);
}

html.dark-theme .progress .progress-bar--rest-pending {
  background: linear-gradient(90deg, var(--bg-soft-2) 0%, var(--bg-soft-3) 70%, var(--bg-soft-2) 100%);
}


html.dark-theme .crm-stepper {
  border-color: var(--border);
  background: var(--bg-elevated);
}

html.dark-theme .crm-stepper .stepper-btn {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

html.dark-theme .crm-stepper .stepper-btn:hover {
  background: var(--bg-soft-2);
}

html.dark-theme .crm-stepper .stepper-value {
  color: var(--text);
}


html.dark-theme .ver-card {
  background: var(--bg-soft);
  border-color: var(--border);
  box-shadow: none;
}

html.dark-theme .ver-card-header .ver-id {
  color: var(--text-light);
}

html.dark-theme .ver-card-header .ver-type {
  color: var(--text);
}

html.dark-theme .ver-status {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}

html.dark-theme .ver-section-title {
  color: var(--text);
}

html.dark-theme .ver-card-body .ver-meta .label {
  color: var(--text-light);
}

html.dark-theme .ver-card.loading,
html.dark-theme .ver-empty {
  color: var(--text-light);
}


html.dark-theme .lead-bindings-wrap .identity-summary {
  background: var(--bg-soft);
  border-color: var(--border);
  box-shadow: none;
}

html.dark-theme .lead-bindings-wrap .identity-summary .identity-line .label {
  color: var(--text);
}

html.dark-theme .avail-assign-box {
  background: var(--bg-soft);
  border-color: var(--border);
  box-shadow: none;
}

html.dark-theme .lead-bindings-available-cards {
  border-top-color: var(--border);
}


html.dark-theme .rank-badge.regular {
  background: var(--bg-soft-2);
  color: var(--text);
  border-color: var(--border);
}


html.dark-theme .chat-header-top .back-btn {
  border-color: var(--border);
  background: var(--bg-soft);
  color: var(--text);
}


html.dark-theme .automation-runs-bar {
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg-soft) 100%);
  border-bottom-color: var(--border);
}

html.dark-theme .automation-run-pill {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

html.dark-theme .automation-run-pill:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}


html.dark-theme .chat-search-container {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .chat-search-container .search-icon {
  color: #b3bec9;
}

html.dark-theme .chat-search-container #chat-search-input::placeholder {
  color: #94a3b3;
  opacity: 1;
}


html.dark-theme .chat-list__footer {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .chat-list__footer-settings-btn {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text);
}

html.dark-theme .chat-list__footer-settings-btn.is-active {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.12);
}


html.dark-theme .transparent-dropdown .dropdown-toggle:hover,
html.dark-theme .transparent-dropdown .dropdown-toggle:focus-visible {
  background: var(--bg-soft);
  border-color: var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}


html.dark-theme .date-separator {
  color: var(--text-light);
}

html.dark-theme .date-separator:before,
html.dark-theme .date-separator:after {
  background: linear-gradient(to right, transparent, var(--border));
}


html.dark-theme .messanger.tab-buttons {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .messanger.tab-btn {
  background: var(--bg-elevated);
  color: var(--text);
}


html.dark-theme .macros-tabs,
html.dark-theme .comments-tabs {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .macros-tab-btn,
html.dark-theme .comments-tab {
  background: var(--bg-elevated);
  color: var(--text);
}

html.dark-theme .macros-header,
html.dark-theme .comments-panel .comments-header {
  background: var(--bg-elevated);
}

html.dark-theme .macros-search {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .macros-search:focus {
  background: var(--bg-elevated);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.15);
}

html.dark-theme .macros-search::placeholder {
  color: #94a3b8;
  opacity: 1;
}

html.dark-theme .comments-add-form {
  background: var(--bg-soft-2);
  border: 1px solid var(--border);
}

html.dark-theme .comments-add-text {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text);
}

html.dark-theme .comments-add-text::placeholder {
  color: #94a3b8;
  opacity: 1;
}

html.dark-theme .comments-add-text:focus {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
}

html.dark-theme .macros-tab-btn[aria-selected="true"],
html.dark-theme .comments-tab[aria-selected="true"] {
  background: rgba(167, 139, 250, 0.22);
  color: #e9d5ff;
}

html.dark-theme .comment-item {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .comment-item.done {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(52, 211, 153, 0.32);
  color: #a7f3d0;
}

html.dark-theme .comment-text {
  color: var(--text);
}

html.dark-theme .comment-item.done .comment-text {
  color: var(--text-light);
}

html.dark-theme .comment-meta {
  color: var(--text-light);
}

html.dark-theme .comment-meta .author {
  color: var(--text-strong);
}

html.dark-theme .comment-done-checkbox {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

html.dark-theme .comment-item.done .comment-done-checkbox:not(:checked) {
  background: var(--bg-soft-2);
}

html.dark-theme .macros-item {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .macros-item .mi-title {
  color: var(--text);
}


html.dark-theme .select-box {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .selected-text {
  color: var(--text-light);
}

html.dark-theme .checkboxes-container {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}


html.dark-theme .filter-reset {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .form-section {
  background: var(--bg-elevated);
  box-shadow: none;
}

html.dark-theme .form-input,
html.dark-theme .form-select {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .condition-value-input {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .filter-select {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .form-group.condition-param {
  background: var(--bg-soft);
}

html.dark-theme .form-group.condition-param label {
  color: var(--text-light);
}


html.dark-theme #manager-settings-tab .translation-settings__label,
html.dark-theme #filters-tab .filter-group__label {
  color: var(--text-light);
}

html.dark-theme #manager-settings-tab .translation-settings__select,
html.dark-theme #filters-tab .filter-select {
  background-color: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme #manager-settings-tab .setting-context {
  border-top-color: var(--border);
}

html.dark-theme #manager-settings-tab .context-badge {
  background-color: var(--bg-soft);
  border-color: var(--border);
  color: var(--text-light);
}


html.dark-theme .filters-content {
  background: var(--bg-elevated);
  color: var(--text);
}

html.dark-theme .filters-content.popover-mode {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .chat-filters {
  background: var(--bg-elevated);
}

html.dark-theme .actions-header {
  background: var(--bg-soft);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

html.dark-theme .filter-group label {
  color: var(--text-light);
}

html.dark-theme .notif-settings {
  background: linear-gradient(
    165deg,
    rgba(124, 58, 237, 0.14) 0%,
    var(--bg-soft-2) 48%,
    var(--bg-soft-2) 100%
  );
  border-color: rgba(139, 92, 246, 0.42);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 4px 14px rgba(0, 0, 0, 0.2);
}

html.dark-theme .notif-settings .ts-title {
  color: #f1f5f9;
}

html.dark-theme .notif-settings .ts-title .ts-icon {
  color: #a855f7;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.35));
}

html.dark-theme .notif-settings .ts-hint {
  color: var(--text-light);
}

html.dark-theme #manager-settings-tab .ts-value-badge {
  color: #faf5ff;
  font-weight: 700;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.45) 0%, rgba(124, 58, 237, 0.32) 100%);
  border: 1px solid rgba(192, 132, 252, 0.55);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.15) inset;
}

html.dark-theme #manager-settings-tab .crm-range .range-icon {
  color: #c084fc;
}

html.dark-theme #notif-volume-range {
  background: linear-gradient(
    to right,
    #9333ea 0%,
    #a855f7 var(--range-fill, 0%),
    var(--bg-soft-3) var(--range-fill, 0%),
    #1e293b 100%
  );
}

html.dark-theme #notif-volume-range::-webkit-slider-runnable-track {
  background: linear-gradient(
    to right,
    #9333ea 0%,
    #a855f7 var(--range-fill, 0%),
    var(--bg-soft-3) var(--range-fill, 0%),
    #1e293b 100%
  );
}

html.dark-theme #notif-volume-range::-webkit-slider-thumb {
  background: linear-gradient(180deg, #faf5ff 0%, #ede9fe 100%);
  border: 2px solid #c084fc;
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.35),
    0 2px 8px rgba(147, 51, 234, 0.45);
}

html.dark-theme #notif-volume-range::-moz-range-track {
  background: var(--bg-soft-3);
}

html.dark-theme #notif-volume-range::-moz-range-progress {
  background: linear-gradient(90deg, #9333ea 0%, #c084fc 100%);
}

html.dark-theme #notif-volume-range::-moz-range-thumb {
  background: linear-gradient(180deg, #faf5ff 0%, #ede9fe 100%);
  border: 2px solid #c084fc;
}

html.dark-theme #notif-volume-range::-ms-fill-upper {
  background: #1e293b;
}

html.dark-theme #notif-volume-range::-ms-fill-lower {
  background: linear-gradient(90deg, #9333ea 0%, #a855f7 100%);
}

html.dark-theme #notif-volume-range::-ms-thumb {
  background: linear-gradient(180deg, #faf5ff 0%, #ede9fe 100%);
  border: 2px solid #c084fc;
}

html.dark-theme #manager-settings-tab .crm-switch-slider {
  background: rgba(30, 41, 59, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(139, 92, 246, 0.28),
    inset 0 2px 4px rgba(0, 0, 0, 0.25);
}

html.dark-theme .crm-switch input:checked + .crm-switch-slider {
  background: linear-gradient(180deg, #9333ea 0%, #7c3aed 55%, #6d28d9 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 14px rgba(147, 51, 234, 0.4);
}


html.dark-theme #pushes-tab .empty-state {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

html.dark-theme .push-card__stats {
  color: var(--text-light);
}

html.dark-theme .progress {
  background: var(--bg-soft-3);
}

html.dark-theme .progress .progress-bar.gradient {
  background: linear-gradient(90deg, #6d28d9 0%, #a78bfa 50%, #818cf8 100%);
}

html.dark-theme .progress .progress-bar--rest-pending {
  background: linear-gradient(90deg, #3b4558 0%, #4b5563 55%, #3b4558 100%);
}

html.dark-theme .progress .progress-bar--rest-scheduled {
  background: linear-gradient(
    90deg,
    rgba(167, 139, 250, 0.35) 0%,
    rgba(124, 58, 237, 0.45) 45%,
    rgba(167, 139, 250, 0.3) 100%
  );
}

html.dark-theme .status-success {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

html.dark-theme .push-groups__more .action-btn.btn-secondary {
  background: var(--bg-soft-2);
  color: var(--text);
  border-color: var(--border);
}

html.dark-theme .push-groups__more .action-btn.btn-secondary:hover {
  background: var(--bg-soft-3);
  border-color: var(--border-strong);
  color: var(--text-strong);
}

html.dark-theme .push-group-card {
  background: var(--bg-elevated);
  border-color: var(--border);
}

html.dark-theme .push-group-footer {
  color: var(--text-light);
}

html.dark-theme .badge-empty {
  background-color: var(--bg-soft);
  border-color: var(--border);
  color: var(--text);
}


html.dark-theme .pipeline-dropdown-menu,
html.dark-theme .lead-dropdown-menu {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
}

html.dark-theme .pipeline-dropdown-menu .pipeline-header,
html.dark-theme .lead-dropdown-menu .lead-item-header {
  border-color: var(--border);
}

html.dark-theme .pipeline-dropdown-menu .pipeline-header:hover,
html.dark-theme .lead-dropdown-menu .lead-item-header:hover {
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.28);
}

html.dark-theme .pipeline-dropdown-menu .pipeline-item.is-selected .pipeline-header,
html.dark-theme .pipeline-dropdown-menu .lead-id-item.is-selected .pipeline-header,
html.dark-theme .lead-dropdown-menu .lead-id-item.is-selected .lead-item-header {
  color: #e9d5ff;
  background: rgba(167, 139, 250, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
}

html.dark-theme .pipeline-dropdown-menu .stages-container {
  border-left-color: var(--border-strong);
}

html.dark-theme .pipeline-dropdown-menu .lead-id-title,
html.dark-theme .lead-dropdown-menu .lead-id-title {
  color: var(--text);
}

html.dark-theme .pipeline-dropdown-menu .lead-id-meta,
html.dark-theme .lead-dropdown-menu .lead-id-meta {
  color: var(--text-light);
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .pipeline-dropdown-menu .lead-id-sub,
html.dark-theme .lead-dropdown-menu .lead-id-sub {
  color: var(--text-light);
}

html.dark-theme .pipeline-header.current {
  background-color: rgba(167, 139, 250, 0.12);
  border-left-color: #a78bfa !important;
}

html.dark-theme .pipeline-dropdown-menu .stage-item:hover {
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.1);
}

html.dark-theme .pipeline-dropdown-menu .stage-item.is-selected {
  color: #e9d5ff;
  background: rgba(167, 139, 250, 0.16);
}

html.dark-theme .stage-item.active {
  background-color: rgba(167, 139, 250, 0.12);
  font-weight: 500;
}

html.dark-theme .stage-item.active .stage-content {
  color: #ddd6fe;
}

html.dark-theme .stage-item.current-stage {
  background-color: rgba(167, 139, 250, 0.18);
  color: #ede9ff;
}

html.dark-theme .toggle-stages-btn {
  color: var(--text-light);
}


html.dark-theme .transparent-dropdown-menu .list-group label.dropdown-item {
  border-color: var(--border);
  color: var(--text);
}

html.dark-theme .transparent-dropdown-menu .list-group label.dropdown-item:hover {
  background-color: var(--bg-soft);
}


html.dark-theme .manual-flow-option__title {
  color: var(--text);
}

html.dark-theme .manual-flow-option__meta {
  color: var(--text-light);
}

html.dark-theme .slash-macros-menu .slash-macro-option .sm-text {
  color: var(--text);
}

html.dark-theme .slash-macros-menu .crm-dd-option.selected {
  background: rgba(167, 139, 250, 0.18);
  color: #ddd6fe;
}

html.dark-theme .lead-macros-menu .crm-dd-option.selected {
  background: rgba(167, 139, 250, 0.18);
  color: #ddd6fe;
}

html.dark-theme .lead-macro-option .lm-key {
  color: var(--text);
}


html.dark-theme .pipeline-label {
  border-bottom-color: var(--border);
}


html.dark-theme .status-badge.sb-frozen {
  color: var(--text-light);
  background: var(--bg-soft-2);
  border-color: var(--border);
}

html.dark-theme .status-badge.sb-muted {
  color: var(--text-light);
  background: var(--bg-soft);
  border-color: var(--border);
}


html.dark-theme .lead-automation-empty,
html.dark-theme .lead-additional-params-empty {
  color: var(--text-light);
}

html.dark-theme .list-loading,
html.dark-theme .empty-list {
  color: var(--text-light);
}


html.dark-theme .lead-tab-content#lead-tab-profile .profile-statuses .status-row > label {
  color: var(--text);
}

html.dark-theme .lead-tab-content#lead-tab-profile .profile-statuses select.status-select {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23cbd5e1' d='M0.8 1.2L5 5.4l4.2-4.2-.8-.8L5 3.8 1.6.4z'/%3E%3C/svg%3E");
}

html.dark-theme .lead-tab-content#lead-tab-profile .lead-verifications-table th {
  background: var(--bg-soft);
}


html.dark-theme .message.is-push .message-header .badge.push-badge {
  background: var(--bg-soft);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.3);
}

html.dark-theme .message.is-push .message-header .badge.push-badge.push-badge--buttons {
  background: var(--bg-soft);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.35);
}

html.dark-theme .message.is-push .message-header .badge.push-badge.push-badge--pin {
  background: var(--bg-soft);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.35);
}


html.dark-theme .message-btn {
  border-color: rgba(167, 139, 250, 0.25);
  background: var(--bg-soft);
  color: #c4b5fd;
}


html.dark-theme .crm-input-clear-btn:hover {
  background: var(--bg-soft);
}


html.dark-theme .crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt:hover,
html.dark-theme .crm-dd-menu.tags-filter-menu.portal .crm-dd-option.mgmt-opt:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
}

html.dark-theme .crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt.selected:hover,
html.dark-theme .crm-dd-menu.tags-filter-menu.portal .crm-dd-option.mgmt-opt.selected:hover {
  background: rgba(167, 139, 250, 0.2);
  color: #ddd6fe;
}

html.dark-theme .crm-dropdown.chat-filter-dd .crm-dd-menu.tags-filter-menu .crm-dd-option.mgmt-opt .checkmark,
html.dark-theme .crm-dd-menu.tags-filter-menu.portal .crm-dd-option.mgmt-opt .checkmark {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

html.dark-theme .crm-dd-menu.tags-filter-menu .crm-clearable,
html.dark-theme .crm-dd-menu.tags-filter-menu .tags-filter-actions {
  background: transparent;
}


html.dark-theme .pipeline-dropdown-menu .lead-id-item .pipeline-header,
html.dark-theme .lead-dropdown-menu .lead-id-item .lead-item-header {
  border-color: var(--border);
  color: var(--text);
}


html.dark-theme .filter-condition {
  background: var(--bg-soft);
  border-color: var(--border);
}

html.dark-theme .filter-condition .remove-condition-btn {
  background: var(--bg-soft-2);
}


#msg-search-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--bg-main, #fff);
  border-bottom: 1.5px solid var(--border, #e5e7eb);
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  display: none;
  flex-direction: column;
  gap: 0;
  padding: 0;
  animation: msgSearchSlideDown 0.18s ease;
}
#msg-search-panel.is-open {
  display: flex;
}
@keyframes msgSearchSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.msg-search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 8px;
}
.msg-search-header svg {
  flex-shrink: 0;
  color: var(--text-muted, #9ca3af);
}
#msg-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-main, #111827);
  line-height: 1.5;
}
#msg-search-input::placeholder {
  color: var(--text-muted, #9ca3af);
}
.msg-search-counter {
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}
.msg-search-nav {
  display: flex;
  gap: 2px;
}
.msg-search-nav button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 5px;
  border-radius: 6px;
  color: var(--text-muted, #6b7280);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.msg-search-nav button:hover {
  background: var(--bg-soft, #f3f4f6);
  color: var(--brand, #5b21b6);
}
.msg-search-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-muted, #9ca3af);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  margin-left: 2px;
}
.msg-search-close:hover {
  background: var(--bg-soft, #f3f4f6);
  color: var(--text-danger, #ef4444);
}


#msg-search-results {
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--bg-main, #fff);
}
.msg-search-empty {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted, #9ca3af);
  text-align: center;
}
.msg-search-result-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #f3f4f6);
  transition: background 0.12s;
}
.msg-search-result-item:last-child {
  border-bottom: none;
}
.msg-search-result-item:hover,
.msg-search-result-item.is-active {
  background: var(--bg-soft, #f3f4f6);
}
.msg-search-result-item.is-active {
  background: var(--brand-soft, #ede9fe);
}
.msg-search-result-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
}
.msg-search-result-meta .lead-name {
  font-weight: 600;
  color: var(--text-main, #374151);
}
.msg-search-result-text {
  font-size: 13px;
  color: var(--text-main, #374151);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.msg-search-result-text mark {
  background: #fde68a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}


.msg-search-highlight {
  outline: 2.5px solid var(--brand, #5b21b6) !important;
  outline-offset: 2px;
  border-radius: 8px;
  animation: msgSearchPulse 1.4s ease forwards;
}
@keyframes msgSearchPulse {
  0%   { outline-color: var(--brand, #5b21b6); }
  60%  { outline-color: var(--brand, #5b21b6); }
  100% { outline-color: transparent; }
}


.msg-search-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border, #e5e7eb);
  border-top-color: var(--brand, #5b21b6);
  border-radius: 50%;
  animation: msgSearchSpin 0.7s linear infinite;
  flex-shrink: 0;
}
.msg-search-spinner.is-active {
  display: inline-block;
}
@keyframes msgSearchSpin {
  to { transform: rotate(360deg); }
}


html.dark-theme #msg-search-panel {
  background: var(--bg-main, #18181b);
  border-color: var(--border, #27272a);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}
html.dark-theme #msg-search-results {
  background: var(--bg-main, #18181b);
  border-color: var(--border, #27272a);
}
html.dark-theme .msg-search-result-item {
  border-color: var(--border, #27272a);
}
html.dark-theme .msg-search-result-item:hover,
html.dark-theme .msg-search-result-item.is-active {
  background: var(--bg-soft, #27272a);
}
html.dark-theme .msg-search-result-item.is-active {
  background: rgba(91,33,182,.22);
}
html.dark-theme #msg-search-input {
  color: var(--text-main, #f4f4f5);
}
html.dark-theme .msg-search-result-text mark {
  background: rgba(253,230,138,.25);
}

/* Рекламные фильтры чатов — модальный вариант фильтра Traffic Tracker. */
.chat-ad-filter-entry {
  display: block;
  width: 100%;
}

.chat-ad-filter-entry .chat-ad-filter-trigger.has-filters,
.chat-ad-filter-entry .chat-ad-filter-trigger[data-has-filters="1"],
.chat-ad-filter-entry .chat-ad-filter-trigger[aria-expanded="true"] {
  color: var(--primary, #5b21b6);
  background: var(--primary-light, rgba(91, 33, 182, 0.09));
  border-color: var(--primary-border, rgba(91, 33, 182, 0.25));
}

.chat-ad-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 2850;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
  color: inherit;
  background: rgba(15, 23, 42, 0.58);
  border: 0;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  overscroll-behavior: contain;
  isolation: isolate;
}

.chat-ad-filter-modal::backdrop {
  background: transparent;
}

.chat-ad-filter-modal.is-open {
  display: flex;
}

.chat-ad-filter-modal[hidden],
.chat-ad-filter-modal[aria-hidden="true"] {
  display: none !important;
}

html:has(.chat-ad-filter-modal.is-open),
body:has(.chat-ad-filter-modal.is-open),
body.chat-ad-filter-modal-open {
  overflow: hidden;
}

body.chat-ad-filter-modal-open .crm-drp-panel {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-ad-filter-modal__dialog {
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100vw - 48px));
  max-width: 100%;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  min-height: 0;
  overflow: hidden;
  color: var(--text-main, #2b2d42);
  background: var(--bg-white, #fff);
  border: 1px solid var(--border, #e9ecef);
  border-radius: 20px;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.26);
  animation: chatAdFilterEnter 160ms ease-out;
}

@keyframes chatAdFilterEnter {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-ad-filter-modal__header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 18px 28px;
  box-sizing: border-box;
  background: var(--bg-white, #fff);
  border-bottom: 1px solid var(--border, #e9ecef);
}

.chat-ad-filter-modal__title {
  margin: 0;
  color: var(--text-main, #2b2d42);
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 700;
  line-height: 1.25;
}

.chat-ad-filter-modal__close {
  appearance: none;
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  padding: 0;
  color: var(--text-muted, #64748b);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  transition: var(--crm-hover-transition, 0.18s ease);
}

.chat-ad-filter-modal__close:hover {
  color: var(--text-main, #2b2d42);
  background: var(--bg-soft, #f3f4f6);
}

.chat-ad-filter-modal__close:focus-visible,
.chat-ad-filter-trigger:focus-visible,
.chat-ad-filter-modal .chat-ad-dropdown-toggle:focus-visible,
.chat-ad-filter-modal .chat-ad-dropdown-search:focus-visible {
  outline: 2px solid var(--primary, #5b21b6);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--primary-light, rgba(91, 33, 182, 0.18));
}

.chat-ad-filter-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.chat-ad-filter-modal__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  padding: 28px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #d1d5db) transparent;
}

.chat-ad-filter-modal.is-loading .chat-ad-filter-modal__body {
  cursor: progress;
}

.chat-ad-filter-modal__body::-webkit-scrollbar {
  width: 9px;
}

.chat-ad-filter-modal__body::-webkit-scrollbar-thumb {
  background: var(--border-strong, #d1d5db);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: 999px;
}

.chat-ad-filter-modal__section {
  position: relative;
  overflow: visible;
}

.chat-ad-filter-modal__section + .chat-ad-filter-modal__section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--border, #e9ecef);
}

.chat-ad-filter-modal__section-title {
  margin: 0 0 18px;
  color: var(--text-main, #2b2d42);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.chat-ad-filter-modal__grid,
.chat-ad-filter-general {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 20px;
  min-width: 0;
  overflow: visible;
}

.chat-ad-filter-general {
  margin-top: 18px;
}

.chat-ad-quick-params:empty {
  display: none;
}

.chat-ad-quick-params:empty + .chat-ad-filter-general {
  margin-top: 0;
}

.chat-ad-filter-field {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin: 0;
}

.chat-ad-filter-field:has(.chat-ad-dropdown-panel.open),
.chat-ad-filter-field:has(.chat-ad-dropdown-toggle[aria-expanded="true"]) {
  z-index: 220;
}

.chat-ad-filter-field__label {
  display: block;
  margin: 0;
  color: var(--text-main, #2b2d42);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.chat-ad-multi {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.chat-ad-dropdown-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 46px;
  min-height: 46px;
  padding: 0 14px;
  color: var(--text-main, #2b2d42);
  background: var(--bg-main, #f8fafc);
  border: 1px solid var(--border-strong, #d1d5db);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  transition: var(--crm-hover-transition, 0.18s ease);
}

.chat-ad-dropdown-toggle:hover {
  background: var(--bg-soft, #f3f4f6);
}

.chat-ad-dropdown-toggle > svg {
  flex: 0 0 16px;
  color: var(--text-muted, #64748b);
  transition: transform 0.16s ease;
}

.chat-ad-dropdown-toggle[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.chat-ad-dropdown-selected {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.84;
}

.chat-ad-dropdown-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 240;
  display: none;
  flex-direction: column;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  max-height: min(330px, 42dvh);
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
  color: var(--text-main, #2b2d42);
  background: var(--bg-white, #fff);
  border: 1px solid var(--border-strong, #d1d5db);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.chat-ad-dropdown-panel.open {
  display: flex;
}

.chat-ad-dropdown-panel.chat-ad-dropdown-panel--overlay {
  position: fixed;
  right: auto;
  bottom: auto;
  z-index: 320;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}

.chat-ad-dropdown-search-wrap {
  flex: 0 0 auto;
}

.chat-ad-dropdown-search {
  appearance: none;
  width: 100%;
  min-height: 40px;
  margin: 0 0 4px;
  padding: 8px 10px;
  box-sizing: border-box;
  color: var(--text-main, #2b2d42);
  background: var(--bg-main, #f8fafc);
  border: 1px solid var(--border-strong, #d1d5db);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}

.chat-ad-dropdown-search::placeholder {
  color: var(--text-muted, #64748b);
  opacity: 0.82;
}

.chat-ad-dropdown-options {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 210px;
  margin: 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong, #d1d5db) transparent;
}

.chat-ad-dropdown-options li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 7px 9px;
  box-sizing: border-box;
  color: var(--text-main, #2b2d42);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.chat-ad-dropdown-options li:hover {
  background: var(--bg-soft, #f3f4f6);
}

.chat-ad-dropdown-options li.selected {
  color: var(--primary, #5b21b6);
  background: var(--primary-light, rgba(91, 33, 182, 0.09));
}

.chat-ad-dropdown-options li > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-ad-dropdown-options input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary, #5b21b6);
}

.chat-ad-dropdown-empty {
  color: var(--text-muted, #64748b) !important;
  cursor: default !important;
}

.chat-ad-dropdown-footer {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  padding-top: 6px;
}

.chat-ad-dropdown-footer .action-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
}

.chat-ad-filter-modal__footer {
  position: sticky;
  bottom: 0;
  z-index: 260;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 76px;
  padding: 16px 28px;
  box-sizing: border-box;
  background: var(--bg-white, #fff);
  border-top: 1px solid var(--border, #e9ecef);
  box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.035);
}

.chat-ad-filter-modal__footer .action-btn {
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
  min-width: 132px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
}

html.dark-theme #filters-tab .sidebar-global-msg-search-input {
  background: var(--bg-soft-2, #1e293b);
  border-color: var(--border, #334155);
  color: var(--text-main, #f1f5f9);
}

html.dark-theme .chat-ad-filter-modal {
  background: rgba(0, 0, 0, 0.72);
}

html.dark-theme .chat-ad-filter-modal__dialog {
  background: var(--bg-elevated, #111827);
  border-color: var(--border, #374151);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.58);
}

html.dark-theme .chat-ad-filter-modal__header,
html.dark-theme .chat-ad-filter-modal__footer,
html.dark-theme .chat-ad-dropdown-panel {
  background: var(--bg-elevated, #111827);
  border-color: var(--border, #374151);
}

html.dark-theme .chat-ad-filter-modal__footer {
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.16);
}

html.dark-theme .chat-ad-dropdown-toggle,
html.dark-theme .chat-ad-dropdown-search {
  background: var(--bg-soft-2, #1e293b);
  border-color: var(--border-strong, #475569);
  color: var(--text-main, #f1f5f9);
}

html.dark-theme .chat-ad-dropdown-toggle:hover,
html.dark-theme .chat-ad-dropdown-options li:hover {
  background: var(--bg-soft-3, #273449);
}

@media (max-width: 900px) {
  .chat-ad-filter-modal__grid,
  .chat-ad-filter-general {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .chat-ad-filter-modal {
    align-items: stretch;
    padding: 0;
  }

  .chat-ad-filter-modal__dialog {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .chat-ad-filter-modal__header {
    min-height: 64px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  }

  .chat-ad-filter-modal__title {
    font-size: 20px;
  }

  .chat-ad-filter-modal__body {
    padding: 20px 16px 24px;
    scrollbar-gutter: auto;
  }

  .chat-ad-filter-modal__section + .chat-ad-filter-modal__section {
    margin-top: 24px;
    padding-top: 24px;
  }

  .chat-ad-filter-modal__section-title {
    margin-bottom: 16px;
    font-size: 17px;
  }

  .chat-ad-filter-modal__grid,
  .chat-ad-filter-general {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .chat-ad-filter-general {
    margin-top: 16px;
  }

  .chat-ad-dropdown-toggle {
    min-height: 48px;
    font-size: 16px;
  }

  .chat-ad-dropdown-search {
    font-size: 16px;
  }

  .chat-ad-dropdown-panel {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: min(360px, 48dvh);
    margin-top: 6px;
  }

  .chat-ad-dropdown-options li {
    min-height: 44px;
    font-size: 14px;
  }

  .chat-ad-dropdown-footer .action-btn {
    min-height: 44px;
  }

  .chat-ad-filter-modal__footer {
    min-height: calc(76px + env(safe-area-inset-bottom));
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .chat-ad-filter-modal__footer .action-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    padding-inline: 12px;
  }

  body.chat-ad-filter-modal-open .crm-drp-panel {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-ad-filter-modal__dialog {
    animation: none;
  }
}
