:root {
  --primary-color: #2196F3;
  --secondary-color: #4CAF50;
  --background-color: #f8f9fa;
  --text-color: #2c3e50;
  --border-color: #e9ecef;
  --hover-color: #e3eaff;
  --shadow-color: rgba(0, 0, 0, 0.08);
  --bg: #f4f4f7;
  --card: #ffffff;
  --text: #111;
  --gray: #666;
  --accent: #2ecc71;
  --btn-bg: #e1e1e8;
  --popup-bg: rgba(0,0,0,0.3);
  --text-light: #888;
  --bg-chip: #e8f0fe;
  --gradient-primary: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  --gradient-success: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  --border: #ddd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px 0;
  line-height: 1.6;
}

body.auth-mode {
  background: #f5f7fa;
  padding: 0 !important;
}

/* Шапка */
.header {
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07) !important;
  border-radius: 16px 16px 0 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  max-width: 800px !important;
  width: calc(100% - 40px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 36px;
}

.logo-text {
  font-size: 1.2em !important;
  font-weight: bold !important;
  color: #222 !important;
  letter-spacing: 0.5px !important;
}

.header-center {
  font-size: 1.15em;
  color: #4caf50;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.balance-icon {
  font-size: 1.0em !important;
}

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

.icon-btn {
  background: #f5f5f5 !important;
  border: none !important;
  border-radius: 50% !important;
  width: 28px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 0.9em !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
}

.icon-btn:hover {
  background: #e3eaff;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-icon {
  font-size: 0.9em !important;
}

.user-badge-btn {
  background: #f5f5f5 !important;
  border: none !important;
  border-radius: 20px !important;
  height: 28px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: background 0.2s !important;
  padding: 0 12px !important;
  min-width: 44px !important;
}

.user-badge-btn:hover {
  background: #e3eaff !important;
}

.user-badge {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #2196F3 !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
  transition: color 0.2s !important;
}

/* Стили для PRO статуса */
.user-badge-btn[data-status="PRO"] {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%) !important;
  border: 1px solid #333 !important;
}

.user-badge-btn[data-status="PRO"]:hover {
  background: linear-gradient(135deg, #2a2a2a 0%, #3d3d3d 50%, #2a2a2a 100%) !important;
  border: 1px solid #444 !important;
}

.user-badge-btn[data-status="PRO"] .user-badge {
  color: #c0c0c0 !important;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.2) !important;
}

/* Вкладки */
.tabs {
  display: flex;
  background: white;
  border-radius: 0 0 8px 8px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  max-width: 800px;
  width: calc(100% - 40px);
  margin-left: auto;
  margin-right: auto;
}

.tab {
  flex: 1;
  padding: 16px 0;
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 1.1em;
  color: var(--gray);
  transition: all 0.2s;
  position: relative;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.tab:focus {
  outline: none;
}

.tab:focus-visible {
  outline: none;
}

.tab.active {
  color: #222 !important;
  font-weight: 600 !important;
  border-bottom: 2.5px solid #2ecc71 !important;
  background: #fff !important;
  border-radius: 0 0 12px 12px !important;
}

/* Ensure no rounding on non-active tabs if they happen to inherit */
.tabs .tab {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Ensure main sections inherit the bottom border-radius of the tabs container */
main > section {
  margin: 16px auto;
  max-width: 800px;
  width: calc(100% - 40px);
  box-sizing: border-box;
  background: var(--card);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.section {
  display: none;
  padding: 20px;
}

.section.active {
  display: block;
}

#feed.section {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.section h2 {
  margin-top: 0;
  font-size: 22px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.section p {
  color: var(--gray);
  line-height: 1.5;
  margin-bottom: 15px;
}

.filters {
  padding-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.tag {
  padding: 8px 14px;
  background: var(--bg-chip);
  border-radius: 18px;
  font-size: 14px;
  color: #1a73e8;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.tag.add-filter {
  background: #f5f5f5;
  color: #666;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.tag.add-filter:hover {
  background: #e8e8e8;
}

.tag.long-press {
  background: linear-gradient(90deg, #4caf50 0%, #81c784 100%);
  color: #fff;
  transition: background 0.5s, color 0.5s;
  position: relative;
  cursor: default !important;
}

.tag.long-press::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: rgba(76,175,80,0.25);
  z-index: 1;
  border-radius: 16px;
  animation: tag-fill-progress 2s linear forwards;
}

@keyframes tag-fill-progress {
  from { width: 0%; }
  to { width: 100%; }
}

.tag.long-press * { position: relative; z-index: 2; }
.tag.long-press:hover { cursor: default !important; }

.tag.active-campaign {
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(67,233,123,0.08);
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 30%;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px var(--shadow-color);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}

.crm-card {
  padding: 12px;
  margin-bottom: 12px;
  font-size: 0.9em;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.message-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-info {
  flex-grow: 1;
}

.message-similarity {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 0.8rem;
  color: #222;
  border-radius: 12px;
  box-shadow: 0 0 4px rgba(0,0,0,0.15);
  background: #888; /* fallback */
  backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-author {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.name {
  font-weight: 600;
  color: var(--text);
  font-size: 1.1em;
}

.username {
  color: var(--gray);
  font-size: 0.9em;
}

.message-source {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray);
  font-size: 0.9em;
  margin-top: 4px;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray);
  font-size: 0.9em;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg-chip);
  color: var(--primary-color);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}

.link-btn:hover {
  background: var(--hover-color);
}

/* Модальные окна */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal-content {
  position: relative;
  background: white;
  width: 90%;
  max-width: 600px;
  margin: 40px auto;
  padding: 24px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.close {
  position: absolute;
  right: 24px;
  top: 24px;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary-color);
  outline: none;
}

.input-with-button {
  position: relative;
}

.btn-auto-fill {
  background-color: #4CAF50;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.btn-auto-fill:hover:not(:disabled) {
  background-color: #45a049;
}

.btn-auto-fill:disabled {
  background-color: #cccccc;
  cursor: not-allowed;
  opacity: 0.7;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-primary, .btn-secondary, .btn-danger.delete-campaign-btn {
  font-size: 15px;
  padding: 7px 18px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  background: #f9f9f9;
  color: #222;
  box-shadow: none;
  transition: background 0.2s, color 0.2s, border 0.2s;
  font-weight: 500;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.btn-primary {
  background: #fff;
  color: #2196F3;
  border: 1px solid #2196F3;
}
.btn-primary:hover {
  background: #e3eaff;
  color: #1976D2;
  border: 1px solid #1976D2;
}
.btn-secondary {
  background: #fff;
  color: #888;
  border: 1px solid #e0e0e0;
}
.btn-secondary:hover {
  background: #f5f5f5;
  color: #222;
}
.btn-danger.delete-campaign-btn {
  background: #fff;
  color: #f44336;
  border: 1px solid #f44336;
  border-radius: 10px;
  font-size: 14px;
  padding: 5px 14px;
  min-width: 0;
  min-height: 0;
  height: 32px;
  line-height: 1.2;
  box-shadow: none;
  margin-left: 0;
  transition: background 0.2s, color 0.2s, border 0.2s;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.btn-danger.delete-campaign-btn:active,
.btn-danger.delete-campaign-btn:focus {
  background: #fff;
  color: #d32f2f;
  border: 1px solid #d32f2f;
}
.delete-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #f44336 0%, #ffbdbd 100%);
  transition: width 0.04s linear;
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}

/* Уведомления */
.notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px var(--shadow-color);
  z-index: 1000;
  animation: slideIn 0.3s ease-in-out;
}

.notification.error {
  background: #ffebee;
  color: #c62828;
}

.notification.success {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .header-content {
    padding: 12px 16px;
  }

  .tabs {
    padding: 4px;
    gap: 8px;
  }

  .tab {
    padding: 8px 16px;
    font-size: 0.9em;
  }

  .message-meta {
    flex-wrap: wrap;
    gap: 12px;
  }

  .actions {
    gap: 8px;
  }

  .btn-action {
    padding: 8px 16px;
    font-size: 0.85em;
  }
}

.message-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--gray);
  align-items: flex-start;
}

.source-info {
  font-size: 13px;
  color: var(--gray);
  text-align: left;
  width: 100%;
}

.source-icon {
  font-size: 14px;
}

.source-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.channel-tag {
  font-size: 12px;
  color: #999;
  margin-left: 20px;
}

.message-content {
  margin: 12px 0;
}

.message-content p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.message-content mark {
  background: linear-gradient(
    -100deg,
    hsl(120deg 40% 80% / 25%),
    hsl(120deg 40% 80% / 50%) 95%,
    hsl(120deg 40% 80% / 40%)
  );
  border-radius: 0.7em 0;
  padding: 0 0.2em 0.2em;
}

.message-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #888;
  font-size: 13px;
  margin: 12px 0;
}

.meta-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
}

.message-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.source-link {
  color: #999;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s ease;
  display: block;
  margin-top: 2px;
  align-self: flex-start;
}

.source-link:hover {
  color: #666;
  text-decoration: underline;
}

.message-reactions {
  display: flex;
  gap: 8px;
  margin: 12px 0;
  flex-wrap: wrap;
}

.reaction {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--btn-bg);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.reaction:hover {
  background: #d1d1d8;
}

.reaction.selected {
  background: #e3eaff;
  color: #1a73e8;
}

.reaction.selected .reaction-count {
  color: #1a73e8;
}

.reaction-count {
  font-size: 13px;
  color: var(--gray);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}

.btn-action {
  flex: 1;
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.btn-action.source {
  background: #1a73e8;
  color: white;
}

.btn-action.source:hover {
  background: #1557b0;
}

.btn-action.source:active {
  background: #0d47a1;
}

.source { background: #dbe8ff; color: #1a73e8; }
.direct { background: #e8f0fe; color: #1a73e8; }
.yes { background: #d5f8df; color: #2d8a4a; }
.no { background: #e2e2e2; color: #555; }

.reply-field {
  margin-top: 16px;
  display: none;
}

.reply-field textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  background: #f8f9fa;
}

.reply-field textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.reply-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.btn-send {
  padding: 8px 20px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.btn-send:hover {
  background: #1557b0;
}

.btn-generate {
  padding: 8px 20px;
  background: #f8f9fa;
  color: #1a73e8;
  border: 1px solid #1a73e8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.btn-generate:hover {
  background: #e8f0fe;
}

/* Popups */
.popup-overlay, .popup-overlay-account, .popup-overlay-teams, .popup-overlay-edit-team, .popup-overlay-campaign, .popup-overlay-help, .popup-overlay-user {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--popup-bg);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.popup h3 {
  margin: 0 0 20px 0;
  font-size: 20px;
  color: var(--text);
}

.popup .popup-content {
  margin-bottom: 24px;
}

.popup label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-weight: 500;
}

.popup select,
.popup input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}

.popup input[type="text"]:focus,
.popup select:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.popup .color-picker {
  margin-bottom: 16px;
}

.popup-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.popup-buttons button {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.popup-buttons button:hover {
  transform: translateY(-1px);
}

.popup .btn.secondary {
  background: #f8f9fa;
  color: #1a73e8;
  border: 1px solid #1a73e8;
}

.popup .btn.secondary:hover {
  background: #e8f0fe;
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray);
  padding: 4px;
  line-height: 1;
}

.popup-close:hover {
  color: var(--text);
}

/* Placeholder */
.placeholder {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
  font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .header, .tabs, .section {
    width: calc(100% - 20px) !important;
  }

  .header {
    border-radius: 12px 12px 0 0 !important;
  }

  .tabs {
    border-radius: 0 0 8px 8px;
  }

  .tab {
    padding: 12px 0;
    font-size: 1em;
  }

  .section h2 {
    font-size: 20px;
    margin-bottom: 16px;
  }

  .filters {
    gap: 8px;
    margin-bottom: 12px;
  }

  .tag {
    padding: 6px 12px;
    font-size: 13px;
  }

  .feed {
    gap: 12px;
  }

  .message-header {
    gap: 12px;
  }

  .avatar {
    width: 40px;
    height: 40px;
  }

  .name {
    font-size: 15px;
  }

  .username {
    font-size: 13px;
  }

  .message-content p {
    font-size: 14px;
  }

  .message-meta {
    gap: 12px;
    font-size: 12px;
  }

  .actions {
    gap: 6px;
  }

  .btn-action {
    padding: 6px 12px;
    font-size: 13px;
  }

  .reply-field {
    margin-top: 12px;
  }

  .reply-field textarea {
    min-height: 60px;
    padding: 10px;
    font-size: 13px;
  }

  .reply-actions {
    gap: 6px;
  }

  .btn-send, .btn-generate {
    padding: 6px 16px;
    font-size: 13px;
  }

  .popup {
    padding: 20px;
    width: 95%;
  }

  .popup h3 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .popup label {
    font-size: 14px;
  }

  .popup select,
  .popup input[type="text"] {
    padding: 8px;
    font-size: 13px;
  }

  .popup .color-picker {
    margin-bottom: 12px;
  }

  .popup-buttons {
    gap: 8px;
  }

  .popup-buttons button {
    padding: 8px 16px;
    font-size: 13px;
  }

  .popup-close {
    top: 12px;
    right: 12px;
    font-size: 18px;
  }
}

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

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Loading states */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #1a73e8;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 101;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Error states */
.error {
  color: #d93025;
  font-size: 14px;
  margin-top: 8px;
}

.error-icon {
  color: #d93025;
  margin-right: 4px;
}

/* Success states */
.success {
  color: #2d8a4a;
  font-size: 14px;
  margin-top: 8px;
}

.success-icon {
  color: #2d8a4a;
  margin-right: 4px;
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
  pointer-events: none;
  z-index: 1000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-8px);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Selection */
::selection {
  background: rgba(26, 115, 232, 0.2);
  color: var(--text);
}

/* Focus styles */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid #1a73e8;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .header,
  .tabs,
  .actions,
  .popup-overlay,
  .popup-overlay-account,
  .popup-overlay-teams,
  .popup-overlay-edit-team,
  .popup-overlay-campaign,
  .popup-overlay-help,
  .popup-overlay-user {
    display: none !important;
  }

  .section {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: none !important;
    box-shadow: none !important;
  }

  body {
    background: white !important;
  }
}

/* Стили для виджета создания кампании справа */
#campaign-settings-modal.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    border-radius: 24px 0 0 24px;
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    transform: translateX(100%);
    overflow-y: auto;
}
#campaign-settings-modal.modal[style*="display: block"] {
    display: block;
    transform: translateX(0);
}
#campaign-settings-modal .modal-content {
    border-radius: 24px 0 0 24px;
    padding: 32px 28px 24px 28px;
    box-shadow: none;
    background: none;
}
#campaign-settings-modal .close {
    position: absolute;
    top: 18px;
    right: 24px;
    font-size: 28px;
    color: #888;
    cursor: pointer;
    z-index: 10;
}
@media (max-width: 600px) {
  #campaign-settings-modal.modal {
    width: 100vw;
    border-radius: 0;
  }
  #campaign-settings-modal .modal-content {
    border-radius: 0;
    padding: 18px 8px 12px 8px;
  }
}

