/* ── Settings + Accounts + Brand ── */
/* ── SETTINGS SECTION ──────────────────────────────────────── */
.settings-container {
  position: relative; z-index: 2;
  max-width: var(--container-max); margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-bottom-nav);
  display: none;
}
.settings-container.visible { display: block; }

.settings-header {
  display: flex; align-items: center; gap: 12px; margin-top: 0; margin-bottom: 20px; min-height: 40px;
}
.settings-back-btn {
  width: 40px; height: 40px; border-radius: 14px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: none !important;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--p-white); font-size: 16px; transition: all 0.3s;
  box-shadow: none !important;
}
.settings-back-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border: none !important;
  transform: translateX(-2px);
  box-shadow: none !important;
}
.settings-title {
  font-size: 20px; font-weight: 800; color: var(--p-white);
  letter-spacing: -0.01em;
}
.settings-section-title {
  font-size: 11px; font-weight: 700; color: var(--p-white-a40);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-top: 20px; margin-bottom: 8px; padding-left: 4px;
}
.settings-card {
  background: linear-gradient(135deg, rgba(9, 2, 26, 0.28) 0%, rgba(3, 3, 7, 0.38) 50%, rgba(5, 8, 22, 0.38) 100%);
  border: 1px solid var(--p-white-a8, rgba(255, 255, 255, 0.08));
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), inset 0 1px 0 var(--p-white-a8, rgba(255, 255, 255, 0.08));
  margin-bottom: 12px;
}
.settings-item-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.settings-item-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--p-white);
  margin-bottom: 2px;
}
.settings-item-desc {
  font-size: 11px;
  color: var(--p-white-a40);
  line-height: 1.4;
  margin-bottom: 4px;
}
/* Niche counter badge in section title */
.settings-section-title .niche-counter {
  font-size: 11px;
  font-weight: 600;
  color: rgba(168, 85, 247, 0.75);
  background: rgba(168, 85, 247, 0.1);
  padding: 2px 10px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
  transition: all 0.3s;
}
.settings-section-title .niche-counter.full {
  color: rgba(34, 197, 94, 0.85);
  background: rgba(34, 197, 94, 0.12);
}
/* Progress bar */
.niche-bar-track {
  height: 3px;
  background: var(--p-white-a5);
  border-radius: 2px;
  margin-bottom: 14px;
  overflow: hidden;
}
.niche-bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--p-purple-600), var(--p-purple-300));
  border-radius: 2px;
  transition: width 0.35s ease;
}
.niche-bar-fill.full {
  background: linear-gradient(90deg, var(--p-green-500), var(--color-success-strong));
}
/* Toast notification */
.settings-card { position: relative; }
.niche-toast {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  font-size: 12px;
  font-weight: 600;
  color: var(--p-white);
  background: rgba(34, 197, 94, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px 18px;
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  z-index: 10;
}
.niche-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.niche-toast.remove {
  background: rgba(239, 68, 68, 0.85);
}

/* ── Niche pills (selected) ── */
.niche-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 36px;
}
.niche-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px 7px 12px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18) 0%, rgba(236, 72, 153, 0.12) 100%);
  border: 1px solid rgba(168, 85, 247, 0.45);
  border-radius: 20px;
  color: var(--p-white);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.12);
  animation: pillIn 0.25s ease;
}
@keyframes pillIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.niche-pill-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--p-white-a10);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}
.niche-pill-x:hover {
  background: rgba(239, 68, 68, 0.6);
  color: var(--p-white);
}

/* ── Niche search input ── */
.niche-search-wrap {
  position: relative;
}
.niche-search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--p-white-a4);
  border: 1px solid var(--p-white-a8);
  border-radius: 12px;
  color: var(--p-white);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.niche-search-input::placeholder {
  color: var(--p-white-a30);
}
.niche-search-input:focus {
  border-color: rgba(168, 85, 247, 0.45);
}

