/* ==========================================================================
   CSS Стили сервиса генерации SEO-статей
   Дизайн-система: Премиальная светлая палитра, строгая типографика, методология БЭМ
   ========================================================================== */

:root {
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f1f5f9;
  --bg-surface-elevated: #ffffff;
  --border-color: #e2e8f0;
  --border-color-focus: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-success: #059669;
  --accent-success-hover: #047857;
  --accent-warning: #d97706;
  --accent-danger: #dc2626;
  --accent-danger-hover: #b91c1c;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Вспомогательные классы --- */
.hidden {
  display: none !important;
}

/* --- Шапка приложения --- */
.app-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 12px 0;
}

.app-header__container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-header__logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.app-header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.app-header__badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.app-header__controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Статус-бейдж подключения --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}

.status-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge--connected {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.25);
}
.status-badge--connected .status-badge__dot {
  background-color: var(--accent-success);
  box-shadow: 0 0 6px var(--accent-success);
}

.status-badge--disconnected {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.25);
}
.status-badge--disconnected .status-badge__dot {
  background-color: var(--accent-danger);
}

/* --- Основная сетка страницы --- */
.app-main {
  padding: 32px 0 64px 0;
}

.app-main__container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* --- Карточки и общие блоки --- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.generator-section__header {
  margin-bottom: 24px;
}

