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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f7fa;
  padding: 16px;
}

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

/* Навигация */
.nav {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e4ea;
}

.nav a {
  padding: 10px 20px;
  text-decoration: none;
  color: #666;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.nav a:hover {
  color: #2067b0;
}

.nav a.active {
  color: #2067b0;
  border-bottom-color: #2067b0;
}

/* Карточки-секции */
.section {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-icon {
  font-size: 18px;
}

/* Формы */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

.form-row.vertical {
  flex-direction: column;
  align-items: stretch;
}

.form-group {
  flex: 1;
}

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

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  border-color: #2067b0;
  box-shadow: 0 0 0 2px rgba(32, 103, 176, 0.1);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #2067b0;
  color: #fff;
}

.btn-primary:hover {
  background: #185a9d;
}

.btn-secondary {
  background: #e8ecf1;
  color: #333;
}

.btn-secondary:hover {
  background: #d8dee5;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-danger {
  background: #e53e3e;
  color: #fff;
}

.btn-danger:hover {
  background: #c53030;
}

/* Теги (для белого/чёрного списка) */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #edf2f7;
  border-radius: 16px;
  font-size: 13px;
}

.tag .remove {
  cursor: pointer;
  font-size: 16px;
  color: #999;
  line-height: 1;
}

.tag .remove:hover {
  color: #e53e3e;
}

.tag-input-row {
  display: flex;
  gap: 8px;
}

.tag-input-row input {
  flex: 1;
}

/* Радио-группа */
.radio-group {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* Переключатель паузы */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
}

.toggle {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e0;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: #e53e3e;
}

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

/* Правила парсинга */
.rule-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.rule-row input {
  flex: 1;
}

.rule-row select {
  width: 160px;
}

/* Таблица логов */
.log-table {
  width: 100%;
  border-collapse: collapse;
}

.log-table th,
.log-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  font-size: 13px;
}

.log-table th {
  background: #f7fafc;
  font-weight: 600;
  color: #666;
  font-size: 12px;
  text-transform: uppercase;
}

.log-table tr:hover {
  background: #f7fafc;
}

/* Статус-бейджи */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: #c6f6d5;
  color: #22543d;
}

.badge-warning {
  background: #fefcbf;
  color: #744210;
}

.badge-error {
  background: #fed7d7;
  color: #822727;
}

.badge-info {
  background: #bee3f8;
  color: #2a4365;
}

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

/* Статус-бар */
.status-bar {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
}

.status-bar.success {
  background: #c6f6d5;
  color: #22543d;
}

.status-bar.error {
  background: #fed7d7;
  color: #822727;
}

.status-bar.info {
  background: #bee3f8;
  color: #2a4365;
}

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

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

/* Скрытие */
.hidden {
  display: none !important;
}

/* Лоадер */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #d0d5dd;
  border-top-color: #2067b0;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Профили обработки — аккордеон */
.profile-card {
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f7fafc;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.profile-header:hover {
  background: #edf2f7;
}

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

.profile-arrow {
  font-size: 12px;
  color: #999;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.profile-card.open .profile-arrow {
  transform: rotate(90deg);
}

.profile-name-display {
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.profile-body {
  display: none;
  padding: 16px;
  border-top: 1px solid #e0e4ea;
}

.profile-card.open .profile-body {
  display: block;
}

.profile-section {
  margin-bottom: 16px;
}

.profile-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 8px;
}

/* Текстовое поле для примера письма */
.analyze-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 13px;
  font-family: monospace;
  resize: vertical;
}

.analyze-textarea:focus {
  border-color: #2067b0;
  outline: none;
  box-shadow: 0 0 0 2px rgba(32, 103, 176, 0.1);
}

textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: #2067b0;
  box-shadow: 0 0 0 2px rgba(32, 103, 176, 0.1);
}