/* === Slider styles === */

/* Slider container */
.campaign-settings .form-group .precision-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  width: 100%;
}

/* Value text */
.campaign-settings .form-group .precision-display {
  font-weight: 600;
  color: #1c1c1e;
  font-size: 15px;
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Slider */
.campaign-settings .form-group .precision-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 15px;
  width: 100%;
  background: transparent;
  outline: none;
  border-radius: 999px;
  border: none;
  margin: 0;
  padding: 0;
  cursor: pointer;
  flex: 1;
  accent-color: #1a73e8;
  transition: background 0.3s ease;
}

/* Track */
.campaign-settings .form-group .precision-slider::-webkit-slider-runnable-track {
  height: 15px;
  border-radius: 999px;
  border: none;
  background: transparent;
  box-shadow: inset 0 1px 2px rgba(149, 135, 135, 0.2)
}
.campaign-settings .form-group .precision-slider::-moz-range-track {
  height: 15px;
  border-radius: 999px;
  border: none;
  background: #e4e4e4;
  box-shadow: inset 0 1px 2px rgba(149, 135, 135, 0.2)
}

/* Thumb */
.campaign-settings .form-group .precision-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 5px inset #1a73e8;
  cursor: pointer;
  margin-top: -7.5px; /* (30 - 15) / 2 = 7.5 */
  transition: 300ms;
}
.campaign-settings .form-group .precision-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  border: none;
  box-shadow: 0 0 0 5px inset #1a73e8;
  transition: 300ms;
}

/* Hover and focus */
.campaign-settings .form-group .precision-control:focus-within,
.campaign-settings .form-group .precision-slider:focus-visible {
  outline: none;
  outline-offset: 10px;
}
.campaign-settings .form-group .precision-slider:hover::-webkit-slider-thumb,
.campaign-settings .form-group .precision-slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 10px inset #1a73e8;
}
.campaign-settings .form-group .precision-slider:hover::-moz-range-thumb,
.campaign-settings .form-group .precision-slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 10px inset #1a73e8;
}

.campaign-settings .form-group .precision-slider:active::-webkit-slider-thumb {
  box-shadow: 0 0 0 30px inset #1a73e8;
}
.campaign-settings .form-group .precision-slider:active::-moz-range-thumb {
  box-shadow: 0 0 0 30px inset #1a73e8;
}