.generator-section__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.generator-section__subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Элементы форм --- */
.generator-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.generator-form__row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.generator-form__field--grow {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

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

.input-with-icon__icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 42px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-color-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.form-textarea--sm {
  min-height: 70px;
  font-size: 13px;
}

.form-textarea--editor {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  min-height: 360px;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group--inline {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.form-group--inline .form-label {
  margin-bottom: 0;
  white-space: nowrap;
}

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.btn--lg {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
}

.btn--primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}
.btn--primary:hover:not(:disabled) {
  background-color: var(--accent-primary-hover);
}

.btn--secondary {
  background-color: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn--secondary:hover:not(:disabled) {
  background-color: var(--bg-surface-elevated);
  border-color: var(--text-dim);
}

.btn--success {
  background-color: var(--accent-success);
  color: #ffffff;
}
.btn--success:hover:not(:disabled) {
  background-color: var(--accent-success-hover);
}

.btn--outline-danger {
  background-color: transparent;
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.4);
}
.btn--outline-danger:hover:not(:disabled) {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: var(--accent-danger);
}

.btn--text {
  background: none;
  border: none;
  color: var(--accent-primary);
  padding: 0;
}
.btn--text:hover:not(:disabled) {
  text-decoration: underline;
}

/* --- Складной блок (Collapse Box) --- */
.collapse-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 4px;
}

.collapse-box__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background-color: var(--bg-surface-alt);
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.collapse-box__trigger:hover {
  color: var(--text-main);
}

.collapse-box__icon {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.collapse-box.is-open .collapse-box__icon {
  transform: rotate(180deg);
}

.collapse-box__content {
  display: none;
  padding: 16px;
  background-color: var(--bg-surface-alt);
  border-top: 1px solid var(--border-color);
}

.collapse-box.is-open .collapse-box__content {
  display: block;
}

/* --- Site DNA Card --- */
.site-dna-card {
  margin-top: 24px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.site-dna-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.site-dna-card__title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-dna-card__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.site-dna-card__url {
  font-size: 13px;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.site-dna-card__stats {
  display: flex;
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.badge--info {
  background-color: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
}

.badge--source {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
}

.badge--neutral {
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
}

.site-dna-card__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.site-dna-card__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.site-dna-card__key {
  font-size: 12px;
  color: var(--text-dim);
}

.site-dna-card__val {
  font-size: 13px;
  color: var(--text-main);
}

.site-dna-card__summary {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.5;
}

/* --- Темы (Topics Block) --- */
.topics-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.topics-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.topics-block__title {
  font-size: 18px;
  font-weight: 700;
}

.topics-block__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.topics-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.topic-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.topic-card:hover {
  border-color: var(--border-color-focus);
  background-color: #f8fafc;
}

.topic-card.is-selected {
  border-color: var(--accent-primary);
  background-color: rgba(37, 99, 235, 0.05);
  box-shadow: 0 0 0 1px var(--accent-primary);
}

.topic-card__radio {
  margin-top: 4px;
  accent-color: var(--accent-primary);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.topic-card__body {
  flex: 1;
}

.topic-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.topic-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.topic-card__intent {
  color: var(--accent-primary);
  font-weight: 500;
}

.topic-card__lsi {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.topic-card__lsi-tag {
  background-color: var(--bg-surface-elevated);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-dim);
}

.topic-card__uniqueness {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.custom-topic-box {
  background-color: var(--bg-surface-alt);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.generation-params {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

/* --- Прогресс-бар SSE --- */
.progress-box {
  margin-top: 24px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.progress-box__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-box__title {
  font-size: 14px;
  font-weight: 600;
}

.progress-box__percent {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-primary);
  font-family: var(--font-mono);
}

.progress-bar {
  height: 8px;
  background-color: var(--bg-surface-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar__fill {
  height: 100%;
  background-color: var(--accent-primary);
  transition: width 0.3s ease;
}

.progress-box__steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.progress-box__step-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-box__step-item--current {
  color: var(--accent-primary);
  font-weight: 600;
}

/* --- Архив статей (Архитектура аккордеона) --- */
.archive-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.archive-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.archive-section__title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.archive-section__title {
  font-size: 20px;
  font-weight: 700;
}

.archive-section__bulk-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-md);
}

.bulk-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}

.form-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid #94a3b8;
  border-radius: 4px;
  background: var(--bg-surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: all var(--transition-fast);
  margin: 0;
  flex-shrink: 0;
}

.form-checkbox:hover {
  border-color: var(--accent-primary);
}

.form-checkbox:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.form-checkbox:checked::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}

.form-checkbox:indeterminate {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.form-checkbox:indeterminate::before {
  content: "";
  width: 8px;
  height: 2px;
  background: #ffffff;
}

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background-color: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-dim);
  text-align: center;
  gap: 12px;
}

.empty-state__icon {
  width: 40px;
  height: 40px;
}

.empty-state__text {
  font-size: 14px;
}

/* --- Карточка статьи в архиве --- */
.article-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.article-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-md);
}

.article-card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  background-color: var(--bg-surface);
  user-select: none;
}

.article-card__select {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
}

.article-card.is-selected {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.02);
}

.article-card__title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.article-card__meta-line {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.article-card__meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-card__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-card__action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.article-card__action-btn:hover {
  background: var(--bg-hover);
  color: var(--primary);
  border-color: var(--primary);
}

.article-card__action-btn svg {
  width: 15px;
  height: 15px;
}

.article-card__chevron {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  transition: transform var(--transition-fast);
  margin-left: 6px;
}

.article-card.is-expanded .article-card__chevron {
  transform: rotate(180deg);
}

/* Тело карточки (развернутое состояние) */
.article-card__body {
  display: none;
  padding: 20px;
  border-top: 1px solid var(--border-color);
  background-color: #ffffff;
}

.article-card.is-expanded .article-card__body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Статистическая плашка */
.article-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  background-color: var(--bg-surface-alt);
  border-radius: var(--radius-sm);
  font-size: 13px;
  align-items: center;
}

.article-stats-bar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.article-stats-bar__val {
  color: var(--text-main);
  font-weight: 600;
}

/* Переключатель режимов: Редактор / Предпросмотр */
.mode-toggle-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-switch {
  display: inline-flex;
  background-color: var(--bg-surface-alt);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tab-switch__btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-switch__btn.is-active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

/* Редактор Markdown */
.article-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-editor__textarea {
  min-height: 420px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
}

/* Предпросмотр отрендеренного HTML */
.article-preview {
  min-height: 420px;
  padding: 24px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 15px;
  line-height: 1.7;
}

.article-preview h1, .article-preview h2, .article-preview h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.article-preview h1:first-child {
  margin-top: 0;
}
.article-preview p {
  margin-bottom: 16px;
}
.article-preview ul, .article-preview ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.article-preview li {
  margin-bottom: 6px;
}
.article-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}
.article-preview th, .article-preview td {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}
.article-preview th {
  background-color: var(--bg-surface-elevated);
}
.article-preview blockquote {
  border-left: 4px solid var(--accent-primary);
  padding-left: 16px;
  margin: 20px 0;
  color: var(--text-muted);
  font-style: italic;
}

/* Журнал генерации статьи */
.article-logs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.log-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background-color: var(--border-color);
  color: var(--text-muted);
  margin-left: 6px;
  vertical-align: middle;
}

.tab-switch__btn.is-active .log-counter {
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.log-counter--danger {
  background-color: var(--accent-danger);
  color: #ffffff;
}

.pipeline-summary-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  padding: 12px 18px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.pipeline-summary-bar__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pipeline-summary-bar__label {
  color: var(--text-muted);
}

.pipeline-summary-bar__val {
  font-weight: 700;
  color: var(--text-main);
}

.pipeline-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pipeline-step-card {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pipeline-step-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.pipeline-step-card--ok {
  border-left: 4px solid var(--accent-success);
}

.pipeline-step-card--warning {
  border-left: 4px solid var(--accent-warning);
  background-color: #fffdf5;
}

.pipeline-step-card--error {
  border-left: 4px solid var(--accent-danger);
  background-color: #fef2f2;
}

.pipeline-step-card--skipped {
  border-left: 4px solid var(--text-dim);
  opacity: 0.85;
}

.pipeline-step-card__icon-col {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}

.pipeline-step-card__icon {
  width: 20px;
  height: 20px;
}

.pipeline-step-card__icon--ok {
  color: var(--accent-success);
}

.pipeline-step-card__icon--warning {
  color: var(--accent-warning);
}

.pipeline-step-card__icon--error {
  color: var(--accent-danger);
}

.pipeline-step-card__icon--skipped {
  color: var(--text-dim);
}

.pipeline-step-card__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipeline-step-card__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 14px;
}

.pipeline-step-card__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pipeline-step-card__num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.pipeline-step-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.pipeline-step-card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.pipeline-step-card__meta-item {
  color: var(--text-muted);
}

.pipeline-step-card__tag {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.pipeline-step-card__message {
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.5;
}

.pipeline-step-card__details {
  margin-top: 4px;
}

.pipeline-step-card__summary {
  font-size: 12px;
  color: var(--accent-primary);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.pipeline-step-card__summary:hover {
  text-decoration: underline;
}

.pipeline-step-card__details-body {
  margin-top: 8px;
  padding: 10px 14px;
  background-color: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* SEO и медиа-панель */
.seo-media-panel {
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seo-media-panel__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.input-counter-wrap {
  position: relative;
}

.input-counter-wrap__counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.image-prompt-box {
  background-color: var(--bg-surface-elevated);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.image-prompt-box__text {
  flex: 1;
  word-break: break-all;
}

/* Действия со статьей */
.article-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.article-actions-bar__group {
  display: flex;
  gap: 10px;
}

/* --- Модальное окно настроек --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1;
}

.modal__dialog {
  position: relative;
  width: 90%;
  max-width: 880px;
  max-height: 90vh;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 2;
}

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

.modal__title {
  font-size: 18px;
  font-weight: 700;
}

.modal__subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.modal__close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}
.modal__close-btn svg {
  width: 20px;
  height: 20px;
}
.modal__close-btn:hover {
  color: var(--text-main);
}

.modal__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section__head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-section__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.settings-section__desc {
  font-size: 13px;
  color: var(--text-muted);
}

.input-action-group {
  display: flex;
  gap: 10px;
}

.balance-display {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--accent-success);
}

/* Вкладки промптов */
.tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-surface-alt);
}

.tab-btn.is-active {
  background-color: var(--bg-surface-elevated);
  border-color: var(--border-color);
  color: var(--accent-primary);
}

.prompt-editor-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.prompt-editor-container__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompt-editor-container__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.prompt-editor-container__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.prompt-editor-container__hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-surface-alt);
}

.modal__footer-actions {
  display: flex;
  gap: 12px;
  margin-left: auto;
}

/* --- Toast Уведомления --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
}

.toast--success {
  border-left-color: var(--accent-success);
}

.toast--error {
  border-left-color: var(--accent-danger);
}

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

/* --- Адаптивность --- */
@media (max-width: 992px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
  .site-dna-card__grid {
    grid-template-columns: 1fr 1fr;
  }
  .generator-form__row {
    flex-direction: column;
    align-items: stretch;
  }
  .generation-params {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .site-dna-card__grid {
    grid-template-columns: 1fr;
  }
  .article-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .article-card__controls {
    align-self: flex-end;
  }
  .article-actions-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .article-actions-bar__group {
    flex-direction: column;
  }
}

/* --- Панель выбора проекта --- */
/* --- Секция проектов: сетка и навигация --- */
.projects-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.projects-section__title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 1024px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Карточка проекта --- */
.project-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.project-card__top-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 2;
}

.project-card:hover .project-card__top-actions {
  opacity: 1;
}

.project-card__btn-delete {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.project-card__btn-delete:hover {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent-danger);
  border-color: var(--accent-danger);
  transform: scale(1.08);
}

.project-card__btn-delete svg {
  width: 15px;
  height: 15px;
}

.project-card__color-bar {
  height: 4px;
  width: 100%;
}

.project-card__body {
  padding: 20px;
}

.project-card__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
}

.project-card__icon svg {
  width: 100%;
  height: 100%;
}

.project-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.3;
}

.project-card__url {
  font-size: 12px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 8px;
  word-break: break-all;
}

.project-card__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface-alt);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.project-card__stat--tone {
  color: var(--accent-primary);
  font-weight: 600;
}

