/* === СОВРЕМЕННЫЕ СТИЛИ ДЛЯ ТЕХНИЧЕСКОЙ ПОДДЕРЖКИ === */

/* Основные стили */
:root {
  --primary-color: #17228e;
  --primary-light: #2d3eb1;
  --primary-dark: #0f1659;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-bg: #f8f9fa;
  --border-color: #e9ecef;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f0f2f5;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Хедер */
.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  padding: 16px 24px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.nav-menu {
  display: flex;
  gap: 8px;
}

.nav-menu a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-menu a:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  transform: translateY(-1px);
}

.nav-menu a.active {
  background: rgba(255, 255, 255, 0.25);
}

.user-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  text-align: right;
}

.user-info h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.user-info p {
  margin: 0;
  font-size: 13px;
  opacity: 0.85;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Основной контент */
.main-content {
  padding: 24px;
  margin: 24px;
  margin-bottom: 80px;
  background-color: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.content-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

/* Карточки */
.card {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--light-bg);
}

.card-body {
  padding: 20px;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-align: center;
  justify-content: center;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--light-bg);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background: #c82333;
  color: white;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-success:hover {
  background: #218838;
  color: white;
}

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

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

/* Формы */
.form-container {
  max-width: 600px;
}

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

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.2s ease;
  background: white;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(23, 34, 142, 0.1);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.form-actions {
  margin-top: 28px;
  display: flex;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

/* Таблицы */
.table-container {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
}

.table th {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tr:nth-child(even) {
  background-color: var(--light-bg);
}

.table tr:hover {
  background-color: #e9ecef;
}

.table td {
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
}

/* Статусы и бейджи */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
  overflow: hidden;
}

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

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--light-bg);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: var(--light-bg);
}

/* Современные Toast уведомления */
#toast-container {
  position: fixed !important;
  top: 80px !important;
  right: 20px !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto !important;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  min-width: 320px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.toast.toast-success {
  border-left: 5px solid #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06) 0%, #ffffff 100%);
}

