/* StudyCat — дизайн-система из prototype/index.html + токены фазы 4 */

:root {
  --purple: #7736F8;
  --purple-dark: #5e20d8;
  --purple-dim: rgba(119, 54, 248, 0.1);
  --purple-mid: rgba(119, 54, 248, 0.18);
  --bg: #ffffff;
  --bg-soft: #f9f8ff;
  /* Цвет текста выровнен с каталогом (#272439) — единый визуальный язык */
  --text: #272439;
  --muted: #6b6180;
  --border: #e8e2f8;
  --success: #16a34a;
  --tg: #229ED9;
  --radius: 12px;
  --radius-lg: 20px;
  --container: 1140px;
  /* Шрифты как в каталоге: Manrope — основной текст, Unbounded — крупные
     заголовки (каталог использует именно Unbounded 800 для секционных
     заголовков, напр. «Поиск работ по типам»). Единый визуальный язык с
     витриной. Unbounded/Manrope — локальная статика (vendor), Inter — фолбэк. */
  --font: Manrope, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: Unbounded, var(--font);
  /* Токены фазы 4 (04-UI-SPEC) */
  --sidebar-width: 300px;
  --navbar-height: 58px;
  --search-border-catalog: #a78bfa;
  --search-border-glossary: #c4b5fd;
  --bubble-user-bg: #f1f0f5;
  --bubble-ai-bg: var(--purple-dim);
  --toast-error-bg: #fef2f2;
  --toast-error-border: #fecaca;
  --toast-error-text: #991b1b;
}

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

html {
  scroll-behavior: smooth;
}