/* --- Детальный вид проекта (drill-down) --- */
.project-detail {
  animation: fadeSlideIn 0.3s ease;
}

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

.project-detail__nav {
  margin-bottom: 16px;
}

/* --- Шапка проекта --- */
.project-header {
  position: relative;
  overflow: hidden;
}

.project-header__color-strip {
  height: 4px;
  width: 100%;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.project-header__content {
  padding: 20px 24px;
}

.project-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.project-header__info {
  flex: 1;
}

.project-header__name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.project-header__url {
  font-size: 13px;
  color: var(--accent-primary);
  text-decoration: none;
}

.project-header__url:hover {
  text-decoration: underline;
}

.project-header__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.project-header__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.project-header__meta {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.project-header__meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  .project-header__meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-header__top {
    flex-direction: column;
  }
}

.project-header__meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-header__meta-key {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.project-header__meta-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.project-header__tov-summary {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  font-style: italic;
}

/* --- Кнопка btn--text (стрелка назад) --- */
.btn--text {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.btn--text:hover {
  background: var(--bg-surface-alt);
}

/* --- Селектор цветов темы проекта --- */
.color-palette-picker {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}

.color-chip {
  cursor: pointer;
  display: inline-flex;
  position: relative;
}

.color-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-chip__circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--chip-color);
  display: inline-block;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  border: 2px solid transparent;
}

.color-chip:hover .color-chip__circle {
  transform: scale(1.12);
}

.color-chip input:checked + .color-chip__circle {
  border-color: var(--bg-surface);
  box-shadow: 0 0 0 2.5px var(--chip-color), var(--shadow-sm);
  transform: scale(1.18);
}

/* --- Индикатор мгновенного автосохранения --- */
.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.autosave-status--saving {
  color: var(--accent-warning);
}

.autosave-status--saved {
  color: var(--accent-success);
}

.autosave-status__icon {
  width: 14px;
  height: 14px;
}

/* --- Модальное окно "Как это работает" и пайплайн --- */
.modal__dialog--sm {
  max-width: 460px;
  width: 95%;
}

.modal__dialog--xl {
  max-width: 980px;
  width: 95%;
  max-height: 92vh;
}

.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
}