.campaign-settings .form-group .precision-slider:disabled::-webkit-slider-thumb {
  box-shadow: 0 0 0 30px inset #a0a0a0;
}
.campaign-settings .form-group .precision-slider:disabled::-moz-range-thumb {
  box-shadow: 0 0 0 30px inset #a0a0a0;
}

/* Стили для подсказок об ошибках под полями формы */
.form-error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: -10px;
  display: block;
}

/* Убираю стандартную подсветку */
.form-group input:invalid,
.form-group textarea:invalid,
.form-group select:invalid {
  border-color: #ddd;
  background: #fff;
}

/* Подсветка только если форма содержит класс .was-validated */
.was-validated input:invalid,
.was-validated textarea:invalid,
.was-validated select:invalid {
  border-color: #f44336;
  background: #fff0f0;
}

/* Модальное окно логина */
#login-modal {
  position: fixed;
  z-index: 10000;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal-content {
  background: #fff;
  border-radius: 16px;
  padding: 32px 32px 24px 32px;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
#login-form .form-group {
  margin-bottom: 18px;
}
#login-form label {
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}
#login-form input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
  margin-top: 2px;
}
#login-form .btn-primary {
  width: 100%;
  margin-top: 8px;
}
#login-error.form-error {
  color: #d32f2f;
  margin-top: 10px;
  text-align: center;
  display: block;
}

/* LeadBurn Auth Page (light theme) */
#auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f5f7fa;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
}
.auth-container {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.10);
  padding: 40px 36px 32px 36px;
  min-width: 340px;
  max-width: 360px;
  margin: 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-emoji {
  font-size: 3.2em;
  margin-bottom: 12px;
  text-align: center;
}
.auth-title {
  font-size: 1.5em;
  font-weight: 700;
  margin-bottom: 18px;
  color: #222;
  text-align: center;
}
.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-form label {
  font-weight: 500;
  color: #444;
  margin-bottom: 4px;
}
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1em;
  background: #fafbfc;
  transition: border 0.2s;
}
.auth-form input:focus {
  border: 1.5px solid #2196f3;
  outline: none;
}
.btn-auth-primary {
  background: #2196f3;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 0;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}
.btn-auth-primary:hover {
  background: #1769aa;
}
.auth-links {
  margin-top: 8px;
  text-align: right;
  width: 100%;
}
.auth-links a {
  color: #2196f3;
  text-decoration: none;
  font-size: 0.98em;
}
.auth-links a:hover {
  text-decoration: underline;
}
.auth-bottom {
  margin-top: 18px;
  font-size: 1em;
  color: #666;
  text-align: center;
}
.auth-bottom a {
  color: #2196f3;
  text-decoration: none;
  font-weight: 500;
}
.auth-bottom a:hover {
  text-decoration: underline;
}
.form-error {
  color: #f44336;
  background: #fff0f0;
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 0.98em;
  text-align: center;
  display: none;
}
/* Убрать Telegram-авторизацию и лишние элементы */
.auth-form .tg-auth, .auth-form .tg-btn, .auth-form .tg-avatar, .auth-form .tg-label {
  display: none !important;
}

/* --- ВОССТАНОВЛЕННЫЕ СТИЛИ ДЛЯ ВИДЖЕТА КАМПАНИИ СЛЕВА --- */
.campaigns-manager {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.campaign-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.campaigns-manager, .campaign-settings {
  transition: opacity 0.3s ease;
  position: static;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  height: auto;
  z-index: 1;
  opacity: 1;
}

.campaigns-manager.hidden, .campaign-settings.hidden {
  display: none !important;
  opacity: 0 !important;
}

.campaigns-manager.visible, .campaign-settings.visible {
  display: block !important;
  opacity: 1 !important;
}

/* Удаляем/переопределяем модальные стили */
#campaign-settings-modal, #campaign-settings-modal.modal, .modal, .modal-content {
  /* display: none !important; */
  /* position: static !important; */
  /* width: auto !important; */
  /* max-width: none !important; */
  /* height: auto !important; */
  /* background: none !important; */
  /* box-shadow: none !important; */
  /* border-radius: 0 !important; */
  /* z-index: 1 !important; */
  /* padding: 0 !important; */
}

/* Удаляю стили видимости для .campaigns-manager/.campaign-settings */
.campaigns-manager.visible, .campaign-settings.visible,
.campaigns-manager.hidden, .campaign-settings.hidden {
  /* display: unset !important; */
  /* opacity: unset !important; */
}

/* Боковая панель настроек кампаний */
.campaigns-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 400px;
  background: #fff;
  box-shadow: 2px 0 16px rgba(0,0,0,0.1);
  z-index: 1000;
  padding: 0;
  overflow-y: auto;
  display: none;
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

.campaigns-sidebar.show {
  display: block;
  transform: translateX(0);
}

/* Стиль подсказок в боковой панели */
.form-hint {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-style: italic;
    opacity: 0.95;
}

/* Адаптация основного контента */
body.sidebar-visible {
  margin-left: 400px;
  transition: margin-left 0.3s ease-in-out;
}

/* Заголовок настроек */
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 20px;
}

.settings-header h2 {
  margin: 0;
  font-size: 1.3em;
  color: #333;
}

.close-settings-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close-settings-btn:hover {
  background: #f0f0f0;
}

/* Содержимое настроек */
.campaign-settings {
  padding: 0 20px 20px;
}

/* Стили для тегов кампаний */
.tag {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Синий градиент по умолчанию */
  color: white;
  border: none !important; /* Убираем черную обводку */
  border-radius: 20px;
  padding: 8px 16px;
  margin: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  outline: none;
  user-select: none;
}

.tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tag.active {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%); /* Зеленый градиент для выбранной */
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.tag.add-filter {
  background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
  color: #666;
  border: none !important;
  border-radius: 20px;
}

.tag.add-filter:hover {
  background: linear-gradient(135deg, #d5d5d5 0%, #a8a8a8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Прогресс-бар для зажатия кнопки кампании */
.tag .hold-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.8);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 0 20px 20px;
}

.tag.holding .hold-progress {
  background: linear-gradient(90deg, #FFD700 0%, #FFA500 100%);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Стили для кнопки удаления кампании */
.delete-campaign-btn {
  position: relative;
  overflow: hidden;
  border: none !important;
}

.delete-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff4444 0%, #cc0000 100%);
  width: 0%;
  transition: width 0.1s linear;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

.delete-campaign-btn.holding .delete-progress {
  animation: deleteGlow 0.5s ease-in-out infinite alternate;
}

@keyframes deleteGlow {
  from { box-shadow: 0 0 8px rgba(255, 68, 68, 0.5); }
  to { box-shadow: 0 0 16px rgba(255, 68, 68, 0.8); }
}

/* Удален дублирующий стиль для campaigns-manager */

.campaign-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.campaign-item {
  padding: 12px;
  background: #f5f7fa;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.campaign-item:hover {
  background: #e3eaff;
}

.campaign-name {
  font-weight: 500;
  margin-bottom: 4px;
}

.campaign-status {
  font-size: 0.9em;
  color: #666;
}

.empty-state {
  text-align: center;
  padding: 20px;
  color: #666;
}

.add-filter {
  background: #2196F3;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.add-filter:hover {
  background: #1976D2;
}

.plus {
  font-size: 1.2em;
  font-weight: bold;
}

#campaign-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* Удалены дублирующие стили для campaigns-manager и campaign-settings */

@media (max-width: 768px) {
  .campaigns-sidebar {
    width: 100%;
  }
}

.btn-danger.delete-campaign-btn {
  background: #fff;
  color: #f44336;
  border: 1px solid #f44336;
  border-radius: 10px;
  font-size: 14px;
  padding: 5px 14px;
  min-width: 0;
  min-height: 0;
  height: 32px;
  line-height: 1.2;
  box-shadow: none;
  margin-left: 0;
  transition: background 0.2s, color 0.2s, border 0.2s;
  position: relative;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.btn-danger.delete-campaign-btn:active,
.btn-danger.delete-campaign-btn:focus {
  background: #fff;
  color: #d32f2f;
  border: 1px solid #d32f2f;
}
.delete-progress {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 3px;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #f44336 0%, #ffbdbd 100%);
  transition: width 0.04s linear;
  border-radius: 2px;
  z-index: 2;
  pointer-events: none;
}

#generate-campaign-settings-btn {
    width: 100%;
    padding: 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    margin-bottom: 16px;
}

#generate-campaign-settings-btn:hover {
    background: #1976D2;
}

#generate-campaign-settings-btn:active {
    background: #1565C0;
}

#generate-campaign-settings-btn:disabled {
    background: #BDBDBD;
    cursor: not-allowed;
    opacity: 0.7;
}

#generate-campaign-settings-btn.loading {
    position: relative;
    color: transparent;
}