[x-cloak] {
  display: none !important;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Body-scroll-lock при открытом mobile drawer (REQ-226, D-10) */
body.body--no-scroll {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

.wrap,
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.sec {
  padding: 64px 0;
}

.sec-sm {
  padding: 40px 0;
}

/* Типографика */
.h1 {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.h2 {
  /* Секционные заголовки как в каталоге (.title-v1): Unbounded 800, 36px,
     трекинг normal, цвет var(--text). Единый визуальный язык с витриной. */
  font-size: clamp(24px, 3.4vw, 36px);
  font-weight: 800;
  letter-spacing: normal;
  line-height: 1.2;
}

.h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Крупные заголовки страниц — Unbounded (акцентный дисплей-шрифт, как в каталоге) */
.h1,
.h2,
.pricing-title,
.glossary-title,
.subject-hero-title,
.ege-title,
.dashboard-title,
.flashcards-title {
  font-family: var(--font-display);
}

.lead {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.65;
}

.small {
  font-size: 13px;
}

.accent {
  color: var(--purple);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  transition: background 0.16s, opacity 0.16s, transform 0.1s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--purple);
  color: #fff;
  padding: 11px 22px;
}

.btn-primary:hover {
  background: var(--purple-dark);
}

.btn-outline {
  background: transparent;
  color: var(--purple);
  border: 1.5px solid var(--purple);
  padding: 10px 20px;
}

.btn-outline:hover {
  background: var(--purple-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
}

.btn-ghost:hover {
  color: var(--purple);
}

.btn-lg {
  font-size: 16px;
  padding: 14px 32px;
  border-radius: 11px;
}

/* Теги */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

.tag-purple {
  background: var(--purple-dim);
  color: var(--purple);
}

.tag-green {
  background: #f0fdf4;
  color: var(--success);
}

.tag-gray {
  background: #f1f0f5;
  color: var(--muted);
}

.tag-tg {
  background: rgba(34, 158, 217, 0.12);
  color: var(--tg);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

/* Шапка тянется на всю ширину экрана — единообразие с шапкой каталога
   (v2.1): там контейнер full-bleed. Контент внутри остаётся в .wrap,
   а сама панель навигации занимает всю ширину. */
.navbar .wrap {
  max-width: none;
  padding: 0 40px;
}

@media (max-width: 768px) {
  .navbar .wrap {
    padding: 0 20px;
  }
  /* На мобильном сетка не нужна — только бренд слева и бургер справа.
     Селектор .navbar .navbar-inner (специфичность 0,2,0) обязателен: базовое
     правило .navbar-inner{display:grid} идёт ниже по файлу и при равной
     специфичности победило бы по порядку — тогда бургер уезжал в центральную
     колонку сетки (фидбэк по мобиле: «бургер по середине»). */
  .navbar .navbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

.navbar-inner {
  /* Сетка 1fr auto 1fr — меню строго по центру шапки, как в каталоге
     (v2.1 «единообразие»): слева бренд, по центру ссылки, справа аккаунт. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  height: var(--navbar-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.brand img {
  width: 30px;
  height: 30px;
}

.brand span {
  color: var(--purple);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  justify-self: center;
}

.nav-links a {
  /* Пункты меню как в каталоге (.menu-item): Manrope 16px, 800, тёмный текст. */
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  padding: 6px 16px;
  border-radius: 7px;
  transition: color 0.14s, background 0.14s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-links a.active {
  color: var(--purple);
  background: var(--purple-dim);
}

.nav-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Дропдаун пользователя и mobile-бургер (план 05-06, D-30) */
.nav-desktop {
  display: flex;
}

.nav-mobile {
  display: none;
  margin-left: auto;
  position: relative;
}

.nav-guest {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user {
  position: relative;
}

.nav-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 100px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.14s;
}

.nav-user-btn:hover {
  border-color: var(--purple);
}

.nav-user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-user-caret {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.18s;
}

.nav-user-caret.is-open {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: 0 12px 28px rgba(23, 16, 46, 0.1);
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-item {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
}

.nav-dropdown-item:hover {
  background: var(--purple-dim);
  color: var(--purple);
}

.nav-dropdown-logout {
  color: var(--text);
}

.nav-dropdown-logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.nav-burger {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 12px;
  font-size: 18px;
  color: var(--text);
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}

.nav-burger:hover {
  border-color: var(--purple);
  color: var(--purple);
}

/* Затемняющая подложка мобильного меню (drawer). Начинается под навбаром,
   чтобы бургер-«✕» оставался кликабельным поверх неё. Внутри .nav-mobile,
   который display:none на десктопе — так что на десктопе подложки нет. */
.nav-mobile-backdrop {
  /* ВАЖНО: у .navbar есть backdrop-filter — он делает навбар containing-block'ом
     для position:fixed потомков. Поэтому top/bottom мерились бы от навбара (высота
     ~58px) и bottom:0 схлопывал подложку в 0. Используем height:100vh (вьюпорт-
     единицы не зависят от containing-block) вместо bottom:0. */
  position: fixed;
  top: var(--navbar-height);
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(23, 16, 46, 0.45);
  z-index: 115;
}

.nav-mobile-sheet {
  /* Полноширинная панель под навбаром (а не узкая выпадашка): не «просвечивает»
     контентом, скроллится при длинном меню, углы скруглены снизу. */
  position: fixed;
  top: var(--navbar-height);
  left: 12px;
  right: 12px;
  max-height: calc(100vh - var(--navbar-height) - 24px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: 0 20px 44px rgba(23, 16, 46, 0.22);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-mobile-link {
  display: block;
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
}

.nav-mobile-link:hover {
  background: var(--purple-dim);
  color: var(--purple);
}

.nav-mobile-primary {
  background: var(--purple);
  color: #fff !important;
  margin-top: 4px;
}

.nav-mobile-primary:hover {
  background: var(--purple-dark);
  color: #fff !important;
}

.nav-mobile-logout {
  color: var(--text);
}

.nav-mobile-logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.nav-mobile-sep {
  margin: 6px 4px;
  border: none;
  border-top: 1px solid var(--border);
}

.email-confirm-banner {
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  padding: 12px 20px;
  text-align: center;
  font-size: 14px;
  color: #92400e;
}

.email-confirm-banner__button {
  margin-left: 12px;
  padding: 6px 16px;
  font-size: 13px;
  border-color: #92400e;
  color: #92400e;
}

@media (max-width: 768px) {
  .nav-desktop {
    display: none !important;
  }
  .nav-mobile {
    display: block;
  }
  .nav-links.nav-desktop {
    display: none !important;
  }
}

/* Hero (главная) */
.hero {
  padding: 60px 0 52px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.hero-center {
  max-width: 660px;
  margin: 0 auto;
  text-align: center;
}

.mascot {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
}

.home-hero-title {
  margin-bottom: 14px;
}

.home-hero-lead {
  max-width: 520px;
  margin: 0 auto 28px;
}

/* Hero: режимы и поиск (прототип) */
.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}

.mode-tab {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-tab.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.mode-tab:not(.active):hover {
  border-color: var(--purple);
  color: var(--purple);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 14px;
  padding: 8px 8px 8px 20px;
  border: 2px solid var(--purple);
  transition: border-color 0.2s;
  margin-bottom: 14px;
}

.search-box.mode-catalog {
  border-color: var(--search-border-catalog);
}

.search-box.mode-glossary {
  border-color: var(--search-border-glossary);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--muted);
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 16px;
}

.quick-btn {
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.14s;
}

.quick-btn:hover {
  background: var(--purple-dim);
  border-color: #c4b0f4;
  color: var(--purple);
}

.quick-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* REQ-410/411/412: ряд быстрых действий и экспорта под ответом ассистента.
   Переиспользует .quick-btn (D-23), новых цветов не вводит. */
.answer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

/* REQ-411/412: компактная кнопка-иконка скачивания (PDF). Переиспользует
   палитру дизайн-системы (D-23), новых цветов не вводит. Иконка-only под
   ответом и иконка+подпись для скачивания всего диалога. */
.icon-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.14s;
}

.icon-download-btn:hover {
  background: var(--purple-dim);
  border-color: #c4b0f4;
  color: var(--purple);
}

.icon-download-btn svg {
  display: block;
  flex-shrink: 0;
}

/* REQ-411/412: ряд экспорта всей сессии над подсказками/композером. */
.session-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.live-counter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.home-section-soft-border {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.home-section-border {
  border-bottom: 1px solid var(--border);
}

.home-section-top-border {
  border-top: 1px solid var(--border);
}

.home-section-soft-top {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}

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

.home-section-header--compact {
  align-items: flex-end;
  margin-bottom: 8px;
}

.home-section-header--wide {
  align-items: flex-end;
  margin-bottom: 24px;
}

.home-section-header-center {
  text-align: center;
  margin-bottom: 44px;
}

.home-section-kicker {
  margin-top: 4px;
  font-size: 14px;
}

.home-live-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.home-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-stack--sm {
  gap: 6px;
}

.home-trend-name {
  flex: 1;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.catalog-results {
  text-align: left;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.catalog-results-status,
.catalog-results-empty {
  color: var(--muted);
  padding: 8px 4px;
}

.catalog-result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
  text-align: left;
}

.catalog-result-card:hover {
  border-color: #c4b0f4;
}

.catalog-result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--purple);
  display: block;
  margin-bottom: 6px;
}

.catalog-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-result-subject {
  color: var(--muted);
}

/* Два канала */
.channels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.channel-card {
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s;
}

.channel-card:hover {
  border-color: #c4b0f4;
}

.channel-card-tg {
  border-color: rgba(34, 158, 217, 0.35);
  background: rgba(34, 158, 217, 0.05);
}

.channel-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channel-icon-web {
  background: var(--purple-dim);
}

.channel-icon-tg {
  background: rgba(34, 158, 217, 0.15);
}

.channel-meta {
  flex: 1;
}

.channel-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
}

.channel-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Trending */
.trending-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.trending-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 10px;
}

.trend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.14s;
  font-size: 13px;
}

.trend-item:hover {
  border-color: #c4b0f4;
  background: var(--purple-dim);
}

.trend-num {
  font-size: 11px;
  color: var(--muted);
  width: 14px;
  text-align: right;
  flex-shrink: 0;
}

.trend-delta {
  margin-left: auto;
  font-size: 11px;
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
}

.query-item {
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.14s;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.query-item:hover {
  border-color: #c4b0f4;
  background: var(--purple-dim);
  color: var(--purple);
}

.query-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.term-card {
  background: var(--purple-dim);
  border: 1px solid #d4bbfc;
  border-radius: 11px;
  padding: 16px;
  margin-bottom: 10px;
}

.term-word {
  font-size: 16px;
  font-weight: 800;
  color: var(--purple);
  margin-bottom: 6px;
}

.term-def {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 10px;
}

.term-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.term-nav-btn {
  font-family: var(--font);
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 10px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.14s;
}

.term-nav-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.term-nav-btn--push {
  margin-left: auto;
}

.home-title-offset-sm {
  margin-top: 4px;
}

.article-mini {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.14s;
  display: block;
}

.article-mini:hover {
  border-color: #c4b0f4;
}

.article-mini-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 4px;
}

.article-mini-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

/* AI в действии */
.examples-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ex-tab {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.14s;
}

.ex-tab.active {
  background: var(--purple-dim);
  border-color: var(--purple);
  color: var(--purple);
}

.example-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.home-section-intro {
  margin-bottom: 24px;
}

.home-section-title-tight {
  margin-bottom: 6px;
}

.home-section-title-tight-sm {
  margin-bottom: 4px;
}

.home-section-subtitle-sm {
  font-size: 14px;
}

.example-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 96%;
}

.bubble-user {
  background: var(--bubble-user-bg);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.bubble-ai {
  background: var(--bubble-ai-bg);
  border-bottom-left-radius: 4px;
  white-space: pre-line;
}

.example-right {
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.ex-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.ex-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
}

.ex-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--purple);
}

.ex-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.ex-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--purple-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.ex-check::after {
  content: "";
  width: 6px;
  height: 4px;
  border-left: 1.5px solid var(--purple);
  border-bottom: 1.5px solid var(--purple);
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* Сетка предметов каталога */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.subjects-grid--catalog {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 0;
}

.subject-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}

.subject-card:hover {
  border-color: #c4b0f4;
  background: var(--purple-dim);
}

.subject-card--catalog {
  align-items: stretch;
  text-align: left;
  padding: 16px;
  display: block;
  cursor: pointer;
  transition: all 0.16s;
}

.subject-card--catalog:hover {
  transform: translateY(-1px);
}

.subject-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subject-count {
  font-size: 12px;
  color: var(--muted);
}

.subject-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.subject-fill {
  height: 100%;
  background: var(--purple);
  border-radius: 2px;
}

.subject-fill--rank-1 {
  width: 100%;
}

.subject-fill--rank-2 {
  width: 77%;
}

.subject-fill--rank-3 {
  width: 71%;
}

.subject-fill--rank-4 {
  width: 63%;
}

.subject-fill--rank-5 {
  width: 55%;
}

.subject-fill--rank-6 {
  width: 50%;
}

.subject-fill--rank-7 {
  width: 40%;
}

.subject-fill--rank-8 {
  width: 33%;
}

.subject-fill--rank-9 {
  width: 31%;
}

.subject-fill--rank-10 {
  width: 27%;
}

.subject-fill--rank-11 {
  width: 24%;
}

.subject-fill--rank-12 {
  width: 21%;
}

.home-catalog-lead {
  font-size: 14px;
  margin-bottom: 24px;
}

.subject-card-icon {
  font-size: 28px;
  line-height: 1;
}

.subject-card-name {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* Статьи */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.article-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.14s;
}

.article-card:hover {
  border-color: #c4b0f4;
}

.article-section {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.article-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  flex: 1;
}

.article-date {
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

/* Словарь-полоса */
.dict-strip {
  background: var(--purple-dim);
  border-top: 1px solid #d4bbfc;
  border-bottom: 1px solid #d4bbfc;
  padding: 24px 0;
}

.dict-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.dict-text {
  flex: 1;
  min-width: 200px;
}

.home-dict-desc {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.home-no-shrink {
  flex-shrink: 0;
}

.dict-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--purple);
}

.dict-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dict-chip {
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid #d4bbfc;
  border-radius: 100px;
  padding: 5px 13px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.14s;
}

.dict-chip:hover {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

/* Отзывы */
.reviews-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.review-meta-nums {
  display: flex;
  gap: 32px;
}

.review-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--purple);
  letter-spacing: -0.02em;
}

.review-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

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

.review-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-stars {
  display: flex;
  gap: 3px;
}

.star {
  width: 13px;
  height: 13px;
  background: var(--purple);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

.star-off {
  background: #e2dff0;
}

.review-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  flex: 1;
}

.review-body::before {
  content: "\201C";
}

.review-body::after {
  content: "\201D";
}

.review-author {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.review-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--purple-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--purple);
  flex-shrink: 0;
}

.review-name {
  font-size: 13px;
  font-weight: 700;
}

.review-role {
  font-size: 12px;
  color: var(--muted);
}

/* Тарифы */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  background: var(--bg);
  position: relative;
}

.plan-card-featured {
  border-color: var(--purple);
  background: var(--bg-soft);
}