/* ── Niche dropdown ── */
.niche-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  background: rgba(15, 15, 25, 0.97);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  z-index: 20;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.niche-dropdown.open {
  display: block;
}
.niche-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--p-white-a70);
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--p-white-a3);
}
.niche-dropdown-item:last-child {
  border-bottom: none;
}
.niche-dropdown-item:hover {
  background: rgba(168, 85, 247, 0.1);
  color: var(--p-white);
}
.niche-dropdown-item.selected {
  color: var(--p-purple-300);
  font-weight: 600;
}
.niche-check {
  color: var(--p-green-500);
  font-weight: 700;
  margin-left: auto;
}
.niche-dropdown-item.dimmed {
  opacity: 0.25;
}
.niche-dropdown-hint {
  padding: 10px 14px;
  font-size: 11px;
  color: rgba(255, 200, 50, 0.7);
  text-align: center;
  border-top: 1px solid var(--p-white-a4);
}
.niche-dropdown-empty {
  padding: 12px 14px;
  font-size: 12px;
  color: var(--p-white-a25);
  text-align: center;
}
/* LIO-361: блок «Ниша аккаунта» — счётчик, полоса и пилюли показывают данные, поэтому
   видны только в состоянии data (состояния ведёт core/block-state.js, стили панели —
   block-state.css). В состоянии error контролы остаются: после отката пилюли показывают
   подтверждённый сервером набор, а панель рядом даёт «Повторить». */
#nicheBlock:not([data-block-state='data']):not([data-block-state='error']) .niche-counter,
#nicheBlock:not([data-block-state='data']):not([data-block-state='error']) .niche-bar-track,
#nicheBlock:not([data-block-state='data']):not([data-block-state='error']) .niche-pills,
#nicheBlock:not([data-block-state='data']):not([data-block-state='error']) .niche-search-wrap {
  visibility: hidden;
}
.settings-select {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--p-white-a8);
  border-radius: 12px;
  padding: 12px 36px 12px 16px;
  color: var(--p-white);
  font-size: 13px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba%28255,255,255,0.5%29' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}
.settings-select:focus {
  border-color: var(--p-purple-300);
  outline: none;
  box-shadow: 0 0 8px var(--p-purple-a20);
}
.settings-select option {
  background: var(--p-bg-1);
  color: var(--p-white);
}
.custom-tone-input {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--p-white-a8);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--p-white);
  font-size: 13px;
  font-weight: 500;
  resize: vertical;
  min-height: 90px;
  margin-top: 10px;
  box-sizing: border-box;
  font-family: inherit;
  line-height: 1.5;
}
.custom-tone-input:focus {
  border-color: var(--p-purple-300);
  outline: none;
  box-shadow: 0 0 8px var(--p-purple-a20);
}
.custom-tone-input::placeholder {
  color: var(--p-white-a30);
}
.custom-tone-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--p-white-a45);
}
.custom-tone-status.ok { color: var(--p-green-500); }
.custom-tone-status.error { color: var(--color-danger); }
/* LIO-361: профиль «Мой тон» — читаемая выжимка извлечённого профиля. Строки
   профиля приходят одним textContent с переводами строк, поэтому pre-line. */
.custom-tone-profile {
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid var(--p-white-a8);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 12px;
  line-height: 1.5;
  color: var(--p-white-a45);
  white-space: pre-line;
}
/* LIO-361: состояния блоков «Тон общения» и «База знаний» ведёт core/block-state.js.
   В loading/error/no-auth контролы скрыты (панель состояния и «Повторить» живут в
   карточке, поэтому она же — panelHost). Пустые новые узлы не должны добавлять
   отступ: эталон вёрстки первого экрана снят в состоянии data. */
#toneBlock:not([data-block-state='data']):not([data-block-state='empty']) #toneControls,
#toneBlock:not([data-block-state='data']):not([data-block-state='empty']) #customToneCard,
#knowledgeBlock:not([data-block-state='data']):not([data-block-state='empty']) #knowledgeControls {
  visibility: hidden;
}
#toneStatus:empty,
#customToneProfile:empty {
  display: none;
}
/* LIO-361: ошибка загрузки фирменного стиля — отдельное состояние вместо
   «+ Создать фирменный стиль» (сбой сети показывался как отсутствие стиля). */
.brand-spotlight-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--p-white-a45);
}
.brand-spotlight-retry {
  padding: 6px 14px;
  border: 0;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: inherit;
  background: var(--p-white-a6);
  cursor: pointer;
}
.settings-channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-channel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--p-white-a5);
  border-radius: 12px;
}
.settings-channel-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-channel-name {
  font-size: 13px; font-weight: 600; color: var(--p-white);
}
.settings-channel-status {
  font-size: 10px; color: var(--color-success); font-weight: 600;
}
.settings-channel-btn-del {
  background: none; border: none; color: var(--color-danger); font-size: 12px; cursor: pointer; transition: color 0.2s;
}
.settings-channel-btn-del:hover {
  color: var(--p-red-400);
}
.settings-btn-add {
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px dashed rgba(168, 85, 247, 0.3);
  color: var(--p-purple-200);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}