.how-it-works__banner {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-md);
}

.how-it-works__banner-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.how-it-works__banner-icon svg {
  width: 20px;
  height: 20px;
}

.how-it-works__banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.how-it-works__banner-text strong {
  font-size: 15px;
  color: var(--text-main);
  font-weight: 600;
}

/* Схема пайплайна */
.pipeline-flow {
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 16px;
}

.pipeline-flow__item {
  display: flex;
  align-items: stretch;
  gap: 16px;
  position: relative;
}

.pipeline-flow__marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
  min-width: 36px;
  position: relative;
}

.pipeline-flow__num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.pipeline-flow__item:last-child .pipeline-flow__num {
  border-color: var(--accent-success);
  color: var(--accent-success);
}

.pipeline-flow__line {
  flex: 1;
  width: 2px;
  background-color: var(--border-color);
  margin-top: 4px;
  margin-bottom: -16px;
  z-index: 1;
}

.pipeline-flow__card {
  flex: 1;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.pipeline-flow__card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: rgba(37, 99, 235, 0.4);
}

.pipeline-flow__card--final {
  border-color: rgba(5, 150, 105, 0.3);
  background-color: rgba(5, 150, 105, 0.02);
}

.pipeline-flow__card--final:hover {
  border-color: rgba(5, 150, 105, 0.6);
}