.plan-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 100px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.plan-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.plan-price {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.plan-price span {
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 18px 0 22px;
}

.plan-features li {
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.feat-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--purple-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.feat-dot::after {
  content: "";
  width: 5px;
  height: 3.5px;
  border-left: 1.5px solid var(--purple);
  border-bottom: 1.5px solid var(--purple);
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

/* FAQ */
.faq-wrap {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-wrap details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-wrap details[open] {
  border-color: #c4b0f4;
}

.faq-wrap summary {
  padding: 15px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.faq-wrap summary::-webkit-details-marker {
  display: none;
}

.faq-wrap summary:hover {
  background: var(--bg-soft);
}

.faq-wrap details[open] summary {
  background: var(--purple-dim);
  color: var(--purple);
}

.faq-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.15s;
}

.faq-wrap details[open] .faq-icon {
  transform: rotate(180deg);
  background: var(--purple);
}

.faq-body {
  padding: 0 18px 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.home-section-title-center {
  text-align: center;
  margin-bottom: 32px;
}

/* CTA */
.cta-banner {
  background: var(--purple);
  border-radius: var(--radius-lg);
  padding: 52px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner::before,
.cta-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.cta-banner::before {
  width: 320px;
  height: 320px;
  top: -100px;
  right: -80px;
  background: rgba(255, 255, 255, 0.07);
}

.cta-banner::after {
  width: 240px;
  height: 240px;
  bottom: -80px;
  left: -60px;
  background: rgba(255, 255, 255, 0.05);
}

.home-cta-title,
.home-cta-text,
.home-cta-actions {
  position: relative;
  z-index: 1;
}

.home-cta-title {
  color: #fff;
  margin-bottom: 10px;
}

.home-cta-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 16px;
  margin-bottom: 28px;
}

.home-cta-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.home-cta-primary {
  background: #fff;
  color: var(--purple);
  font-weight: 700;
}

.home-cta-outline {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

.placeholder-block {
  padding: 32px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.error-page-hero {
  padding: 72px 20px;
}

.error-page-container {
  max-width: 840px;
  margin: 0 auto;
  text-align: center;
}

.error-page-subtitle {
  max-width: 620px;
  margin: 18px auto 0;
}

.error-page-actions {
  justify-content: center;
  margin-top: 32px;
}

/* ——— Страница чата (04-UI-SPEC) ——— */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  background: var(--bg);
}

.chat-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  flex-shrink: 0;
  z-index: 110;
}

.chat-menu-btn {
  min-width: 44px;
  min-height: 44px;
}

.chat-header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}

.chat-header-brand .accent {
  color: var(--purple);
}

.btn-sm {
  font-size: 13px;
  padding: 8px 14px;
}

.chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.chat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 16, 46, 0.4);
  z-index: 140;
}

.chat-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-soft);
  overflow: hidden;
  min-height: 0;
}

.chat-sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 18px 0;
  flex-shrink: 0;
}

.chat-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.chat-sidebar-brand .accent {
  color: var(--purple);
}

.chat-sidebar-close {
  display: none;
}

.chat-sidebar-new {
  width: calc(100% - 36px);
  margin: 14px 18px 8px;
  flex-shrink: 0;
  font-weight: 600;
}

.chat-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-sidebar-history-section {
  flex: 1;
  border-bottom: none;
}

.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 2px;
}

.sidebar-group-title--sub {
  margin: 10px 0 6px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* Режимы AI: вертикальные кнопки в sidebar (стиль mode-tab из Hero) */
.chat-sidebar-modes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-sidebar-mode-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-height: 44px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

/* Иконка режима в левой панели: декоративный префикс, не влияет на цвет текста. */
.chat-sidebar-mode-icon {
  flex: 0 0 auto;
  font-size: 15px;
  line-height: 1;
}

.chat-sidebar-mode-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.chat-sidebar-mode-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* Предметы: пилюли как .quick-btn на главной, без иконок */
.chat-sidebar-subjects-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-sidebar-subject-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 11px;
  min-height: 44px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.chat-sidebar-subject-btn:hover {
  background: var(--purple-dim);
  border-color: #c4b0f4;
  color: var(--purple);
}

.chat-sidebar-subject-btn.active {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  font-weight: 600;
}

.chat-sidebar-history-group {
  display: flex;
  flex-direction: column;
}

.sidebar-session {
  display: flex;
  align-items: stretch;
  gap: 4px;
  width: 100%;
  margin-bottom: 2px;
  border: none;
  border-radius: 9px;
  background: transparent;
  transition: background 0.15s;
}

.sidebar-session:hover,
.sidebar-session.active {
  background: var(--purple-dim);
}

.sidebar-session-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  min-height: 44px;
}

.sidebar-session-preview {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sidebar-session-mode {
  font-size: 12px;
  color: var(--muted);
}

/* Поиск по сессиям (07-07) */
.sidebar-search-wrap {
  position: relative;
  margin: 4px 0 8px;
}

.sidebar-search {
  width: 100%;
  padding: 8px 28px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 36px;
}

.sidebar-search:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.sidebar-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.sidebar-search-clear:hover {
  background: var(--purple-dim);
  color: var(--purple);
}

/* Inline-rename input (07-07) */
.session-rename-input {
  flex: 1;
  padding: 9px 10px;
  border: 1.5px solid var(--purple);
  border-radius: 9px;
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  min-height: 44px;
}

/* Кнопка удаления сессии (07-07) */
.session-delete-btn {
  flex-shrink: 0;
  width: 32px;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 9px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.sidebar-session:hover .session-delete-btn,
.session-delete-btn:focus-visible {
  opacity: 1;
}

.session-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

@media (hover: none) {
  /* На touch-устройствах кнопка всегда видна */
  .session-delete-btn { opacity: 1; }
}

.chat-sidebar-anon {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-sidebar-muted {
  font-size: 13px;
  color: var(--muted);
}

.chat-sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  flex-shrink: 0;
  background: var(--bg-soft);
}

.chat-upgrade-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--purple);
  font-weight: 600;
  font-size: 13px;
}

/* === Виджет аккаунта в нижней части chat-sidebar (REQ-304, D-05) ===
   Δ 11-04 hotfix: компактная карточка по образцу Discord / Notion / Slack.
   Весь блок — это ссылка на /dashboard. Без дубликата счётчика лимита
   (он уже отображается в композере над инпутом). Ссылка «Улучшить тариф»
   снизу — пропорциональная inline-ссылка, не растягивается на всю ширину. */
.account-widget {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.account-widget__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin: -6px -8px 0;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}
.account-widget__link:hover,
.account-widget__link:focus-visible {
  background: var(--purple-dim);
  text-decoration: none;
}
.account-widget__avatar {
  width: 34px;
  height: 34px;
  border-radius: 100px;
  background: var(--purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.account-widget__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}
.account-widget__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.25;
}
.account-widget__tier {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-widget__upgrade-link {
  font-size: 12px;
  color: var(--purple);
  text-decoration: none;
  font-weight: 600;
  align-self: flex-start;
  /* выровнен под именем: 34px аватар + 10px gap + 8px padding-left .account-widget__link */
  margin-left: 52px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.12s ease;
}
.account-widget__upgrade-link:hover,
.account-widget__upgrade-link:focus-visible {
  color: var(--purple-dark);
  text-decoration: underline;
}
.account-widget__guest {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-widget__guest-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.account-widget__guest-link:hover,
.account-widget__guest-link:focus-visible {
  background: var(--purple-dim);
  color: var(--text);
}
.account-widget__guest-cta {
  font-size: 13px;
  font-weight: 600;
  color: white;
  background: var(--purple);
  padding: 6px 12px;
  border-radius: 9px;
  text-decoration: none;
  flex: 1;
  text-align: center;
  transition: background 0.12s ease;
}
.account-widget__guest-cta:hover,
.account-widget__guest-cta:focus-visible {
  background: var(--purple-dark);
}

.chat-main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

/* Кнопка «Новые сообщения ↓» — показывается, когда auto-scroll выключен (REQ-228, D-13) */
.chat-scroll-down-btn {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding: 8px 14px;
  background: var(--purple);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(119, 54, 248, 0.35);
  transition: background 0.15s, transform 0.15s;
  min-height: 36px;
}

.chat-scroll-down-btn:hover {
  background: var(--purple-dark);
  transform: translateX(-50%) translateY(-1px);
}

.chat-scroll-down-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .chat-scroll-down-btn {
    bottom: 108px;
  }
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  max-width: 640px;
  padding: 24px;
  width: 100%;
}

.chat-empty-mascot {
  margin: 0 auto 20px;
}

.chat-empty-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  line-height: 1.3;
}

.chat-hint-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-hint-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
}

.chat-hint-card:hover {
  border-color: #c4b0f4;
  background: var(--purple-dim);
}

/* === Витрина сценариев (фаза 16, REQ-400/401/402) === */
/* Только токены :root; дизайн-система не меняется. */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.scenario-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 120px;
  padding: 28px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.scenario-card:hover {
  border-color: #c4b0f4;
  background: var(--purple-dim);
  box-shadow: 0 4px 16px rgba(119, 54, 248, 0.12);
}

.scenario-card--link {
  text-decoration: none;
  color: var(--text);
}

.scenario-card__title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
}

.scenario-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  margin-top: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
}

/* Поля сценарной мини-формы крупнее, чем в workflow-card (которую не трогаем). */
.scenario-form .workflow-card__field {
  gap: 8px;
  font-size: 15px;
}

.scenario-form .workflow-card__field input,
.scenario-form .workflow-card__field textarea {
  padding: 14px 16px;
  font-size: 16px;
  border-radius: var(--radius);
}

.scenario-form .workflow-card__field textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}

.scenario-form__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.scenario-form__buttons .btn {
  font-size: 16px;
  padding: 12px 28px;
}