#generate-campaign-settings-btn.loading::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: button-loading-spinner 0.8s linear infinite;
}

@keyframes button-loading-spinner {
    from {
        transform: rotate(0turn);
    }
    to {
        transform: rotate(1turn);
    }
}

/* Toast уведомления */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    max-width: 350px;
    word-wrap: break-word;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    border-left: 4px solid #e0e0e0;
}

.toast.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left-color: #4caf50;
}

.toast.error {
    background: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.toast.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left-color: #2196f3;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    #toast-container {
        left: 20px;
        right: 20px;
        top: auto;
        bottom: 20px;
    }

    .toast {
        max-width: none;
    }
}

/* Стили для умной ленты с score */
.smart-score {
  margin-left: auto;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48cae4 100%);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.score-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.score-badge:hover::before {
  left: 100%;
}

.score-badge:hover {
  background: linear-gradient(135deg, #ff5252 0%, #ffc107 50%, #2196f3 100%);
  transform: scale(1.1) rotate(2deg);
  box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
}

.score-details {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 10;
  min-width: 200px;
  margin-top: 4px;
}

.score-item {
  padding: 2px 0;
  font-size: 11px;
  color: #666;
}

.message-header {
  position: relative;
}

.link-btn {
  background: #2196F3;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  margin-left: 8px;
}

.link-btn:hover {
  background: #1976D2;
}

@media (max-width: 768px) {
  .campaigns-sidebar {
    width: 100%;
  }
}





@media (max-width: 768px) {
    .actions {
        gap: 6px;
        width: 100%;
    }

    .btn-action {
        flex: 1;
        padding: 5px 12px;
        font-size: 13px;
        border-radius: 6px;
        text-align: center;
    }
}

/* Система эмодзи */
.emoji-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    position: relative;
}

.emoji-toggle {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1.2em;
    cursor: pointer;
    padding: 6px 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.emoji-toggle:hover {
    background: #f5f5f5;
    border-color: #007BFF;
}

.emoji-panel {
    display: none;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    top: 40px;
    left: 0;
    min-width: 280px;
}

.emoji-panel.show {
    display: block;
}

.emoji-list {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
}

.emoji {
    cursor: pointer;
    padding: 6px;
    text-align: center;
    border-radius: 4px;
    font-size: 1.2em;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.emoji:hover {
    background: #f0f8ff;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .emoji-list {
        grid-template-columns: repeat(6, 1fr);
    }

    .emoji-panel {
        min-width: 240px;
    }
}

/* Стили для полного скрытия наблюдателя ленивой загрузки */
#lazy-sentinel {
    display: block;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

/* Стили для индикатора загрузки бесконечной прокрутки */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeInUp 0.3s ease-out;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #2196F3;
    border-radius: 50%;
    animation: spinner-rotation 0.8s linear infinite;
    margin-bottom: 12px;
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
    font-style: normal;
    color: #666;
    text-align: center;
}

@keyframes spinner-rotation {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .loading-indicator {
        padding: 16px;
        margin: 16px 0;
    }

    .loading-spinner {
        width: 24px;
        height: 24px;
        border-width: 2px;
        margin-bottom: 8px;
    }

    .loading-text {
        font-size: 13px;
    }
}

/* CRM Styles */
.crm-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  gap: 24px;
}

.campaign-select-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.campaign-select-container label {
  font-weight: 500;
  color: #4a4a4a;
}

.campaign-select {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: white;
  font-size: 14px;
  min-width: 200px;
}

.view-toggle {
  display: flex;
  gap: 8px;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.view-btn:hover {
  background: #f5f5f5;
}

.view-btn.active {
  background: #2196f3;
  color: white;
  border-color: #2196f3;
}

/* CRM Table View */
.crm-table {
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.crm-table-header {
  display: none;
}

.crm-table-body {
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crm-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f2;
  transition: all 0.2s ease;
  display: flex;
  gap: 16px;
  font-size: 0.9em;
  cursor: pointer;
}

/* Стили для редактируемых названий карточек */
.editable-name {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  transition: all 0.2s;
  display: inline-block;
  min-width: 100px;
}

.editable-name:hover {
  background: rgba(33, 150, 243, 0.1);
  color: #1976d2;
}

.crm-card-main {
  flex: 1;
}

.crm-card-sidebar {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  padding-top: 4px;
}

.crm-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.crm-status-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.contact-info,
.last-contact-info {
  font-size: 12px;
  color: #757575;
  background: #f5f5f5;
  padding: 4px 8px;
  border-radius: 8px;
}

.crm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stage-selector {
  padding: 6px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.stage-selector:hover {
  border-color: #2196f3;
}

.stage-selector:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.stage-badge {
  padding: 4px 8px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.stage-badge.новое { background: #e3f2fd; color: #1976d2; }
.stage-badge.первое_касание { background: #f3e5f5; color: #7b1fa2; }
.stage-badge.идет_диалог { background: #fff3e0; color: #f57c00; }
.stage-badge.результат { background: #ffebee; color: #d32f2f; }

/* Стили для кастомных этапов */
.stage-badge:not(.новое):not(.первое_касание):not(.идет_диалог):not(.результат) {
  background: #e8f5e8;
  color: #4caf50;
}

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

.status-badge.активно { background: #e8f5e8; color: #388e3c; }
.status-badge.закрыто { background: #ffebee; color: #d32f2f; }
.status-badge.архив { background: #f5f5f5; color: #757575; }

.contact-count {
  background: #e3f2fd;
  color: #1976d2;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  min-width: 24px;
  text-align: center;
}

.last-contact {
  font-size: 12px;
  color: #757575;
}

.crm-actions {
  display: flex;
  gap: 4px;
}

.crm-action-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.crm-action-btn.edit {
  background: #e3f2fd;
  color: #1976d2;
}

.crm-action-btn.edit:hover {
  background: #bbdefb;
}

.crm-action-btn.delete {
  background: #ffebee;
  color: #d32f2f;
}

.crm-action-btn.delete:hover {
  background: #ffcdd2;
}

/* CRM Delete Button with Hold Progress */
.crm-delete-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.crm-delete-btn .delete-text {
  position: relative;
  z-index: 2;
  display: block;
  transition: transform 0.2s ease;
}

.crm-delete-btn .delete-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff5252, #f44336);
  transition: width 0.1s ease;
  z-index: 1;
}

.crm-delete-btn.holding {
  background: #ffebee;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.crm-delete-btn.holding .delete-text {
  transform: scale(1.1);
  animation: deleteShake 0.1s infinite alternate;
}

.crm-delete-btn.holding .delete-progress {
  animation: deleteGlow 0.5s ease-in-out infinite alternate;
}

@keyframes deleteShake {
  0% { transform: scale(1.1) translateX(0); }
  100% { transform: scale(1.1) translateX(1px); }
}

@keyframes deleteGlow {
  0% { box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.3); }
  100% { box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.6); }
}

.crm-action-btn.edit {
  background: #e3f2fd;
  color: #1976d2;
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.crm-action-btn.edit:hover {
  background: #bbdefb;
}

.source-link {
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s;
}

/* Kanban View */
.kanban-board {
  display: flex;
  gap: 16px;
  min-height: 600px;
  overflow-x: auto;
  padding: 8px 0;
}

.kanban-column {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 16px;
  min-height: 500px;
  width: 280px;
  flex-shrink: 0;
}

.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
}

.kanban-header h3 {
  margin: 0;
  font-size: 16px;
  color: #4a4a4a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stage-count {
  background: #2196f3;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}

.kanban-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
}

.kanban-card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid #2196f3;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.kanban-card.новое { border-left-color: #1976d2; }
.kanban-card.первое_касание { border-left-color: #7b1fa2; }
.kanban-card.идет_диалог { border-left-color: #f57c00; }
.kanban-card.успех { border-left-color: #4caf50; }
.kanban-card.провал { border-left-color: #ff9800; }

/* Цвета для кастомных этапов */
.kanban-card:not(.новое):not(.первое_касание):not(.идет_диалог):not(.успех):not(.провал) {
  border-left-color: #9c27b0;
}

.kanban-card-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0f0f0;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  color: #333;
  display: block;
}

.kanban-card-text {
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 8px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-meta {
  font-size: 11px;
  color: #999;
  border-top: 1px solid #f0f0f0;
  padding-top: 8px;
  margin-top: 8px;
}

.kanban-card-contacts {
  color: #2196f3;
  font-weight: 500;
}

.kanban-card-date {
  color: #999;
}

.add-stage-column {
  min-width: 250px;
  padding: 16px;
  text-align: center;
}

.add-stage-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border: 2px dashed #e0e0e0;
  background: transparent;
  color: #666;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.add-stage-btn:hover {
  border-color: #2196f3;
  color: #2196f3;
  background: #f8faff;
}

.add-stage-btn span {
  font-size: 16px;
}

.delete-stage-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s;
}

.delete-stage-btn:hover {
  background: #cc0000;
  transform: scale(1.1);
}

#add-stage-modal .modal-content {
  max-width: 400px;
}

#add-stage-modal .form-group {
  margin-bottom: 16px;
}

#add-stage-modal label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #333;
}

#add-stage-modal input,
#add-stage-modal select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

#add-stage-modal input:focus,
#add-stage-modal select:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* Пустое состояние */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 {
  margin-bottom: 8px;
  color: #333;
}

.empty-state p {
  margin-bottom: 20px;
  color: #666;
}

.kanban-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.kanban-column.drop-zone {
  background: #f0f8ff;
}

@media (max-width: 1200px) {
  .kanban-column {
    min-width: 200px;
  }
}

/* ===========================================
   ВИДЖЕТ ПОДДЕРЖКИ И УВЕДОМЛЕНИЯ
   =========================================== */

/* Кнопка переключения виджета поддержки */
.support-toggle {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    border: none;
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.3),
        0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.support-toggle:hover {
    transform: scale(1.1);
    box-shadow:
        0 12px 40px rgba(102, 126, 234, 0.4),
        0 6px 16px rgba(0, 0, 0, 0.2);
}

.support-toggle.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Счетчик новых сообщений на кнопке поддержки */
.support-toggle .message-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
    }
}

/* Виджет поддержки */
.support-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 420px;
    max-height: 580px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.15),
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    border: 1px solid rgba(226, 232, 240, 0.6);
    z-index: 10000 !important;
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    animation: supportSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.support-widget.show {
    display: flex;
}

@keyframes supportSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px) translateX(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
}

.support-widget-header {
    padding: 24px 28px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: hidden;
}

.support-widget-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.support-widget-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.support-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.support-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.support-widget-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
}

.support-chat {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    min-height: 220px;
    padding: 0 24px 12px 24px;
    scroll-behavior: smooth;
}

.support-chat::-webkit-scrollbar {
    width: 6px;
}

.support-chat::-webkit-scrollbar-track {
    background: transparent;
}

.support-chat::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 10px;
}