.pipeline-flow__card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pipeline-flow__step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.pipeline-flow__card-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

.pipeline-flow__card-desc code {
  font-family: var(--font-mono);
  background-color: var(--bg-surface-alt);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--accent-primary);
}

.pipeline-flow__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.pipeline-flow__tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Дополнительные бейджи для шагов */
.badge--primary {
  background-color: rgba(37, 99, 235, 0.12);
  color: var(--accent-primary);
}

.badge--warning {
  background-color: rgba(217, 119, 6, 0.12);
  color: var(--accent-warning);
}

.badge--accent {
  background-color: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
}

.badge--danger {
  background-color: rgba(220, 38, 38, 0.12);
  color: var(--accent-danger);
}

.badge--success {
  background-color: rgba(5, 150, 105, 0.12);
  color: var(--accent-success);
}

/* Блок преимуществ */
.how-it-works__advantages {
  background-color: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.how-it-works__advantages-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.how-it-works__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.advantage-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.advantage-card__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.advantage-card__icon svg {
  width: 18px;
  height: 18px;
}

.advantage-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.advantage-card__text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Адаптивность схемы */
@media (max-width: 768px) {
  .how-it-works__grid {
    grid-template-columns: 1fr;
  }
  
  .pipeline-flow__item {
    gap: 12px;
  }

  .pipeline-flow__marker {
    width: 28px;
    min-width: 28px;
  }

  .pipeline-flow__num {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }

  .pipeline-flow__card {
    padding: 12px 14px;
  }

  .pipeline-flow__step-title {
    font-size: 14px;
  }
}

/* --- Блок свободной генерации статьи под шапкой проекта --- */
.free-generator-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.free-generator-card__header {
  margin-bottom: 20px;
}

.free-generator-card__title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.free-generator-card__icon {
  width: 22px;
  height: 22px;
  color: var(--accent-primary);
}

.free-generator-card__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.free-generator-card__subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.free-generator-card__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.free-generator-card__inputs {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 16px;
}

.free-generator-card__actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.form-input--lg {
  padding: 12px 16px;
  font-size: 15px;
}

.required-star {
  color: #ef4444;
  font-weight: bold;
}

/* --- Навигация вкладок проекта --- */
.project-tabs-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.project-tabs-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.project-tabs-nav__btn:hover {
  color: var(--text-main);
}

.project-tabs-nav__btn.is-active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.project-tabs-nav__icon {
  width: 18px;
  height: 18px;
}

.project-tab-content {
  animation: fadeIn 0.2s ease-in-out;
}

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

@media (max-width: 768px) {
  .free-generator-card__inputs {
    grid-template-columns: 1fr;
  }
  .free-generator-card__actions {
    flex-direction: column;
    align-items: stretch;
  }
  .free-generator-card__actions .form-group--inline {
    width: 100%;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Модальное окно отладки пайплайна и инспектора промптов/ответов
   ========================================================================== */
.modal__dialog--debug {
  max-width: 1440px;
  width: 96vw;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.debug-modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.debug-modal-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-primary);
}

.modal__dialog--debug .modal__header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.debug-modal__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.debug-modal__article-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-modal__picker-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.debug-summary-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.debug-summary-bar__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}

.debug-summary-bar__label {
  color: var(--text-muted);
}

.debug-summary-bar__val {
  font-weight: 600;
  color: var(--text-main);
}

.debug-modal__body {
  flex: 1;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.debug-layout {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* Левая панель шагов */
.debug-timeline-pane {
  width: 380px;
  min-width: 320px;
  max-width: 420px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  flex-shrink: 0;
}

.debug-timeline-pane__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.debug-timeline-pane__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.debug-timeline-pane__count {
  font-size: 12px;
  color: var(--text-dim);
}

.debug-steps-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Карточка шага в навигации */
.debug-step-nav {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  overflow: hidden;
  user-select: none;
}

.debug-step-nav:hover {
  border-color: var(--accent-primary);
  background: rgba(37, 99, 235, 0.02);
}

.debug-step-nav.is-active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1.5px var(--accent-primary);
  background: rgba(37, 99, 235, 0.04);
}

.debug-step-nav__main {
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.debug-step-nav__dot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  flex-shrink: 0;
}

.debug-step-nav__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.debug-step-nav__dot--ok { background: var(--accent-success); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
.debug-step-nav__dot--warning { background: var(--accent-warning); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }
.debug-step-nav__dot--error { background: var(--accent-danger); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2); }
.debug-step-nav__dot--skipped { background: var(--text-dim); }

.debug-step-nav__info {
  flex: 1;
  min-width: 0;
}

.debug-step-nav__top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.debug-step-nav__badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.2px;
  text-transform: uppercase;
}

.debug-badge--default { background: rgba(0, 0, 0, 0.06); color: var(--text-muted); }
.debug-badge--serp { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.debug-badge--outline { background: rgba(99, 102, 241, 0.12); color: #6366f1; }
.debug-badge--draft { background: rgba(16, 185, 129, 0.12); color: #059669; }
.debug-badge--factcheck { background: rgba(168, 85, 247, 0.12); color: #9333ea; }
.debug-badge--critic { background: rgba(239, 68, 68, 0.12); color: #dc2626; font-weight: 800; }
.debug-badge--humanizer { background: rgba(245, 158, 11, 0.12); color: #d97706; font-weight: 800; }
.debug-badge--seo { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.debug-badge--finalize { background: rgba(20, 184, 166, 0.12); color: #0d9488; }
.debug-badge--textru { background: rgba(107, 114, 128, 0.12); color: #4b5563; }

.debug-step-nav__time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  font-family: var(--font-mono, monospace);
}

.debug-step-nav__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.debug-step-nav__meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.debug-step-nav__meta-tag {
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Список подэтапов */
.debug-substeps-list {
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.02);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.debug-substep-item {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.debug-substep-item:hover {
  background: var(--bg-surface);
  color: var(--text-main);
}

.debug-substep-item.is-active {
  background: var(--bg-surface);
  color: var(--accent-primary);
  font-weight: 600;
  border-left: 3px solid var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.debug-substep-item__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.debug-substep-item__time {
  font-size: 10.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Правая панель детального инспектора */
.debug-inspector-pane {
  flex: 1;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  min-width: 0;
}

.debug-inspector-pane__header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.debug-inspector-pane__title-area {
  flex: 1;
  min-width: 250px;
}

.debug-inspector-pane__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-main);
}

.debug-inspector-pane__desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 4px;
  padding: 6px 12px;
  background: var(--bg-surface-secondary);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-primary);
  max-width: 850px;
}

.debug-inspector-pane__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Вкладки инспектора */
.debug-tabs-nav {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.debug-tabs-nav__btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.debug-tabs-nav__btn:hover {
  color: var(--text-main);
}

.debug-tabs-nav__btn.is-active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background: var(--bg-surface);
}

.debug-tabs-nav__badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-dim);
}

/* Контент вкладки инспектора */
.debug-inspector-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.debug-block {
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
}

.debug-block__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-surface-secondary);
  border-bottom: 1px solid var(--border-color);
}

.debug-block__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-block__actions {
  display: flex;
  gap: 6px;
}

.debug-code-view {
  padding: 14px;
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
  color: #f1f5f9;
  max-height: 480px;
  overflow-y: auto;
  border: none;
  margin: 0;
}

.debug-parsed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.debug-parsed-table th,
.debug-parsed-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.debug-parsed-table th {
  background: var(--bg-surface-secondary);
  font-weight: 600;
  color: var(--text-muted);
}

/* Баннер вердикта критика */
.debug-verdict-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  border: 1px solid transparent;
  flex-wrap: wrap;
  gap: 10px;
}

.debug-verdict-banner--revise {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.debug-verdict-banner--pass {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.25);
}

.debug-verdict-banner__title {
  font-size: 14.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.debug-verdict-banner--revise .debug-verdict-banner__title {
  color: #dc2626;
}

.debug-verdict-banner--pass .debug-verdict-banner__title {
  color: #059669;
}

.debug-verdict-banner__risk {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
}

.debug-verdict-banner--revise .debug-verdict-banner__risk {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
}

.debug-verdict-banner--pass .debug-verdict-banner__risk {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
}

/* Карточки дефектов ИИ-критика */
.debug-defects-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.debug-defect-card {
  border: 1px solid var(--border-color);
  border-left: 4px solid #ef4444;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.debug-defect-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.debug-defect-card__num {
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.debug-defect-card__category {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.debug-defect-card__section {
  margin-top: 10px;
}

.debug-defect-card__label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.debug-defect-card__quote {
  background: var(--bg-surface-secondary);
  border-left: 3px solid var(--border-color);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-main);
  font-style: italic;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.debug-defect-card__reason {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b45309;
  border-radius: var(--radius-sm);
}

.debug-defect-card__directive {
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #1d4ed8;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* Панель переключения режима отчета (Визуальный vs RAW) */
.debug-view-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.debug-view-toggle__btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border: none;
  background: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.debug-view-toggle__btn:hover {
  color: var(--text-main);
}

.debug-view-toggle__btn.is-active {
  background: var(--bg-surface);
  color: var(--accent-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.debug-empty-pane {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.debug-empty-pane__icon {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  color: var(--text-dim);
}

.debug-empty-pane__text {
  font-size: 14px;
  line-height: 1.5;
}

.btn--copy-prompt {
  font-size: 11.5px;
  padding: 4px 10px;
}

/* Кнопка на карточке статьи в табе журналов */
.article-logs__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.article-logs__toolbar-desc {
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
}

@media (max-width: 900px) {
  .debug-layout {
    flex-direction: column;
  }
  .debug-timeline-pane {
    width: 100%;
    max-width: none;
    height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
}