/* Мобильные: кнопки сценария/воркфлоу — на всю ширину в столбик, чтобы
   «Запустить»/«Отмена» стояли ровно под полями формы, а не «как придётся»
   (левый рваный ряд под full-width инпутами — фидбэк по мобиле). Плюс убираем
   лишние боковые отступы карточки сценария, чтобы поля/плейсхолдеры не обрезались. */
@media (max-width: 768px) {
  .scenario-form {
    padding: 20px 16px;
  }
  .scenario-form__buttons,
  .workflow-card__buttons {
    flex-direction: column;
    align-items: stretch;
  }
  .scenario-form__buttons .btn,
  .workflow-card__buttons .btn {
    width: 100%;
    justify-content: center;
  }
}

.bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.55;
}

.bubble-user {
  align-self: flex-end;
  background: var(--purple-dim);
  border-radius: var(--radius-lg);
}

.bubble-ai {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(23, 16, 46, 0.06);
  white-space: normal;
}

.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-markdown {
  word-break: break-word;
  line-height: 1.5;
  font-size: 14px;
  white-space: normal;
}

.bubble-markdown-body {
  white-space: normal;
}

/* Индикатор «изучаю фото…» внутри placeholder-bubble (REQ-227, D-12) */
.vision-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--purple-dim);
  color: var(--purple);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  animation: vision-pulse 1.5s ease-in-out infinite;
}

@keyframes vision-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.bubble-markdown-body > :first-child {
  margin-top: 0;
}

.bubble-markdown-body > :last-child {
  margin-bottom: 0;
}

.bubble-markdown p {
  margin: 0 0 0.45em;
}

.bubble-markdown p:last-child {
  margin-bottom: 0;
}

.bubble-markdown > :first-child {
  margin-top: 0;
}

.bubble-markdown > :last-child {
  margin-bottom: 0;
}

.bubble-markdown h1,
.bubble-markdown h2,
.bubble-markdown h3 {
  margin: 0.65em 0 0.35em;
  font-weight: 700;
  line-height: 1.3;
}
.bubble-markdown h1 { font-size: 18px; }
.bubble-markdown h2 { font-size: 16px; }
.bubble-markdown h3 { font-size: 15px; }

.bubble-markdown ul,
.bubble-markdown ol {
  margin: 0.35em 0 0.45em 1.1em;
  padding: 0;
}
.bubble-markdown li {
  margin: 0.12em 0;
}

/* marked делает "loose list", если AI ставит пустую строку между пунктами.
   Без этого каждый пункт получает вложенный <p> с большим нижним margin. */
.bubble-markdown li > p {
  margin: 0;
}

.bubble-markdown li > p + p {
  margin-top: 0.25em;
}

.bubble-markdown blockquote {
  border-left: 3px solid var(--purple-mid);
  padding: 0.2em 0 0.2em 0.8em;
  margin: 0.4em 0;
  color: var(--muted);
}

.bubble-markdown blockquote:empty,
.bubble-markdown blockquote:has(> p:only-child:empty) {
  display: none;
}

.bubble-markdown a {
  color: var(--purple);
  text-decoration: underline;
}

.bubble-markdown table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0;
  font-size: 13px;
}
.bubble-markdown th,
.bubble-markdown td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.bubble-markdown th {
  background: var(--bg-soft);
  font-weight: 600;
}

.bubble-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  padding: 1px 4px;
  background: rgba(23, 16, 46, 0.06);
  border-radius: 4px;
}
.bubble-markdown pre {
  position: relative;
  margin: 0.6em 0;
  padding: 12px 14px;
  background: #0d1117;
  color: #e6edf3;
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}
.bubble-markdown pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Кнопка «копировать» внутри code-блоков (D-05 фазы 7, REQ-222). */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #c9d1d9;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.24);
}
.code-copy-btn:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}

/* KaTeX-оверрайды (REQ-221, D-03 фазы 7): чуть крупнее текста + горизонтальный
   скролл для широких display-формул на mobile, чтобы не ломать layout. */
.bubble-markdown .katex {
  font-size: 1.05em;
}
.bubble-markdown .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
  margin: 0.35em 0;
}

.bubble-markdown--streaming {
  line-height: 1.55;
}

.bubble-stream-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-attachment-preview {
  max-height: 160px;
  border-radius: 8px;
  margin-bottom: 8px;
  object-fit: contain;
}

.streaming-cursor {
  display: inline;
  color: var(--purple);
  animation: chat-blink 1s step-end infinite;
  vertical-align: baseline;
  margin-left: 1px;
}

@keyframes chat-blink {
  50% {
    opacity: 0;
  }
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px 12px;
  flex-shrink: 0;
}

.quick-btn {
  font-size: 12px;
  border-radius: 100px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.quick-btn:hover {
  background: var(--purple-dim);
  color: var(--purple);
}

.chat-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: 420px;
  width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--toast-error-bg);
  border: 1px solid var(--toast-error-border);
  color: var(--toast-error-text);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(23, 16, 46, 0.12);
}

.chat-toast-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}

.chat-composer-wrap {
  flex-shrink: 0;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.chat-limit-label {
  font-size: 12px;
  color: var(--muted);
}

.chat-subject-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid #c4b0f4;
  border-radius: 100px;
  padding: 3px 4px 3px 10px;
}

.chat-subject-pill-clear {
  border: none;
  background: transparent;
  color: var(--purple);
  font-size: 16px;
  line-height: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-subject-pill-clear:hover {
  background: rgba(119, 54, 248, 0.15);
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-file-input {
  display: none;
}

.chat-attach-btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
}

.chat-composer-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  max-height: 96px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.chat-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.attachment-preview-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}

.attachment-preview-name {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-preview-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}

/* Превью фото внутри мини-формы сценария (welcome-экран, composer скрыт). */
.attachment-preview--form {
  margin-top: 10px;
}

.scenario-form__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Кликабельная миниатюра фото — открывает лайтбокс. */
.is-zoomable {
  cursor: zoom-in;
}

/* Лайтбокс просмотра фото на весь экран (фидбэк UAT фазы 16). */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(23, 16, 46, 0.82);
  cursor: zoom-out;
}

.img-lightbox-img {
  max-width: min(92vw, 1100px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.img-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.14s;
}

.img-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-send-btn {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px;
}

.chat-loading-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  max-width: 320px;
}

.chat-skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-soft) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: chat-shimmer 1.2s ease-in-out infinite;
}

.chat-skeleton-line--short {
  width: 60%;
}

@keyframes chat-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (max-width: 960px) {
  .chat-header {
    display: flex;
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(23, 16, 46, 0.08);
  }

  .chat-sidebar--open {
    transform: translateX(0);
  }

  .chat-sidebar-close {
    display: inline-flex;
  }

  .chat-overlay {
    display: block;
  }

  .chat-sidebar-top .chat-sidebar-brand {
    display: none;
  }
}

@media (max-width: 640px) {
  .chat-messages {
    padding: 16px;
  }

  .chat-composer-wrap {
    padding: 12px 16px 16px;
  }

  .chat-attach-btn,
  .chat-send-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Auth-страницы (план 05-07, D-28) */
.auth-section {
  padding: 64px 16px 80px;
  background: var(--bg-soft);
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 28px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(119, 54, 248, 0.08);
}

.auth-card--center {
  text-align: center;
}

.auth-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.55;
}

.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.form-input:disabled {
  background: var(--bg-soft);
  color: var(--muted);
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
  margin-bottom: 12px;
}

.auth-helper-row {
  text-align: right;
  margin: -8px 0 16px;
}

.auth-helper-link {
  color: var(--purple);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.auth-helper-link:hover {
  text-decoration: underline;
}

.auth-status-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 16px;
}

.auth-status-icon--success {
  color: var(--success);
}

.auth-status-icon--error {
  color: #dc2626;
}

.auth-status-note {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.6;
}

.auth-full-cta {
  width: 100%;
  justify-content: center;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
}