.support-chat::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

.support-message {
    margin-bottom: 20px;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    animation: messageAppear 0.5s ease-out;
    max-width: 85%;
    word-wrap: break-word;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.support-message.user {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid rgba(147, 197, 253, 0.3);
    margin-left: auto;
    border-radius: 18px 18px 6px 18px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.support-message.support {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid rgba(203, 213, 225, 0.4);
    margin-right: auto;
    border-radius: 18px 18px 18px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.support-message.user .message-time,
.support-message.support .message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 8px;
    display: block;
}

.support-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 18px 18px 18px 6px;
    max-width: 100px;
    animation: messageAppear 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingDots 1.5s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDots {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.support-form {
    margin: 0;
    background: rgba(248, 250, 252, 0.8);
    padding: 24px 28px;
    border-top: 1px solid rgba(226, 232, 240, 0.4);
    backdrop-filter: blur(10px);
    position: relative;
}

.support-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: white;
    border-radius: 20px;
    padding: 6px;
    border: 2px solid transparent;
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(226, 232, 240, 0.4) inset;
    transition: all 0.4s ease;
}

.support-input-container:focus-within {
    border-color: #667eea;
    box-shadow:
        0 8px 25px rgba(102, 126, 234, 0.15),
        0 0 0 4px rgba(102, 126, 234, 0.1);
}

#support-message-input {
    flex: 1;
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 120px;
    background: transparent;
    line-height: 1.5;
    outline: none;
    color: #334155;
}

#support-message-input::placeholder {
    color: #94a3b8;
}

.support-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.4s ease;
    flex-shrink: 0;
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.support-send-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.support-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Скриншоты в чате */
.message-screenshot {
    margin-top: 12px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
    max-width: 280px;
    position: relative;
}

.message-screenshot:hover {
    transform: scale(1.02);
}

.message-screenshot img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 12px;
    max-height: 200px;
    object-fit: cover;
}

.message-screenshot::after {
    content: '🔍';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-screenshot:hover::after {
    opacity: 1;
}

/* Контролы для скриншотов */
.screenshot-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.screenshot-btn {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: #667eea;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.screenshot-btn:hover {
    background: rgba(102, 126, 234, 0.2);
}

.screenshot-preview {
    position: relative;
    margin-bottom: 12px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.screenshot-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.screenshot-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Статус подключения */
.support-status {
    padding: 12px 28px;
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    font-size: 12px;
    text-align: center;
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
}

.support-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    .support-widget {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: 80vh;
        border-radius: 16px;
    }

    .support-toggle {
        bottom: 20px !important;
        right: 20px !important;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .support-toggle .message-badge {
        top: -6px;
        right: -6px;
        min-width: 20px;
        height: 20px;
        font-size: 11px;
    }

    .support-widget-header {
        padding: 20px 24px;
        border-radius: 16px 16px 0 0;
    }

    .support-widget-header h3 {
        font-size: 16px;
    }

    .support-chat {
        padding: 20px 24px;
        min-height: 250px;
    }

    .support-form {
        padding: 20px 24px;
    }

    .support-input-container {
        border-radius: 16px;
        padding: 4px;
    }

    #support-message-input {
        padding: 12px 16px;
        border-radius: 12px;
    }

    .support-send-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
}

/* Toast уведомления - исправляем позиционирование */
#toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    color: #333;
    font-size: 14px;
    font-weight: 500;
    max-width: 350px;
    word-wrap: break-word;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    border-left: 4px solid #e0e0e0;
}

.toast.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left-color: #4caf50;
}

.toast.error {
    background: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.toast.warning {
    background: #fff3e0;
    color: #ef6c00;
    border-left-color: #ff9800;
}

.toast.info {
    background: #e3f2fd;
    color: #1565c0;
    border-left-color: #2196f3;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Модальные окна подтверждения */
.confirm-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 10001 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalAppear 0.3s ease-out;
}

.confirm-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.confirm-modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.confirm-modal-header h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #333;
}

.confirm-modal-body p {
    margin: 0 0 24px 0;
    color: #666;
    line-height: 1.5;
    white-space: pre-line;
}

.confirm-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-modal-footer .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.confirm-modal-footer .btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.confirm-modal-footer .btn-secondary:hover {
    background: #e0e0e0;
}

.confirm-modal-footer .btn-primary {
    background: #2196f3;
    color: white;
}

.confirm-modal-footer .btn-primary:hover {
    background: #1976d2;
}

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

/* Адаптивные стили */
@media (max-width: 768px) {
    .support-widget {
        bottom: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: 75vh;
    }

    #toast-container {
        left: 20px !important;
        right: 20px !important;
        top: auto !important;
        bottom: 20px !important;
    }

    .toast {
        max-width: none;
    }

    .confirm-modal-content {
        margin: 20px;
        padding: 20px;
    }
}

/* ===========================================
   ИСПРАВЛЕНИЯ ИНДИКАТОРА PULL-TO-REFRESH
   =========================================== */

.pull-to-refresh-indicator {
    position: fixed !important;
    top: -60px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 200px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0 0 12px 12px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999 !important;
    transition: transform 0.3s ease-out;
}

.pull-to-refresh-indicator.ready-to-refresh {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.refresh-spinner {
    font-size: 16px;
    display: inline-block;
}

.refresh-text {
    font-size: 13px;
}

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

/* ===========================================
   УЛУЧШЕННЫЕ СТИЛИ ДЛЯ TOAST КОНТЕЙНЕРА
   =========================================== */

#toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 10001 !important;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    background: white;
    border-radius: 8px;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.1),
        0 4px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    animation: toastSlideIn 0.3s ease-out forwards;
    min-width: 300px;
    max-width: 400px;
}

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

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    position: relative;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: #374151;
    word-wrap: break-word;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6b7280;
    transition: all 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #374151;
}

/* Адаптация для мобильных устройств */
@media (max-width: 640px) {
    #toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .pull-to-refresh-indicator {
        width: 180px;
    }
}

/* Убираем возможные конфликтующие стили */
.toast * {
    box-sizing: border-box;
}

/* ===========================================
   ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ВИДЖЕТА ПОДДЕРЖКИ
   =========================================== */