.toast.toast-success .toast-icon {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.toast.toast-error {
  border-left: 5px solid #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, #ffffff 100%);
}

.toast.toast-error .toast-icon {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.toast.toast-info {
  border-left: 5px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, #ffffff 100%);
}

.toast.toast-info .toast-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 20px;
  height: 20px;
  color: white;
}

.toast-content {
  flex: 1;
}

.toast-message {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  line-height: 1.4;
}

.toast-close {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.toast-close svg {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

.toast.show {
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.hide {
  animation: toastOut 0.3s ease forwards;
}

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

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

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

/* Переключатель */
.toggle-switch {
  width: 48px;
  height: 26px;
  appearance: none;
  background-color: #ccc;
  border-radius: 26px;
  position: relative;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.toggle-switch:checked {
  background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch:checked::after {
  transform: translateX(22px);
}

/* Справочники */
.reference-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.reference-book-card {
  background: white;
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.reference-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.reference-book-card h3 {
  margin: 0 0 8px 0;
  color: var(--primary-color);
  font-size: 18px;
}

.reference-book-card p {
  color: var(--text-secondary);
  margin: 0 0 16px 0;
  font-size: 14px;
}

/* Пагинация */
.pagination {
  display: flex;
  justify-content: center;
  margin-top: 24px;
  gap: 8px;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  text-decoration: none;
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.pagination a:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination .current {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination .disabled {
  color: #ccc;
  cursor: not-allowed;
}

/* Футер */
.footer {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  padding: 20px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  font-size: 14px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.footer p {
  margin: 0;
}

/* Аваatar пользователя */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
}

/* Фильтры */
.filters-block {
  background: var(--light-bg);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

/* Список файлов */
.file-list {
  margin-top: 16px;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all 0.2s;
}

.file-item:hover {
  background: #e9ecef;
}

.file-preview {
  width: 44px;
  height: 44px;
  margin-right: 14px;
  flex-shrink: 0;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.file-preview.file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: var(--radius-sm);
  font-size: 20px;
}

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

.file-info .file-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.file-info .file-size {
  font-size: 12px;
  color: var(--text-secondary);
}

.file-actions {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.file-remove {
  background: none;
  border: none;
  color: var(--danger-color);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.file-remove:hover {
  background: rgba(220, 53, 69, 0.1);
}

.file-preview-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--primary-color);
  border-radius: var(--radius-sm);
}

.file-preview-btn:hover {
  background: rgba(23, 34, 142, 0.1);
}

/* Цветовой индикатор */
.color-circle {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  vertical-align: middle;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Чекбоксы */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  background: var(--light-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 14px;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 14px;
  transition: all 0.2s;
}

.checkbox-label:hover {
  background: var(--light-bg);
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Алерты */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-weight: 500;
}

.alert-danger {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-notice,
.alert-alert {
  display: none;
}

/* Счетчики */
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

/* Заголовки страниц */
.page-header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  padding: 24px;
  margin: -24px -24px 24px -24px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.page-header h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
}

.page-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

/* Кнопки фильтров */
.filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.filter-tab.active {
  background: var(--primary-color);
  color: white;
}

.filter-tab:not(.active) {
  background: white;
  border-color: var(--border-color);
  color: var(--text-secondary);
}

.filter-tab:hover:not(.active) {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Поиск */
.search-box {
  position: relative;
  max-width: 320px;
}

.search-box input {
  padding-left: 44px;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

/* Действия в таблицах */
.action-buttons {
  display: flex;
  gap: 8px;
}

/* Скрытые flash сообщения */
.hidden-flash {
  display: none;
}

/* Адаптивность */
@media (max-width: 768px) {
  .main-content {
    margin: 12px;
    padding: 16px;
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  .modal-content {
    margin: 10% auto;
    width: 95%;
  }
  
  .nav-menu {
    flex-wrap: wrap;
  }
}

/* === СТИЛИ АВТОМАТИЗАЦИИ === */

.automation-page {
  max-width: 1200px;
  margin: 0 auto;
}

.automation-section {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.automation-section:hover {
  box-shadow: var(--shadow-md);
}

.automation-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.automation-section-header:hover {
  background: #f8f9fa;
}

.automation-section-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.automation-section-icon.ticket-creation {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.automation-section-icon.telegram {
  background: linear-gradient(135deg, #0088cc 0%, #00d4ff 100%);
}

.automation-section-icon.email,
.automation-section-icon.email-sync {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

.automation-section-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.automation-section-info {
  flex: 1;
}

.automation-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.automation-section-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

.automation-section-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, background 0.2s ease;
}

.automation-section.collapsed .automation-section-toggle {
  transform: rotate(-90deg);
}

.automation-section-toggle:hover {
  background: var(--border-color);
}

.automation-section-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.automation-section-content {
  padding: 0 24px 24px 24px;
  border-top: 1px solid var(--border-color);
}

.automation-section.collapsed .automation-section-content {
  display: none;
}

/* Настройки чекбоксов */
.setting-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--light-bg);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.setting-item:hover {
  background: #e9ecef;
  transform: translateX(4px);
}

.setting-item:last-child {
  margin-bottom: 0;
}

.setting-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.setting-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.setting-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.setting-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.setting-toggle input:checked + .setting-slider {
  background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
}

.setting-toggle input:checked + .setting-slider:before {
  transform: translateX(22px);
}

.setting-info {
  flex: 1;
}

.setting-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.setting-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Правила email */
.rules-container {
  background: white;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.rules-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.rules-title svg {
  width: 18px;
  height: 18px;
  color: var(--info-color);
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--light-bg);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.rule-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.rule-drag {
  cursor: grab;
  color: var(--text-secondary);
  padding: 4px;
}

.rule-drag:active {
  cursor: grabbing;
}

.rule-content {
  flex: 1;
}

.rule-type {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.rule-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.rule-fields select,
.rule-fields input {
  flex: 1;
  min-width: 200px;
}

.rule-actions {
  display: flex;
  gap: 8px;
}

.rule-number {
  width: 28px;
  height: 28px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Email события */
.event-card {
  background: var(--light-bg);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.event-card:last-child {
  margin-bottom: 0;
}

.event-card:hover {
  border-color: var(--primary-light);
}

.event-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.event-card.expanded {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.event-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.event-icon svg {
  width: 18px;
  height: 18px;
  color: var(--primary-color);
}

.event-info {
  flex: 1;
}

.event-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.event-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--success-color);
  color: white;
  font-weight: 500;
}

.event-expand {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.event-card.expanded .event-expand {
  transform: rotate(180deg);
}

.event-expand svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.event-body {
  padding: 0 16px 16px 16px;
  display: none;
  border-top: 1px solid var(--border-color);
}

.event-card.expanded .event-body {
  display: block;
  padding-top: 16px;
}

.recipients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.recipient-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.recipient-chip:hover {
  border-color: var(--primary-light);
  background: #f0f4ff;
}

.recipient-chip.selected {
  border-color: var(--success-color);
  background: rgba(40, 167, 69, 0.08);
}

.recipient-chip input {
  display: none;
}

.recipient-chip-check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.recipient-chip.selected .recipient-chip-check {
  background: var(--success-color);
  border-color: var(--success-color);
}

.recipient-chip-check svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
}

.recipient-chip.selected .recipient-chip-check svg {
  opacity: 1;
}

.recipient-chip span {
  font-size: 13px;
  color: var(--text-primary);
}

/* User select */
.user-select-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.user-select-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-select-label svg {
  width: 16px;
  height: 16px;
  color: var(--info-color);
}

.user-select-list {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 160px;
  overflow-y: auto;
}

.user-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--border-color);
}

.user-select-item:last-child {
  border-bottom: none;
}

.user-select-item:hover {
  background: var(--light-bg);
}

.user-select-item.selected {
  background: rgba(40, 167, 69, 0.08);
}

.user-select-item input {
  display: none;
}

.user-select-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.user-select-item.selected .user-select-checkbox {
  background: var(--success-color);
  border-color: var(--success-color);
}

.user-select-checkbox svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
}

.user-select-item.selected .user-select-checkbox svg {
  opacity: 1;
}

.user-select-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.user-select-name {
  font-size: 13px;
  color: var(--text-primary);
}

/* Telegram events */
.telegram-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--light-bg);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.telegram-event:hover {
  background: #e9ecef;
  transform: translateX(4px);
}

.telegram-event:last-child {
  margin-bottom: 0;
}

.telegram-event-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.telegram-event-icon svg {
  width: 20px;
  height: 20px;
  color: #0088cc;
}

.telegram-event-info {
  flex: 1;
}

.telegram-event-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.telegram-event-status {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.telegram-event-status.active {
  color: var(--success-color);
}