.auth-google {
  width: 100%;
  justify-content: center;
  margin-top: 10px;
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-soon {
  font-size: 11px;
  background: var(--purple-dim);
  color: var(--purple);
  border-radius: 100px;
  padding: 2px 8px;
  margin-left: 6px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-foot {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
}

.auth-foot a {
  color: var(--purple);
  font-weight: 600;
}

.auth-foot a:hover {
  text-decoration: underline;
}

/* Pricing-страница (план 05-08, D-21..D-23) */
.pricing-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.pricing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.pricing-sub {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 28px;
}

.pricing-toggle {
  display: inline-flex;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px;
}

.pricing-toggle .btn {
  border-radius: 100px;
  padding: 8px 18px;
}

.pricing-toggle-save {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 6px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 64px;
}

.pricing-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 28px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.pricing-card--featured {
  border-color: var(--purple);
  box-shadow: 0 8px 32px var(--purple-dim);
  transform: translateY(-4px);
}

.pricing-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--purple);
  color: white;
  border-radius: 100px;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pricing-card-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.pricing-card-price {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.pricing-card-period {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-save {
  background: rgba(22, 163, 74, 0.15);
  color: var(--success);
  border-radius: 100px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

.pricing-card-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  flex-grow: 1;
  font-size: 14px;
  line-height: 1.6;
}

.pricing-card-features li {
  padding: 6px 0 6px 22px;
  position: relative;
  color: var(--text);
}

.pricing-card-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--purple);
  font-weight: 700;
}

.pricing-card-cta {
  width: 100%;
  justify-content: center;
}

.pricing-card-cta-button {
  width: 100%;
}

.home-plan-cta {
  width: 100%;
  justify-content: center;
}

.home-section-title-pricing {
  margin-bottom: 8px;
}

.home-pricing-intro {
  max-width: 460px;
  margin: 0 auto;
}

.home-pricing-note {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}

.pricing-section-title {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
}

.pricing-compare {
  margin-bottom: 64px;
}

.pricing-compare-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pricing-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pricing-compare-table th,
.pricing-compare-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.pricing-compare-table th {
  background: var(--bg-soft);
  font-weight: 700;
}

.pricing-compare-table tr:last-child td {
  border-bottom: 0;
}

.pricing-faq {
  max-width: 720px;
  margin: 0 auto;
}

.pricing-faq-item {
  border-bottom: 1px solid var(--border);
}

.pricing-faq-q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 18px 4px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.pricing-faq-chevron {
  display: inline-block;
  font-size: 22px;
  color: var(--purple);
  transition: transform 0.18s ease;
  transform: rotate(90deg);
}

.pricing-faq-chevron.open {
  transform: rotate(-90deg);
}

.pricing-faq-a {
  padding: 0 4px 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

/* Глоссарий (план 05-09, REQ-040, D-13, D-14) */
.glossary-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.glossary-hero {
  margin-bottom: 32px;
}

.glossary-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.glossary-sub {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 22px;
}

.glossary-search {
  position: relative;
  margin-bottom: 16px;
  max-width: 640px;
}

.search-input {
  width: 100%;
  padding: 14px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-dim);
}

.glossary-search-spinner {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--purple);
  font-weight: 700;
}

.htmx-indicator {
  opacity: 0;
  transition: opacity 0.15s;
}

.htmx-request.htmx-indicator,
.htmx-request .htmx-indicator {
  opacity: 1;
}

.glossary-filters {
  margin-bottom: 16px;
}

.glossary-subject {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.alphabet-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 28px;
}

.alphabet-strip .btn.pill {
  border-radius: 100px;
  padding: 6px 12px;
  font-size: 13px;
  min-width: 36px;
  text-align: center;
}

.glossary-results {
  min-height: 200px;
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.term-card {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  /* overflow:hidden обрезает верхний акцент-бар (::before) по радиусу карточки,
     иначе border-top другой толщины давал «надлом» в скруглённых углах (UAT v2.1). */
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}

/* Фиолетовый акцент сверху — отдельный слой, а не border-top: так углы остаются
   чистыми при скруглении (overflow:hidden у .term-card обрезает бар по радиусу). */
.term-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--purple);
}

/* Курсор-указатель только на раскрываемых (длинных) карточках (D-06). */
.term-card--collapsible,
.term-card--link {
  cursor: pointer;
}

/* Растянутая ссылка: псевдоэлемент покрывает всю карточку, поэтому клик по
   любой её части ведёт на страницу термина (правка сеошника 2026-07-13). */
.term-card__stretch::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.term-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 16px var(--purple-mid);
}

.term-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.term-card__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  flex-grow: 1;
}

.term-card__chevron {
  font-size: 20px;
  color: var(--purple);
  transition: transform 0.18s ease;
  display: inline-block;
}

/* Карточка-ссылка: при наведении шеврон «уезжает» вправо (аффорданс перехода). */
.term-card--link:hover .term-card__chevron {
  transform: translateX(3px);
}

/* UAT issue 13 fix (T-07-01-04b, фаза 7): один параграф вместо __short + __full,
   line-clamp вместо двух x-show — убирает дублирование текста при сворачивании. */
.term-card__definition {
  color: var(--text);
  font-size: 15px;
  margin: 0;
  line-height: 1.6;
}

/* Короткие карточки (≤140 символов) показывают полный текст и не интерактивны. */
.term-card:not(.term-card--collapsible) {
  cursor: default;
}

/* Длинные карточки: ограничиваем 3 строками; клик снимает клампинг. */
.term-card__definition--clampable {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.term-card__definition--clampable.is-expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.badge {
  background: var(--purple-dim);
  color: var(--purple);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.glossary-more {
  text-align: center;
  margin-top: 28px;
}

.glossary-empty {
  text-align: center;
  padding: 48px 16px;
}

.glossary-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.glossary-empty-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.glossary-empty-text {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.glossary-ai-spinner {
  margin-top: 12px;
  color: var(--purple);
  font-size: 13px;
}

.glossary-term-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.glossary-term-page__back {
  margin-bottom: 18px;
}

.glossary-term-page__back a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.glossary-term-page__back a:hover {
  color: var(--purple);
}

.glossary-term-hero {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px;
  box-shadow: 0 16px 44px rgba(119, 54, 248, 0.08);
}

.glossary-term-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.glossary-term-hero__subject {
  display: inline-flex;
  text-decoration: none;
}

.glossary-term-hero h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
}

.glossary-term-hero__definition {
  color: var(--text);
  font-size: 18px;
  line-height: 1.75;
  margin: 0;
}

.glossary-term-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.glossary-term-related {
  margin-top: 34px;
}

.glossary-term-related h2 {
  font-size: 24px;
  margin: 0 0 16px;
}

.glossary-term-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.glossary-term-related__card {
  display: block;
  min-height: 132px;
  padding: 18px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.glossary-term-related__card:hover {
  border-color: var(--purple);
  box-shadow: 0 10px 28px var(--purple-mid);
  transform: translateY(-1px);
}

.glossary-term-related__card span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.glossary-term-related__card small {
  display: -webkit-box;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Страница предмета (план 05-11, REQ-041, D-18..D-20) */
.subject-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.subject-hero {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 40px;
  padding: 32px;
  background: var(--bg-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.subject-hero-icon {
  font-size: 64px;
  line-height: 1;
  flex-shrink: 0;
}

.subject-hero-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.subject-hero-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 20px;
}

.subject-hero-cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.subject-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

@media (max-width: 900px) {
  .subject-grid {
    grid-template-columns: 1fr;
  }
  .subject-hero {
    flex-direction: column;
  }
  .subject-hero-icon {
    font-size: 48px;
  }
}

.subject-col {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.subject-col-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--text);
}

.topic-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.topic-item {
  padding: 6px 0;
}

.topic-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}

.topic-text {
  color: var(--text);
}

.topic-text.is-done {
  color: var(--muted);
  text-decoration: line-through;
}

.question-card {
  display: block;
  background: var(--bg-soft);
  border-radius: 9px;
  padding: 10px 14px;
  margin-bottom: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.45;
  border: 1px solid transparent;
  transition: border-color 0.12s, background 0.12s;
}

.question-card:hover {
  background: var(--purple-dim);
  border-color: var(--purple-mid);
}

.term-mini {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
}

.term-mini:last-of-type {
  border-bottom: 0;
}

.term-mini strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--text);
}

.term-mini p {
  margin: 0;
  color: var(--muted);
}

.subject-more {
  margin-top: 12px;
}

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

.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.subject-flashcards-cta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--purple-mid);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  flex-wrap: wrap;
}

.subject-flashcards-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.subject-flashcards-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
  max-width: 520px;
}

/* ЕГЭ/ОГЭ лендинг (план 05-12) */
.ege-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.ege-hero {
  text-align: center;
  margin-bottom: 36px;
}

.ege-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.ege-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 22px;
  line-height: 1.55;
}

.ege-tabs {
  display: inline-flex;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px;
}

.ege-tabs .btn.pill {
  border-radius: 100px;
  padding: 8px 22px;
  min-width: 80px;
}

.ege-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 56px;
}

.ege-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ege-card:hover {
  border-color: var(--purple);
  box-shadow: 0 6px 24px var(--purple-dim);
}

.ege-card-icon {
  font-size: 36px;
  margin-bottom: 10px;
  line-height: 1;
}

.ege-card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 10px;
}

.ege-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}

.exam-badge {
  border-radius: 100px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.exam-badge--ege {
  background: var(--purple-dim);
  color: var(--purple);
}

.exam-badge--oge {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.ege-card-cta {
  width: 100%;
  justify-content: center;
  margin-top: auto;
}

.ege-card-cta--secondary {
  margin-top: 8px;
}

.ege-section-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 24px 0;
}

.ege-howto {
  margin-bottom: 56px;
}

.ege-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.ege-step {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
}

.ege-step-num {
  width: 32px;
  height: 32px;
  background: var(--purple);
  color: white;
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 10px;
}

.ege-step-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 6px 0;
}