/* Стили для превью скриншотов в чате */
.screenshot-preview {
    position: absolute !important;
    bottom: 100% !important;
    left: 0 !important;
    right: 0 !important;
    margin-bottom: 10px !important;
    background: white;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 1000 !important;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screenshot-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.screenshot-thumbnail {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.screenshot-thumbnail:hover {
    transform: scale(1.05);
}

.screenshot-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.screenshot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.screenshot-thumbnail:hover .screenshot-overlay {
    opacity: 1;
}

.screenshot-info {
    flex: 1;
}

.screenshot-label {
    display: block;
    font-weight: 500;
    color: #374151;
    font-size: 13px;
}

.screenshot-size {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}

.screenshot-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.screenshot-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: scale(1.1);
}

/* Стили для интро виджета поддержки */
.support-intro {
    text-align: center;
    margin: 20px 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e7ff 100%);
    border-radius: 16px;
    border: 1px solid rgba(129, 140, 248, 0.2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.support-intro p {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #4c1d95;
    font-weight: 500;
}

.support-wiki-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.support-wiki-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    text-decoration: none;
    color: white;
}

.support-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.support-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e2e8f0 50%, transparent 100%);
}

.support-divider span {
    background: #f8fafc;
    padding: 0 16px;
    color: #64748b;
    font-size: 12px;
    position: relative;
    z-index: 1;
}

/* Подсказка для ввода */
.support-input-hint {
    text-align: center;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 11px;
}

.support-input-hint span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Состояние отправки формы */
.support-form.support-sending {
    opacity: 0.7;
    pointer-events: none;
}

.support-form.support-sending .support-input-container {
    border-color: #94a3b8;
}

/* Группировка сообщений */
.support-message-continuation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 13px;
    line-height: 1.5;
}

/* Анимация появления сообщений */
@keyframes messageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.support-message {
    animation: messageFadeIn 0.4s ease-out;
}

/* Времена сообщений */
.message-time {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    opacity: 0.6;
    font-style: italic;
}

/* Улучшение адаптивности */
@media (max-width: 480px) {
    .support-intro {
        padding: 16px;
        margin-bottom: 16px;
    }

    .support-intro p {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .support-wiki-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .support-message {
        padding: 12px 16px;
        font-size: 13px;
        max-width: 90%;
    }

    .screenshot-preview-container {
        gap: 8px;
    }

    .screenshot-thumbnail {
        width: 50px;
        height: 50px;
    }

    .screenshot-label {
        font-size: 12px;
    }

    .screenshot-size {
        font-size: 11px;
    }
}

/* ========= МЕНЕДЖЕР АККАУНТОВ ========= */

/* Заголовок и вкладки */
.accounts-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
  gap: 24px;
}

.accounts-tabs {
  display: flex;
  gap: 10px;
}

.accounts-tab {
  padding: 10px 20px;
  background: #f5f5f5;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.accounts-tab:hover {
  background: #e3f2fd;
  border-color: #2196f3;
}

.accounts-tab.active {
  background: #2196f3;
  color: white;
  border-color: #1976d2;
}

/* Контролы */
.accounts-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 15px;
}

.accounts-stats {
  display: flex;
  gap: 20px;
}

.stat-item {
  font-size: 14px;
  color: #666;
}

.stat-item span {
  font-weight: bold;
  color: #333;
}

.role-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-filter label {
  font-size: 14px;
  font-weight: 500;
}