.settings-btn-add:hover {
  background: var(--p-purple-a15);
  border-color: var(--p-purple-a50);
  color: var(--p-white);
}

/* iOS Toggle Switches */
.settings-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--p-white-a4);
}
.settings-switch-row:last-child {
  border-bottom: none;
}
.settings-switch-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 12px;
}
.settings-switch-title {
  font-size: 13px; font-weight: 600; color: var(--p-white);
}
.settings-switch-desc {
  font-size: 11px; color: var(--p-white-a45); line-height: 1.3;
}
.settings-switch-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.settings-switch-hidden {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.settings-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.settings-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #FFFFFF;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.settings-switch-hidden:checked + .settings-switch-track {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}
.settings-switch-hidden:checked + .settings-switch-track .settings-switch-knob {
  transform: translateX(16px);
  background: #FFFFFF;
}


/* Disabled card state */
.settings-card.disabled .content-segment-row {
  opacity: 0.3;
  pointer-events: none;
}

/* Link rows */
.settings-row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.01);
  border: 1px solid var(--p-white-a4);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--p-white);
  text-decoration: none;
  margin-bottom: 8px;
}
.settings-row-link:last-child {
  margin-bottom: 0;
}
.settings-row-link:hover {
  background: var(--p-white-a3);
  border-color: var(--p-purple-a20);
}
.settings-row-text {
  font-size: 13px; font-weight: 500;
}
.settings-row-chevron {
  width: 16px; height: 16px;
  color: var(--p-white-a30);
  transition: transform 0.2s;
}
.settings-row-link:hover .settings-row-chevron {
  transform: translateX(2px);
  color: var(--p-purple-300);
}

.settings-footer {
  text-align: center;
  padding: 24px 0 10px;
  color: var(--p-white-a25);
  font-size: 10px;
  font-family: monospace;
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* ── Brand Style Spotlight (in AI settings) ── */

.brand-spotlight {
  margin-top: 12px;
}

.brand-spotlight-loading {
  font-size: 12px;
  color: var(--p-white-a25);
  text-align: center;
  padding: 12px 0;
}

.brand-spotlight-empty {
  text-align: center;
  padding: 16px 12px;
  border: 1px dashed var(--p-white-a10);
  border-radius: 14px;
  color: var(--p-white-a30);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.25s;
  text-decoration: none;
  display: block;
}
.brand-spotlight-empty:hover {
  border-color: var(--p-purple-a35);
  color: rgba(255, 255, 255, 0.5);
  background: rgba(168, 85, 247, 0.04);
}

.brand-spotlight-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--p-white-a6);
  background: rgba(255, 255, 255, 0.02);
  text-decoration: none;
  transition: all 0.3s;
  position: relative;
  overflow: visible;
}
.brand-spotlight-card.has-glow {
  border-color: transparent;
  box-shadow: 0 0 32px var(--spotlight-glow, var(--p-purple-a20)),
    0 8px 24px rgba(0,0,0,0.3);
}
.brand-spotlight-card:hover {
  background: var(--p-white-a4);
}

.brand-spotlight-preview {
  width: 56px; height: 56px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-top: -8px;
  overflow: hidden;
}
.brand-spotlight-preview img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 12px;
}

.brand-spotlight-info {
  flex: 1; min-width: 0;
}
.brand-spotlight-name {
  font-size: 14px; font-weight: 700;
  color: var(--p-white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-spotlight-status {
  font-size: 11px; color: var(--p-green-500); font-weight: 600;
  margin-top: 2px;
}

.brand-style-manage {
  display: block;
  margin-top: 12px;
  font-size: 12px; font-weight: 600;
  color: rgba(168, 85, 247, 0.7);
  text-decoration: none;
  text-align: center;
  transition: color 0.2s;
}
.brand-style-manage:hover {
  color: var(--p-purple-200);
}

/* ── Картинки к новостям (LIO-361) ── */

/* Управление видно только когда настройка прочитана: в скелетоне и при отказе
   сервера тумблер с дефолтом выглядел бы как реальное значение пользователя. */
#newsImageBlock:not([data-block-state='data']) #newsImageEnabledRow,
#newsImageBlock:not([data-block-state='data']) #newsImageCountRow {
  display: none;
}

/* ── Utilities ── */
.mt-10 { margin-top: 10px; }