.ege-step p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.ege-topics {
  margin-bottom: 56px;
}

.ege-topics-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
  max-width: 920px;
  margin: 0 auto;
}

.ege-topic-link {
  display: block;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: border-color 0.12s, background 0.12s;
}

.ege-topic-link:hover {
  border-color: var(--purple);
  background: var(--purple-dim);
}

.ege-cta-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--purple);
  color: white;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  flex-wrap: wrap;
}

.ege-cta-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.ege-cta-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: white;
}

.ege-cta-sub {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
  max-width: 520px;
}

.ege-cta-bottom .btn-primary {
  background: white;
  color: var(--purple);
}

.ege-cta-bottom .btn-primary:hover {
  background: var(--bg-soft);
}

/* Личный кабинет (план 05-13, D-32..D-34) */
.dashboard-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.dashboard-skeleton {
  text-align: center;
  padding: 80px 16px;
  color: var(--muted);
  font-size: 16px;
}

.dashboard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.dashboard-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dashboard-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.dashboard-tariff-badge {
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pro-badge {
  background: var(--purple);
  color: white;
}

.free-badge {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--border);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard-card--wide {
  grid-column: 1 / -1;
}

@media (max-width: 820px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-card--wide {
    grid-column: auto;
  }
}

.dashboard-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
}

/* === REQ-315 / D-13: блок «Статус подписки» с якорем #subscription === */
.subscription-card {
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-margin-top: 80px;
}
.subscription-card__status {
  display: flex;
  align-items: center;
  gap: 12px;
}
.subscription-card__status .dashboard-tariff-badge {
  font-size: 14px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 100px;
}
.subscription-card__date {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.subscription-card__date strong {
  color: var(--text);
  font-weight: 700;
}
.subscription-card__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.subscription-card__hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .subscription-card__status {
    flex-direction: column;
    align-items: flex-start;
  }
  .subscription-card__actions .btn {
    width: 100%;
  }
}

.dashboard-card-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 14px;
}

.dashboard-dl {
  margin: 0;
  font-size: 14px;
}

.dashboard-dl dt {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 8px;
}

.dashboard-dl dd {
  margin: 2px 0 4px;
  font-weight: 600;
  color: var(--text);
}

.dashboard-text {
  font-size: 15px;
  margin: 0 0 12px;
}

.dashboard-link {
  color: var(--purple);
  font-weight: 600;
}

.dashboard-chats {
  list-style: none;
  padding: 0;
  margin: 0;
}

.dashboard-chat-item {
  border-bottom: 1px solid var(--border);
}

.dashboard-chat-item:last-child {
  border-bottom: 0;
}

.dashboard-chat-link {
  display: grid;
  grid-template-columns: minmax(80px, 120px) 1fr 140px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.dashboard-chat-link:hover {
  background: var(--bg-soft);
}

.dashboard-chat-mode {
  font-weight: 700;
  color: var(--purple);
}

.dashboard-chat-preview {
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard-chat-date {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@media (max-width: 600px) {
  .dashboard-chat-link {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .dashboard-chat-date {
    text-align: left;
  }
}

.dashboard-pwd-form {
  max-width: 480px;
}

.form-success {
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.3);
  color: var(--success);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 9px;
  margin-bottom: 12px;
}

.dashboard-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Flashcards (план 05-14, D-08..D-10) */
.flashcards-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.flashcards-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}

.flashcards-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.flashcards-icon {
  font-size: 36px;
  line-height: 1;
}

.flashcards-empty {
  text-align: center;
  padding: 48px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.flashcards-empty p {
  margin: 0 0 16px;
  color: var(--muted);
}

.flashcards-progress-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  background: var(--purple);
  height: 100%;
  border-radius: 100px;
  transition: width 0.3s ease;
}

.flashcards-counters {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 22px;
  font-size: 14px;
  font-weight: 700;
}

.flashcard-count--known {
  color: var(--success);
}

.flashcard-count--hard {
  color: #d97706;
}

.flashcard-count--unknown {
  color: #dc2626;
}

.flashcard {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 28px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(23, 16, 46, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 20px;
}

.flashcard:hover {
  border-color: var(--purple);
}

.flashcard.is-flipped {
  cursor: default;
  background: var(--bg-soft);
}

.flashcard-term {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.flashcard-hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.flashcard-back-term {
  font-size: 22px;
  font-weight: 800;
  color: var(--purple);
  margin-bottom: 12px;
}

.flashcard-back-def {
  font-size: 16px;
  color: var(--text);
  line-height: 1.55;
  text-align: left;
}

.flashcards-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 540px) {
  .flashcards-actions {
    grid-template-columns: 1fr;
  }
}

.flashcards-finish {
  text-align: center;
}

.flashcards-results {
  text-align: center;
  padding: 24px 16px;
}

.flashcards-results-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 14px;
}

.result-diagram {
  display: flex;
  height: 24px;
  border-radius: 100px;
  overflow: hidden;
  margin: 24px auto 14px;
  border: 1px solid var(--border);
  max-width: 480px;
}

.result-segment {
  height: 100%;
  transition: width 0.3s ease;
}

.result-segment--known {
  background: var(--success);
}

.result-segment--hard {
  background: #f59e0b;
}

.result-segment--unknown {
  background: #ef4444;
}

.result-legend {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 0 0 24px;
  font-size: 14px;
  flex-wrap: wrap;
}

.result-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 100px;
  margin-right: 6px;
  vertical-align: middle;
}

.dot--known {
  background: var(--success);
}

.dot--hard {
  background: #f59e0b;
}

.dot--unknown {
  background: #ef4444;
}

.flashcards-results-cta {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Toast (appShell) */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(23, 16, 46, 0.12);
}

.app-toast--error {
  background: var(--toast-error-bg);
  border: 1px solid var(--toast-error-border);
  color: var(--toast-error-text);
}

.app-toast--info {
  background: var(--purple-dim);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Footer — светлая тема, единый вид с подвалом каталога (v2.1 «единообразие»):
   логотип + колонки ссылок (вкл. блок ИИ-инструментов) + дисклеймер + оплата. */
.footer {
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  padding: 44px 0 24px;
  color: var(--text);
}

.footer-top {
  display: grid;
  grid-template-columns: 220px 1fr 1fr 1.3fr;
  gap: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.footer-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 8px 0 4px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--muted);
}

.footer-col-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.footer-links a {
  font-size: 13px;
  color: var(--muted);
  transition: color 0.14s;
}

.footer-links a:hover {
  color: var(--purple);
}

/* Дисклеймер (как в подвале каталога) — юридическая приписка про характер работ. */
.footer-disclaimer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 16px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

.footer-pay {
  height: 34px;
  flex-shrink: 0;
}

.footer-brand-logo {
  width: 30px;
  height: 30px;
}

/* Адаптив */
@media (max-width: 960px) {
  .trending-grid {
    grid-template-columns: 1fr 1fr;
  }

  .subjects-grid--catalog {
    grid-template-columns: repeat(2, 1fr);
  }

  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
  }

  .example-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }

  .nav-links {
    display: none;
  }
}

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

  .trending-grid {
    grid-template-columns: 1fr;
  }

  .subjects-grid--catalog {
    grid-template-columns: 1fr 1fr;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .reviews-grid {
    grid-template-columns: 1fr;
  }

  .review-meta-nums {
    gap: 18px;
    flex-wrap: wrap;
  }

  .dict-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 40px 0 36px;
  }

  .btn,
  .nav-links a {
    min-height: 44px;
  }
}

/* === Workflow «Написать работу» (фаза 6, REQ-243/247) ===
   Источник: .planning/phases/06-work-generator/06-CONTEXT.md §9 D-6/D-7/D-10.
   Базовые стили баннера незавершённой работы, контейнера карточки воркфлоу,
   заготовка antiplagiat-warning. Полные стили workflow-карточки (формат-селектор,
   кнопки confirm/regenerate, word-count) добавятся в плане 06-09. */

.work-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #fff7d6, #ffe7a3);
  border-bottom: 1px solid #f0c952;
  color: var(--text);
  font-size: 14px;
}
.work-active-banner__text {
  flex: 1;
  line-height: 1.4;
}
.work-active-banner__text strong {
  margin-right: 6px;
}
.work-active-banner__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .work-active-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .work-active-banner__actions {
    justify-content: center;
  }
}

.workflow-card {
  display: block;
  /* REQ-300 / D-01: margin: auto центрирует и по горизонтали, и по вертикали
     внутри flex-column родителя <main class="chat-main">. Если высота
     контента превышает viewport — авто-margin сжимается до 0 и работает
     обычный скролл внутри main. */
  margin: auto;
  width: calc(100% - 32px);
  max-width: min(640px, 90vw);
  padding: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(23, 16, 46, 0.04);
}
.workflow-card__skeleton {
  text-align: center;
  color: var(--muted);
  padding: 24px;
  font-size: 14px;
}