.role-filter select {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

/* Таблицы */
.work-accounts-table,
.employees-table {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-header {
  display: grid;
  background: #f5f5f5;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
  font-size: 14px;
  color: #555;
  padding: 0;
}

.work-accounts-table .table-header {
  grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr 2fr 1fr;
}

.employees-table .table-header {
  grid-template-columns: 2fr 2fr 1.5fr 1fr 1fr 1.2fr 1.5fr;
}

.table-header > div {
  padding: 15px 10px;
  border-right: 1px solid #e0e0e0;
}

.table-header > div:last-child {
  border-right: none;
}

.table-body {
  display: flex;
  flex-direction: column;
}

.table-row {
  display: grid;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.table-row:hover {
  background: #f8f9fa;
}

.work-account-row {
  grid-template-columns: 2fr 1fr 1fr 1.5fr 1.5fr 2fr 1fr;
}

.employee-row {
  grid-template-columns: 2fr 2fr 1.5fr 1fr 1fr 1.2fr 1.5fr;
}

.table-row > div {
  padding: 15px 10px;
  border-right: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.table-row > div:last-child {
  border-right: none;
}

/* Содержимое ячеек */
.account-name,
.employee-name {
  font-weight: 600;
  color: #333;
  margin-bottom: 2px;
}

.account-username,
.employee-id {
  font-size: 12px;
  color: #666;
}

.messages-info {
  font-size: 13px;
}

.messages-info .daily {
  font-weight: 600;
  color: #333;
}

.messages-info .total {
  color: #666;
  font-size: 12px;
}

.owner-info {
  font-size: 13px;
}

.owner-name {
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.owner-email {
  color: #666;
  font-size: 12px;
}

/* Бейджи */
.type-badge,
.status-badge,
.role-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.type-badge {
  background: #e3f2fd;
  color: #1976d2;
}

.type-telegram {
  background: #e1f5fe;
  color: #0277bd;
}

.type-vk {
  background: #f3e5f5;
  color: #7b1fa2;
}

.type-instagram {
  background: #fce4ec;
  color: #c2185b;
}

.status-active {
  background: #e8f5e8;
  color: #2e7d32;
}

.status-inactive {
  background: #fff3e0;
  color: #f57c00;
}

.status-banned {
  background: #ffebee;
  color: #d32f2f;
}

.status-error {
  background: #fce4ec;
  color: #c2185b;
}

.role-admin {
  background: #ffebee;
  color: #d32f2f;
}

.role-sales_director {
  background: #f3e5f5;
  color: #7b1fa2;
}

.role-sales_manager {
  background: #e8f5e8;
  color: #2e7d32;
}

.admin-badge {
  padding: 2px 6px;
  background: #ff5722;
  color: white;
  border-radius: 8px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 5px;
}

/* Кнопки в таблицах */
.col-actions {
  display: flex !important;
  flex-direction: row !important;
  gap: 5px;
  align-items: center;
  justify-content: center;
}

.btn-small {
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-small:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-test {
  background: #ff9800;
  color: white;
}

.btn-test:hover {
  background: #f57c00;
}

.btn-auth {
  background: #2196f3;
  color: white;
}

.btn-auth:hover {
  background: #1976d2;
}

/* Модальные окна для аккаунтов */
.work-account-form .form-group {
  margin-bottom: 15px;
}

.work-account-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: #333;
}

.work-account-form input,
.work-account-form select,
.work-account-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.work-account-form input:focus,
.work-account-form select:focus,
.work-account-form textarea:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

.telegram-settings {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #e9ecef;
}

.telegram-auth-info {
  background: #e3f2fd;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border: 1px solid #2196f3;
}

.info-block h4 {
  margin: 0 0 10px 0;
  color: #1976d2;
}

.info-block p {
  margin: 0;
  color: #1976d2;
  font-size: 14px;
}

/* Адаптивные стили для менеджера аккаунтов */
@media (max-width: 768px) {
  .accounts-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .accounts-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .accounts-stats {
    flex-direction: column;
    gap: 10px;
  }

  .work-accounts-table .table-header,
  .work-accounts-table .table-row {
    grid-template-columns: 1fr;
  }

  .employees-table .table-header,
  .employees-table .table-row {
    grid-template-columns: 1fr;
  }

  .table-header > div,
  .table-row > div {
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
  }

  .col-actions {
    justify-content: flex-start;
  }
}

/* ============================================
   PWA STYLES - СТИЛИ ДЛЯ PROGRESSIVE WEB APP
   ============================================ */

/* PWA Mode - когда запущено как приложение */
body.pwa-mode {
  /* Убираем отступы для полноэкранного вида */
  padding-top: 0;
}

/* Статус бар для iOS */
body.pwa-mode .header {
  padding-top: env(safe-area-inset-top, 20px);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Баннер установки PWA */
.pwa-install-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-install-bar.show {
  transform: translateY(0);
}

.install-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
}

.install-icon {
  font-size: 20px;
}

.install-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.install-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.install-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.install-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.install-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Баннер обновления PWA */
.pwa-update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 12px 20px;
  z-index: 9999;
  transform: translateY(-100%);
  transition: transform 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pwa-update-bar.show {
  transform: translateY(0);
}

.update-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
}

.update-icon {
  font-size: 20px;
  animation: spin 2s linear infinite;
}

.update-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.update-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.update-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.update-close {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.update-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Подсказка для iOS */
.ios-install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  z-index: 10000;
  padding: 20px;
  animation: slideUp 0.4s ease-out;
}

.ios-prompt-content {
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

.ios-prompt-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.ios-prompt-content h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
}

.ios-prompt-content p {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #e0e0e0;
}

.ios-prompt-content ol {
  text-align: left;
  margin: 16px 0;
  padding-left: 20px;
}

.ios-prompt-content li {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.ios-prompt-content strong {
  color: #4fc3f7;
}

.ios-prompt-close {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  transition: all 0.2s ease;
}

.ios-prompt-close:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Адаптация для PWA в standalone режиме */
@media (display-mode: standalone) {
  body {
    /* Убираем отступы сверху для мобильных браузеров */
    padding-top: 0;
  }

  .header {
    /* Добавляем отступ для статус-бара */
    padding-top: env(safe-area-inset-top, 20px);
  }

  /* Скрываем баннеры установки когда уже запущено как PWA */
  .pwa-install-bar {
    display: none !important;
  }
}

/* Стили для iOS Safari в standalone режиме */
@media (max-width: 768px) and (display-mode: standalone) {
  .header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding-top: max(env(safe-area-inset-top), 20px);
    border-radius: 0;
  }

  .logo-text {
    color: white;
    font-weight: 700;
  }

  .icon-btn {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Улучшения для мобильных устройств в PWA режиме */
@media (max-width: 768px) {
  .pwa-install-bar,
  .pwa-update-bar {
    padding: 10px 15px;
  }

  .install-content,
  .update-content {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .install-text,
  .update-text {
    font-size: 13px;
  }

  .install-btn,
  .update-btn {
    padding: 6px 14px;
    font-size: 12px;
  }

  .ios-prompt-content {
    padding: 0 20px;
  }

  .ios-prompt-content h3 {
    font-size: 18px;
  }

  .ios-prompt-content p {
    font-size: 14px;
  }

  .ios-prompt-content li {
    font-size: 13px;
  }
}

/* Анимация вращения для иконки обновления */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Состояние загрузки для PWA */
.pwa-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 10001;
}

.pwa-loading-icon {
  font-size: 64px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.pwa-loading-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.pwa-loading-subtext {
  font-size: 14px;
  opacity: 0.8;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

/* Стили для offline индикатора */
.offline-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  z-index: 10000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.offline-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.8;
}

.offline-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.offline-subtext {
  font-size: 13px;
  opacity: 0.7;
}

/* PWA специфичные стили для темной темы (если будет нужно) */
@media (prefers-color-scheme: dark) {
  .pwa-install-bar,
  .pwa-update-bar {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  }

  .ios-install-prompt {
    background: rgba(0, 0, 0, 0.95);
  }
}

/* Дополнительная адаптация для очень маленьких экранов */
@media (max-width: 320px) {
  .install-content,
  .update-content {
    gap: 8px;
  }

  .install-text,
  .update-text {
    font-size: 12px;
  }

  .install-btn,
  .update-btn {
    padding: 5px 12px;
    font-size: 11px;
  }

  .ios-prompt-content {
    padding: 0 15px;
  }
}

/* Добавить в конец файла стили для iOS уведомлений PWA */

/* iOS уведомления PWA */
.ios-notification-prompt {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.3s ease;
}

.ios-notification-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.ios-notification-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.ios-notification-content h3 {
  font-size: 20px;
  margin: 0 0 12px 0;
  color: #1f2937;
}

.ios-notification-content p {
  margin: 0 0 16px 0;
  color: #6b7280;
  font-size: 16px;
}

.ios-notification-content ul {
  text-align: left;
  margin: 16px 0 24px 0;
  padding-left: 0;
  list-style: none;
}

.ios-notification-content li {
  padding: 8px 0;
  color: #374151;
  font-size: 15px;
}

.ios-notification-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.ios-notification-allow,
.ios-notification-deny {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ios-notification-allow {
  background: #3b82f6;
  color: white;
}

.ios-notification-allow:hover {
  background: #2563eb;
}

.ios-notification-deny {
  background: #f3f4f6;
  color: #6b7280;
}

.ios-notification-deny:hover {
  background: #e5e7eb;
}

/* Полноэкранный чат поддержки для мобильных */
.support-widget.fullscreen-mobile {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  border-radius: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
}

.support-widget.fullscreen-mobile .support-widget-header {
  padding: 16px 20px !important;
  background: #2563eb !important;
  color: white !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.support-widget.fullscreen-mobile .support-widget-header h3 {
  color: white !important;
  font-size: 18px !important;
}

.support-widget.fullscreen-mobile .support-close {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 20px !important;
}

.support-widget.fullscreen-mobile .support-close:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.support-widget.fullscreen-mobile .support-widget-body {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  height: auto !important;
  max-height: none !important;
}

.support-widget.fullscreen-mobile .support-intro {
  padding: 20px !important;
  flex-shrink: 0 !important;
}

.support-widget.fullscreen-mobile .support-chat {
  flex: 1 !important;
  padding: 0 20px !important;
  margin: 0 !important;
  max-height: none !important;
  height: auto !important;
}

.support-widget.fullscreen-mobile .support-form {
  padding: 16px 20px !important;
  background: #f8f9fa !important;
  border-top: 1px solid #e9ecef !important;
  flex-shrink: 0 !important;
}

.support-widget.fullscreen-mobile .support-input-container {
  margin: 0 !important;
}

/* Предотвращаем скролл body когда открыт полноэкранный чат */
body.support-fullscreen-open {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

/* Улучшенные мобильные стили */
@media (max-width: 768px) {
  /* Исправления для кнопок действий в потоке */
  .actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 12px !important;
  }

  .btn-action {
    flex: 1 !important;
    min-width: auto !important;
    max-width: none !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Исправления для ответа в личке */
  .reply-field {
    margin-top: 12px !important;
    padding: 0 !important;
  }

  .reply-field textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 60px !important;
    padding: 10px !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    resize: vertical !important;
  }

  .reply-actions {
    display: flex !important;
    gap: 8px !important;
    margin-top: 8px !important;
    flex-wrap: wrap !important;
  }

  .btn-send,
  .btn-generate {
    flex: 1 !important;
    min-width: 0 !important;
    padding: 10px 16px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
  }

  /* Исправления для CRM */
  .crm-table-body {
    padding: 0 8px !important;
  }

  .crm-card {
    margin: 0 0 12px 0 !important;
    padding: 12px !important;
    border-radius: 8px !important;
  }

  .crm-card-main {
    margin-bottom: 12px !important;
  }

  .crm-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
  }

  .crm-action-btn,
  .stage-selector {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Исправления для главного контейнера */
  .header,
  .tabs,
  main > section {
    width: calc(100% - 16px) !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
  }

  .header-content {
    padding: 12px 16px !important;
  }

  .section {
    padding: 16px !important;
  }

  /* Исправления для модальных окон */
  .modal-content {
    width: 95% !important;
    margin: 20px auto !important;
    padding: 16px !important;
    max-height: 85vh !important;
  }

  /* Исправления для формы сообщений */
  .message-header {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .message-info {
    min-width: 0 !important;
    flex: 1 !important;
  }

  .message-content {
    margin: 8px 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .message-meta {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Исправления для emoji панели */
  .emoji-panel {
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 280px !important;
    max-width: 90vw !important;
  }

  /* Исправления для тостов */
  #toast-container {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
  }

  .toast {
    margin-bottom: 8px !important;
    font-size: 14px !important;
  }

  /* Исправления для кампаний */
  .tag {
    font-size: 12px !important;
    padding: 6px 10px !important;
    margin: 2px !important;
  }

  .filters {
    gap: 6px !important;
    padding: 12px 0 !important;
  }

  /* Исправления для поддержки на мобильных */
  .support-toggle {
    width: 52px !important;
    height: 52px !important;
    font-size: 20px !important;
    bottom: 20px !important;
    right: 20px !important;
  }

  .support-toggle .message-badge {
    top: -4px !important;
    right: -4px !important;
    min-width: 18px !important;
    height: 18px !important;
    font-size: 11px !important;
  }
}

/* Дополнительные исправления для очень маленьких экранов */
@media (max-width: 480px) {
  .header,
  .tabs,
  main > section {
    width: calc(100% - 8px) !important;
    margin-left: 4px !important;
    margin-right: 4px !important;
  }

  .section {
    padding: 12px !important;
  }

  .btn-action {
    padding: 6px 8px !important;
    font-size: 12px !important;
  }

  .reply-actions {
    flex-direction: column !important;
  }

  .btn-send,
  .btn-generate {
    width: 100% !important;
  }

  .crm-actions {
    flex-direction: column !important;
  }

  .modal-content {
    width: 98% !important;
    margin: 10px auto !important;
    padding: 12px !important;
  }
}

/* Добавить в конец файла после существующих мобильных стилей */

/* Исправление CRM кнопок переключения вида на мобильных */
@media (max-width: 768px) {
  .crm-controls {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    justify-content: center;
  }

  .campaign-select-container {
    width: 100%;
  }

  .campaign-select {
    width: 100%;
    box-sizing: border-box;
  }

  .view-toggle {
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
    display: flex;
  }

  .view-btn {
    padding: 8px 16px;
    font-size: 13px;
    gap: 6px;
    flex: 1;
    min-width: 0;
    text-align: center;
    justify-content: center;
    white-space: nowrap;
    box-sizing: border-box;
  }

  .view-btn span {
    font-size: 16px;
  }
}

/* Исправление стилей потока - кнопки действий и центрирование карточек */
@media (max-width: 768px) {
  .feed {
    max-width: 100%;
    padding: 0 12px;
  }

  .card {
    margin: 0 auto 16px auto;
    max-width: 100%;
    box-sizing: border-box;
  }

  .actions {
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .btn-action {
    padding: 8px 12px;
    font-size: 13px;
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit !important;
    background-color: inherit !important;
  }

  /* Стили кнопок действий для мобильных */
  .btn-action.source {
    background: #dbe8ff !important;
    color: #1a73e8 !important;
  }

  .btn-action.source::after {
    content: "💬 Reply";
  }

  .btn-action.direct {
    background: #e8f0fe !important;
    color: #1a73e8 !important;
  }

  .btn-action.direct::after {
    content: "✉️ Личка";
  }

  .btn-action.yes {
    background: #d5f8df !important;
    color: #2d8a4a !important;
  }

  .btn-action.yes::after {
    content: "✅";
  }

  .btn-action.no {
    background: #e2e2e2 !important;
    color: #555 !important;
  }

  .btn-action.no::after {
    content: "❌";
  }

  /* Скрываем оригинальный текст на мобильных */
  .btn-action {
    font-size: 0 !important;
  }

  .btn-action::after {
    font-size: 13px;
  }
}

/* Исправление центрирования секции CRM */
#crm.section {
  max-width: 800px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 20px;
}

/* Центрирование всех блоков внутри CRM */
.crm-view {
  max-width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.crm-table {
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  max-width: 100%;
  margin: 0 auto;
}

.crm-table-body {
  max-height: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 100%;
  box-sizing: border-box;
}

.crm-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  gap: 24px;
  max-width: 100%;
  box-sizing: border-box;
}

.kanban-board {
  display: flex;
  gap: 16px;
  min-height: 600px;
  overflow-x: auto;
  padding: 8px 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Убираем любые фиксированные отступы, которые могут сдвигать блок */
main > section#crm {
  margin: 16px auto;
  max-width: 800px;
  width: calc(100% - 40px);
  box-sizing: border-box;
  background: var(--card);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
  #crm.section {
    padding: 16px;
    margin: 0 auto;
  }

  main > section#crm {
    width: calc(100% - 20px);
    margin: 12px auto;
  }

  .crm-controls {
    flex-direction: column;
    gap: 16px;
    padding: 12px;
  }
}




/* Стили для селектора рабочих аккаунтов */
.work-account-selector {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.work-account-selector label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}

.work-account-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    color: #495057;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.work-account-select:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.work-account-select:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

/* Обновляем стили кнопки отправки */
.btn-send {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 10px;
}

.btn-send:hover {
    background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-send:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}


/* Обновленные стили для селектора рабочих аккаунтов */
.reply-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.work-account-select {
    flex: 1;
    min-width: 180px;
    max-width: 250px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 13px;
    color: #495057;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    margin-right: auto;
}

.work-account-select:focus {
    border-color: #007bff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.work-account-select:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

/* Обновляем стили кнопок для лучшего выравнивания */
.reply-actions .btn-send,
.reply-actions .btn-generate {
    flex-shrink: 0;
    margin: 0;
    padding: 8px 16px;
    height: auto;
    min-height: 36px;
}

/* Убираем старые стили селектора */
.work-account-selector {
    display: none !important;
}

/* Адаптивность для мобильных */
@media (max-width: 600px) {
    .reply-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .work-account-select {
        max-width: none;
        margin-right: 0;
        margin-bottom: 8px;
    }
}

/* Адаптивность для мобильных */
@media (max-width: 600px) {
    .reply-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .work-account-select {
        max-width: none;
        margin-right: 0;
        margin-bottom: 8px;
    }
}

/* Стили для новой системы ответов с селектором аккаунтов */
.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.account-selector {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #333;
    margin-right: 10px;
}

.account-selector:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

.account-selector option {
    padding: 5px;
}

.reply-type-indicator {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
}

.reply-field[data-reply-type=" source\] .reply-type-indicator {
 color: #0d6efd;
 background: #e7f1ff;
}

.reply-field[data-reply-type=\direct\] .reply-type-indicator {
 color: #198754;
 background: #d1e7dd;
}

.reply-field[data-reply-type=\crm\] .reply-type-indicator {
 color: #dc3545;
 background: #f8d7da;
}

/* Улучшения для формы ответа */
.reply-field {
 margin-top: 10px;
 padding: 12px;
 background: #fafbfc;
 border: 1px solid #e1e5e9;
 border-radius: 8px;
}

.reply-field textarea {
 width: 100%;
 min-height: 80px;
 padding: 10px;
 border: 1px solid #ddd;
 border-radius: 6px;
 resize: vertical;
 font-family: inherit;
 font-size: 14px;
 line-height: 1.4;
}

.reply-field textarea:focus {
 outline: none;
 border-color: #0d6efd;
 box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.reply-actions {
 display: flex;
 gap: 8px;
 margin-top: 10px;
 justify-content: flex-end;
}

.reply-actions .btn-send {
 background: #0d6efd;
 color: white;
 border: none;
 padding: 8px 16px;
 border-radius: 6px;
 font-size: 14px;
 font-weight: 500;
 cursor: pointer;
 transition: background-color 0.2s;
}

.reply-actions .btn-send:hover {
 background: #0b5ed7;
}

.reply-actions .btn-generate {
 background: #6c757d;
 color: white;
 border: none;
 padding: 8px 16px;
 border-radius: 6px;
 font-size: 14px;
 font-weight: 500;
 cursor: pointer;
 transition: background-color 0.2s;
}

.reply-actions .btn-generate:hover {
 background: #5c636a;
}

/* Стили для новой системы ответов с селектором аккаунтов */
.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.account-selector {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    color: #333;
    margin-right: 10px;
}

.account-selector:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

.account-selector option {
    padding: 5px;
}

.reply-type-indicator {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 4px;
}

.reply-field[data-reply-type="source"] .reply-type-indicator {
    color: #0d6efd;
    background: #e7f1ff;
}

.reply-field[data-reply-type="direct"] .reply-type-indicator {
    color: #198754;
    background: #d1e7dd;
}

.reply-field[data-reply-type="crm"] .reply-type-indicator {
    color: #dc3545;
    background: #f8d7da;
}

/* Улучшения для формы ответа */
.reply-field {
    margin-top: 10px;
    padding: 12px;
    background: #fafbfc;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
}

.reply-field textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.reply-field textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

.reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.reply-actions .btn-send {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reply-actions .btn-send:hover {
    background: #0b5ed7;
}

.reply-actions .btn-generate {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.reply-actions .btn-generate:hover {
    background: #5c636a;
} /* Обновленные стили для системы ответов */
.reply-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-start;
}

.account-selector {
    flex: 0 0 auto;
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

.account-selector:disabled {
    background: #f5f5f5;
    color: #666;
    cursor: not-allowed;
}

.reply-actions .btn-send {
    background: #0d6efd;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.reply-actions .btn-send:hover {
    background: #0b5ed7;
}

.reply-actions .btn-generate {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.reply-actions .btn-generate:hover {
    background: #5c636a;
}

/* Основные стили формы ответа */
.reply-field {
    margin-top: 10px;
    padding: 12px;
    background: #fafbfc;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
}

.reply-field textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 10px;
}

.reply-field textarea:focus {
    outline: none;
    border-color: #0d6efd;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}
/* Стили для чекбоксов согласия */
.auth-agreements {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    gap: 8px;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
 width: 18px;
 height: 18px;
 margin: 0;
 cursor: pointer;
 accent-color: #0d6efd;
 flex-shrink: 0;
 margin-top: 1px;
}

.checkbox-label span {
 color: #495057;
 user-select: none;
}

.checkbox-label a {
 color: #0d6efd;
 text-decoration: none;
}

.checkbox-label a:hover {
 text-decoration: underline;
}

.checkbox-label:hover span {
 color: #212529;
}

/* Стили для чекбоксов согласия */
.auth-agreements {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
    gap: 8px;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label input[type=checkbox] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #0d6efd;
    flex-shrink: 0;
    margin-top: 1px;
}

.checkbox-label span {
    color: #495057;
    user-select: none;
}

.checkbox-label a {
    color: #0d6efd;
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.checkbox-label:hover span {
    color: #212529;
}

/* Стили для кнопки "Показать ещё" */
.load-more-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    padding: 10px;
}

.load-more-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.load-more-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.load-more-icon {
    font-size: 16px;
}

.load-more-text {
    font-weight: 500;
}

@media (max-width: 768px) {
    .load-more-container {
        margin: 15px 0;
        padding: 8px;
    }

    .load-more-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .load-more-icon {
        font-size: 14px;
    }
}