/* Antiplagiat-warning (REQ-247, non-dismissible) — заготовка для 06-09. */
.antiplagiat-warning {
  background: #fff7d6;
  border: 1px solid #f0c952;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: #5a4400;
  margin-bottom: 16px;
}
.antiplagiat-warning strong {
  color: #4a3500;
}

/* Полная разметка workflow-card (план 06-09): форма старта, шаги, прогресс, финальный экран. */
.workflow-card__intro { display: flex; flex-direction: column; gap: 12px; }
.workflow-card__title { font-size: 18px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.workflow-card__hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
.workflow-card__field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.workflow-card__field > span { color: var(--muted); }
.workflow-card__field input,
.workflow-card__field select,
.workflow-card__field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.workflow-card__checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.workflow-card__title-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.workflow-card__buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.workflow-card__step-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.workflow-card__step-title { display: flex; flex-direction: column; gap: 2px; }
.workflow-card__step-kind {
  color: var(--purple);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.workflow-card__step-topic { font-size: 16px; font-weight: 500; color: var(--text); }
.workflow-card__progress {
  position: relative;
  height: 8px;
  background: var(--purple-dim);
  border-radius: 4px;
  overflow: hidden;
}
.workflow-card__progress-bar {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--purple);
  transition: width 0.25s ease;
}
.workflow-card__progress-label {
  position: absolute;
  right: 0; top: -18px;
  font-size: 11px;
  color: var(--muted);
}
.workflow-card__step-content {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  max-height: 480px;
  overflow-y: auto;
}
.workflow-card__step-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  color: var(--text);
}
.workflow-card__streaming-cursor {
  display: inline-block;
  animation: workflow-blink 1s infinite;
  color: var(--purple);
}
@keyframes workflow-blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
.workflow-card__wordcount {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.workflow-card__comment {
  background: var(--purple-dim);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 12px;
}
.workflow-card__comment label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.workflow-card__comment textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.workflow-card__final { text-align: center; padding: 24px 0; }
.workflow-card__final h2 { margin: 0 0 12px; color: var(--purple); font-size: 22px; }

/* === Фаза 22: локальные модификаторы плана презентации (на :root-переменных).
   Новых цветовых литералов не вводим — только существующие токены. === */
.presentation-plan {
  list-style: none;
  margin: 12px 0 0;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.presentation-plan__slide {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.presentation-plan__num {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  background: var(--purple-dim);
  color: var(--purple);
  font-size: 13px;
  font-weight: 600;
}
.presentation-plan__body { display: flex; flex-direction: column; gap: 4px; }
.presentation-plan__title { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.presentation-plan__bullets {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.presentation-plan__bullets li { font-size: 14px; line-height: 1.6; color: var(--muted); }

/* Индетерминантный прогресс авто-сборки (D-05) — без числового значения. */
.workflow-card__progress--indeterminate { margin-top: 4px; }
.workflow-card__progress--indeterminate .workflow-card__progress-bar {
  width: 40%;
  animation: presentation-progress-slide 1.2s ease-in-out infinite;
}
@keyframes presentation-progress-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

/* === Кастомная модалка-попап вместо native alert/confirm (правки фазы 6).
   Управляется через Alpine.store('appDialog'). Разметка в chat.html в конце
   .chat-page. Видна на любом экране (>= 320px), центрируется по центру вьюпорта. */
.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.app-dialog[style*="display: none"] { pointer-events: none; }
.app-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 16, 46, 0.45);
  backdrop-filter: blur(2px);
}
.app-dialog__panel {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(23, 16, 46, 0.25);
  max-width: 460px;
  width: 100%;
  padding: 24px;
  z-index: 1;
  animation: app-dialog-pop 140ms ease-out;
}
@keyframes app-dialog-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.app-dialog__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.app-dialog__message {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.app-dialog__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.app-dialog__actions .btn { min-width: 96px; }

@media (max-width: 480px) {
  .app-dialog__panel { padding: 20px; }
  .app-dialog__actions { justify-content: stretch; }
  .app-dialog__actions .btn { flex: 1 1 auto; min-width: 0; }
}

/* === Фаза 9 — /subject/{slug} новый UX (REQ-261, D-04..D-10) === */

.subject-page {
  padding: 32px 0 64px;
}

.guest-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--purple-dim);
  border: 1px solid var(--purple-mid);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 32px;
}
.guest-banner__text {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

/* === REQ-312 / D-12: гостевая карточка для /chat?mode=write === */
.guest-state {
  max-width: 560px;
  /* margin: auto — центрирование по горизонтали И вертикали внутри
     flex-column родителя (главная цель: guest-state не прилипает к
     верху main, когда chat-messages скрыт в mode === 'write'). */
  margin: auto;
  padding: 32px 28px 28px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(23, 16, 46, 0.04);
}
.guest-state__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.guest-state__text {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
  margin: 0;
}
.guest-state__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 4px;
}
.guest-state__hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

@media (max-width: 480px) {
  .guest-state {
    margin: 24px 12px;
    padding: 24px 20px 20px;
  }
  .guest-state__title {
    font-size: 19px;
  }
  .guest-state__actions {
    flex-direction: column;
  }
  .guest-state__actions .btn {
    width: 100%;
  }
}

.subject-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}
.subject-hero__icon {
  font-size: 64px;
  line-height: 1;
}
.subject-hero__title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}
.subject-hero__sub {
  color: var(--muted);
  font-size: 16px;
  max-width: 720px;
}

.subject-cta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.cta-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  min-height: 140px;
  text-decoration: none;
}
.cta-card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--purple-dim);
}
.cta-card__icon svg {
  width: 28px;
  height: 28px;
  color: var(--purple);
}
.cta-card__title {
  font-weight: 700;
  font-size: 16px;
}
.cta-card__sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.cta-card--primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}
.cta-card--primary:hover {
  background: var(--purple-dark);
  color: #fff;
}
.cta-card--primary .cta-card__sub {
  color: rgba(255, 255, 255, 0.85);
}
.cta-card--primary .cta-card__icon svg {
  color: #fff;
}

.subject-section-block {
  margin-bottom: 48px;
}
.subject-section-block__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
}

.subject-topics-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
}
.subject-topic-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.subject-topic-chip:hover {
  background: var(--purple-dim);
  border-color: var(--purple-mid);
}

.subject-questions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}
.subject-question-card {
  display: block;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color .12s ease, background .12s ease;
}
.subject-question-card:hover {
  border-color: var(--purple);
  background: var(--bg);
}

.subject-terms-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 16px 0;
  padding: 0;
}
.subject-term-card {
  padding: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.subject-term-card:hover {
  border-color: var(--purple);
  box-shadow: 0 4px 14px var(--purple-dim);
}
.subject-term-card__link {
  display: block;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
}
.subject-term-card__name {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}
.subject-term-card__def {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.subject-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}
.subject-empty a {
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .subject-cta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .subject-hero {
    flex-direction: column;
    text-align: center;
  }
  .subject-hero__icon { font-size: 56px; }
  .guest-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
}

/* === Фаза 9 — /flashcards/{slug} новый UX (REQ-262, D-13..D-15) === */

.flashcards-hotkey-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}
.flashcards-hotkey-hint kbd {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.flashcards-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 24px 0 32px;
}
.flashcards-score__percent {
  font-size: 56px;
  font-weight: 800;
  color: var(--purple);
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.flashcards-score__suffix {
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
}
.flashcards-score__verdict {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 480px) {
  .flashcards-score__percent { font-size: 44px; }
  .flashcards-score__suffix { font-size: 14px; }
  .flashcards-score__verdict { font-size: 18px; }
}

/* ===== Фаза 15 — Админка ===== */

/* Layout */
.admin-shell { display: flex; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.admin-sidebar {
  width: 248px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; background: var(--bg-soft); border-right: 1px solid var(--border);
}
.admin-sidebar-brand {
  display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700;
  color: var(--text); padding: 6px 10px 14px;
}
.admin-sidebar-brand span { color: var(--purple); }
.admin-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.admin-nav-link {
  display: block; padding: 10px 12px; border-radius: 9px; font-size: 14px; font-weight: 500;
  color: var(--text); text-decoration: none; min-height: 44px; transition: background .14s, color .14s;
}
.admin-nav-link:hover { background: var(--purple-dim); color: var(--purple); }
.admin-nav-link.active { background: var(--purple); color: #fff; }
.admin-nav-link--muted { color: var(--muted); margin-top: auto; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px;
  border-bottom: 1px solid var(--border); background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 90;
}
.admin-page-title { font-size: 20px; font-weight: 800; letter-spacing: -.01em; flex: 1; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-user-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--purple); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; text-transform: uppercase;
}
.admin-user-name { font-size: 13px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-content { padding: 24px; flex: 1; min-width: 0; }

.admin-burger {
  display: none; min-width: 44px; min-height: 44px; border: 1px solid var(--border);
  background: transparent; border-radius: 9px; font-size: 18px; color: var(--text); cursor: pointer;
}
.admin-overlay { display: none; position: fixed; inset: 0; background: rgba(23,16,46,.4); z-index: 140; }

@media (max-width: 900px) {
  .admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 150; width: 260px;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 4px 0 24px rgba(23,16,46,.08);
  }
  .admin-sidebar--open { transform: translateX(0); }
  .admin-overlay { display: block; }
  .admin-burger { display: inline-flex; align-items: center; justify-content: center; }
}

/* Дашборд */
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.admin-stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.admin-stat-card__value { font-size: 28px; font-weight: 800; color: var(--purple); letter-spacing: -.02em; margin-bottom: 4px; }
.admin-stat-card__value--danger { color: #dc2626; }
.admin-stat-card__label { font-size: 12px; color: var(--muted); }
.admin-link-card {
  display: block; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px; color: var(--text); text-decoration: none; transition: border-color .14s, box-shadow .14s;
}
.admin-link-card:hover { border-color: var(--purple); box-shadow: 0 6px 24px var(--purple-dim); }
.admin-link-card__title { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.admin-link-card__sub { font-size: 13px; color: var(--muted); }

/* Тулбар / поиск / фильтры */
.admin-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.admin-search {
  flex: 1; min-width: 220px; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 9px; font-family: var(--font); font-size: 14px; background: var(--bg); color: var(--text); outline: none;
}
.admin-search:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-dim); }
.admin-filter {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 9px;
  font-family: var(--font); font-size: 14px; background: var(--bg); color: var(--text); cursor: pointer;
}
.admin-spinner { font-size: 13px; color: var(--purple); font-weight: 600; }

/* Таблица */
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  text-align: left; padding: 12px 16px; background: var(--bg-soft); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--bg-soft); }
.admin-row--deleted td { color: var(--muted); opacity: .7; }
.admin-cell-trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Пагинация */
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 20px; }
.admin-pagination-info { font-size: 13px; color: var(--muted); }

/* Бейджи статусов */
.admin-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 100px;
}
.admin-badge--pro,
.admin-badge--confirmed,
.admin-badge--sent,
.admin-badge--active { background: #f0fdf4; color: var(--success); }
.admin-badge--free,
.admin-badge--inactive { background: #f1f0f5; color: var(--muted); }
.admin-badge--unconfirmed,
.admin-badge--pending,
.admin-badge--sending { background: #fffbeb; color: #d97706; }
.admin-badge--deleted,
.admin-badge--failed { background: #fef2f2; color: #dc2626; }

/* Опасная кнопка (поверх .btn .btn-outline) */
.admin-btn-danger { border-color: #fecaca !important; color: #dc2626 !important; }
.admin-btn-danger:hover { background: #fef2f2 !important; }

/* Карточка деталей / уведомление / форма */
.admin-detail-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.admin-notice {
  background: rgba(22,163,74,.1); border: 1px solid rgba(22,163,74,.3); color: var(--success);
  font-size: 14px; padding: 12px 14px; border-radius: 9px; margin: 12px 0; word-break: break-all;
}
.admin-form { max-width: 640px; }
/* Широкая форма AI-настроек (UI-SPEC §2.8 — 760px под длинные промпты) */
.admin-form--wide { max-width: 760px; }
/* Заголовок группы внутри admin-формы (Модель / Системные промпты) */
.admin-section-title { font-size: 16px; font-weight: 800; color: var(--text); margin: 22px 0 12px; }
.admin-section-title:first-child { margin-top: 0; }

/* Пустое состояние */
.admin-empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.admin-empty__title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 6px; }

/* Модалка просмотра (независимый клон .app-dialog для просмотра контента) */
.admin-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.admin-modal__backdrop { position: absolute; inset: 0; background: rgba(23,16,46,.45); backdrop-filter: blur(2px); }
.admin-modal__panel {
  position: relative; z-index: 1; background: var(--bg); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(23,16,46,.25); max-width: 720px; width: 100%;
  max-height: 80vh; overflow: auto; padding: 24px;
}
.admin-modal__close {
  position: absolute; top: 14px; right: 16px; border: none; background: transparent;
  font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer;
}
.admin-modal__title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.admin-modal__body pre {
  white-space: pre-wrap; word-break: break-word; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text);
}

/* Модалка активации Pro на /pricing (фаза 14, REQ-341, D-03).
   Overlay/spacing заимствованы из .admin-modal; единственный inline-hex —
   rgba overlay (разрешённое исключение по UI-SPEC). */
.pricing-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(23, 16, 46, .45); backdrop-filter: blur(2px);
}
.pricing-modal-card {
  position: relative; background: var(--bg); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(23, 16, 46, .25);
  max-width: 440px; width: 100%; padding: 28px 32px;
}
.pricing-modal-close {
  position: absolute; top: 14px; right: 16px; border: none; background: transparent;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
.pricing-modal-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.pricing-modal-text { font-size: 15px; line-height: 1.6; color: var(--muted); margin-bottom: 20px; }
.pricing-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pricing-modal-cta { flex: 1 1 auto; text-align: center; }

/* OTP */
.admin-otp-input {
  width: 100%; text-align: center; font-size: 24px; font-weight: 700; letter-spacing: .4em;
  padding: 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); background: var(--bg); color: var(--text); outline: none; margin-bottom: 14px;
}
.admin-otp-input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-dim); }
.admin-otp-resend { font-size: 13px; color: var(--purple); font-weight: 600; background: none; border: none; cursor: pointer; }
.admin-otp-resend:disabled { color: var(--muted); cursor: default; }

/* SEO-раздел ИИ */
.seo-ai-hero,
.seo-ai-landing-hero {
  padding: 76px 0 56px;
  background:
    radial-gradient(circle at 12% 12%, var(--purple-dim), transparent 34%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.seo-ai-hero__grid,
.seo-ai-landing-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: center;
}

.seo-ai-hero__title,
.seo-ai-landing-hero__title {
  margin: 18px 0 16px;
}

.seo-ai-hero__lead,
.seo-ai-landing-hero__lead {
  max-width: 760px;
}

.seo-ai-hero__actions,
.seo-ai-landing-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.seo-ai-hero__card,
.seo-ai-landing-note,
.seo-ai-content-card,
.seo-ai-card,
.seo-ai-related-card {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(23, 16, 46, .08);
}

.seo-ai-hero__card,
.seo-ai-landing-note {
  padding: 28px;
}

.seo-ai-hero__badge,
.seo-ai-landing-note__label,
.seo-ai-card__label,
.seo-ai-related-card span {
  display: inline-flex;
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.seo-ai-hero__card-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 10px;
}

.seo-ai-section {
  padding: 64px 0;
}

.seo-ai-section--soft {
  background: var(--bg-soft);
}

.seo-ai-section__head {
  max-width: 760px;
  margin-bottom: 24px;
}

.seo-ai-section__head .h2 {
  margin: 10px 0;
}

.seo-ai-card-grid,
.seo-ai-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.seo-ai-card,
.seo-ai-related-card {
  display: block;
  padding: 22px;
  transition: border-color .16s, box-shadow .16s, transform .12s;
}

.seo-ai-card:hover,
.seo-ai-related-card:hover {
  border-color: var(--purple);
  box-shadow: 0 18px 42px var(--purple-dim);
  transform: translateY(-2px);
}

.seo-ai-card h3 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 10px;
}

.seo-ai-card p,
.seo-ai-hero__card p,
.seo-ai-landing-note p,
.seo-ai-related-card strong {
  color: var(--muted);
}

.seo-ai-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.seo-ai-breadcrumb a {
  color: var(--purple);
  font-weight: 700;
}

.seo-ai-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .72fr);
  gap: 22px;
  align-items: start;
}

.seo-ai-content-card {
  padding: 28px;
}

.seo-ai-content-card .h2 {
  margin-bottom: 18px;
}

.seo-ai-content-card p + p {
  margin-top: 14px;
}

.seo-ai-muted {
  color: var(--muted);
}

.seo-ai-prompt-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 18px 0 22px;
}

.seo-ai-prompt-list li {
  position: relative;
  padding: 14px 16px 14px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.seo-ai-prompt-list li::before {
  content: "“";
  position: absolute;
  left: 16px;
  top: 8px;
  color: var(--purple);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.seo-ai-content-card__cta {
  width: 100%;
  justify-content: center;
}

.seo-ai-related-card strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
}

@media (max-width: 860px) {
  .seo-ai-hero,
  .seo-ai-landing-hero {
    padding: 52px 0 40px;
  }

  .seo-ai-hero__grid,
  .seo-ai-landing-hero__grid,
  .seo-ai-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .seo-ai-hero__actions .btn,
  .seo-ai-landing-hero__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .seo-ai-card-grid,
  .seo-ai-related-grid {
    grid-template-columns: 1fr;
  }
}
