:root{
  --bg:#0a0e1a; --surface:#111827; --surface-2:#1a2234;
  --border:#232c40; --text:#e6ebf5; --muted:#8b94a7;
  --primary:#7c5cff; --primary-2:#4cc9f0;
  --danger:#ef4444; --success:#22c55e;
  --radius:16px; --radius-sm:10px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at 15% -10%,#1a2040 0%,transparent 45%),
    radial-gradient(circle at 100% 0%,#2a1740 0%,transparent 40%),
    var(--bg);
  color:var(--text); min-height:100vh; line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
a{color:var(--primary-2);text-decoration:none}
a:hover{text-decoration:underline}
.muted{color:var(--muted)}
.small{font-size:.875rem}
.container{max-width:1200px;margin:0 auto;padding:0 16px}
main.container{padding-bottom:64px}

/* Nav */
.nav{position:sticky;top:0;z-index:50;backdrop-filter:blur(12px);
  background:rgba(10,14,26,.7);border-bottom:1px solid var(--border)}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}

/* ─── Логотип ─── */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(124,92,255,.45));
  transition: transform .25s ease;
}
.logo:hover .logo-icon { transform: rotate(-6deg) scale(1.08); }

.logo-text {
  display: inline-flex;
  align-items: baseline;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}
.logo-name {
  background: linear-gradient(135deg, #7c5cff, #4cc9f0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.logo-domain {
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
  margin-left: 2px;
}

@media (max-width: 420px) {
  .logo-icon { width: 26px; height: 26px; }
  .logo-text { font-size: 1rem; }
  .logo-domain { font-size: .62rem; }
}

/* ─── Мобильный блок: баланс + бургер ─── */
.nav-actions {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-balance-mobile {
  display: inline-flex;
  padding: 5px 10px;
  font-size: .82rem;
}
.nav-links{display:flex;align-items:center;gap:16px}
.nav-links a{color:var(--text);font-weight:500;font-size:.95rem}
.nav-links a:hover{color:var(--primary-2);text-decoration:none}
.credits-pill{background:var(--surface-2);padding:6px 12px;border-radius:999px;
  font-weight:600;font-size:.85rem;border:1px solid var(--border)}
.nav-toggle{display:none;background:transparent;border:1px solid var(--border);
  color:var(--text);font-size:1.25rem;padding:6px 12px;border-radius:10px;cursor:pointer}

/* Buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 18px;border-radius:12px;font-weight:600;font-size:.95rem;
  border:1px solid transparent;cursor:pointer;transition:.15s;white-space:nowrap}
.btn:hover{transform:translateY(-1px);text-decoration:none}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary-2));
  color:#0a0e1a;box-shadow:0 6px 20px rgba(124,92,255,.35)}
.btn-primary:hover{filter:brightness(1.05)}
.btn-ghost{background:transparent;color:var(--text);border-color:var(--border)}
.btn-ghost:hover{background:var(--surface-2)}
.btn-block{width:100%}
.btn-lg{padding:14px 26px;font-size:1rem}

/* Hero */
.hero{padding:64px 0 32px;text-align:center}
.hero h1{font-size:clamp(2rem,5vw,3.4rem);margin:0 0 16px;line-height:1.1}
.grad{background:linear-gradient(135deg,var(--primary),var(--primary-2));
  -webkit-background-clip:text;background-clip:text;color:transparent}
.lead{font-size:1.1rem;color:var(--muted);max-width:640px;margin:0 auto 24px}
.hero-actions{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}

/* Sections */
.section{margin:48px 0}
.section h2{font-size:1.5rem;margin:0 0 16px}
.type-title{font-size:1rem;color:var(--muted);margin:24px 0 12px;font-weight:600;text-transform:uppercase;letter-spacing:.5px}

/* Grid + Cards */
.grid{display:grid;grid-template-columns:1fr;gap:16px}
@media(min-width:640px){.grid{grid-template-columns:repeat(2,1fr)}}
@media(min-width:960px){.grid{grid-template-columns:repeat(3,1fr)}}

.card{background:linear-gradient(180deg,var(--surface),var(--surface-2));
  border:1px solid var(--border);border-radius:var(--radius);padding:20px;
  box-shadow:var(--shadow);transition:.15s}
.model-card{display:flex;flex-direction:column;gap:12px}
.model-card:hover{border-color:var(--primary);transform:translateY(-2px)}
.model-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.badge{font-size:.75rem;background:rgba(124,92,255,.15);color:#b7a7ff;
  padding:3px 10px;border-radius:999px;border:1px solid rgba(124,92,255,.3)}
.price{font-size:.9rem;color:var(--primary-2);font-weight:600;margin-top:auto}

/* Auth */
.auth-card{max-width:440px;margin:48px auto}
.auth-card h1{margin-top:0}

/* Forms */
.stack{display:flex;flex-direction:column;gap:14px}
label{display:flex;flex-direction:column;gap:6px;font-weight:500;font-size:.95rem}
input,textarea,select{width:100%;padding:12px 14px;background:var(--bg);
  border:1px solid var(--border);color:var(--text);border-radius:var(--radius-sm);
  font:inherit;outline:none;transition:.15s}
input:focus,textarea:focus,select:focus{border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(124,92,255,.15)}
textarea{resize:vertical;min-height:56px}

.alert{padding:12px 16px;border-radius:var(--radius-sm);margin:12px 0}
.alert.error{background:rgba(239,68,68,.12);color:#fca5a5;border:1px solid rgba(239,68,68,.3)}

/* App */
.app-header{display:flex;justify-content:space-between;align-items:center;
  gap:16px;flex-wrap:wrap;margin:24px 0}
.app-header h1{margin:0;font-size:1.5rem}

.table-wrap{overflow-x:auto;border-radius:var(--radius);border:1px solid var(--border)}
.table{width:100%;border-collapse:collapse;font-size:.9rem;min-width:560px}
.table th,.table td{padding:12px 14px;text-align:left;border-bottom:1px solid var(--border)}
.table th{background:var(--surface-2);font-weight:600;color:var(--muted);font-size:.8rem;
  text-transform:uppercase;letter-spacing:.5px}
.table tr:last-child td{border-bottom:none}
.status{padding:3px 10px;border-radius:999px;font-size:.75rem;font-weight:600}
.status-done{background:rgba(34,197,94,.15);color:#86efac}
.status-pending{background:rgba(234,179,8,.15);color:#fde68a}
.status-error{background:rgba(239,68,68,.15);color:#fca5a5}

/* Workspace */
.workspace{display:grid;grid-template-columns:1fr;gap:16px;margin:24px 0}
@media(min-width:960px){.workspace{grid-template-columns:280px 1fr;align-items:start}}
.ws-side{position:sticky;top:80px;display:flex;flex-direction:column;gap:12px}
.ws-main{min-height:60vh}
.chat{display:flex;flex-direction:column;gap:12px;margin-bottom:16px}
.msg{padding:12px 16px;border-radius:14px;max-width:85%;white-space:pre-wrap;word-wrap:break-word}
.msg.user{align-self:flex-end;background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#0a0e1a}
.msg.bot{align-self:flex-start;background:var(--surface-2);border:1px solid var(--border)}
.composer{display:flex;gap:10px;align-items:flex-end;position:sticky;bottom:12px;
  background:rgba(10,14,26,.85);backdrop-filter:blur(8px);padding:10px;border-radius:var(--radius);
  border:1px solid var(--border)}
.composer textarea{flex:1;margin:0}
.image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:12px;margin-bottom:16px}
.image-grid img{width:100%;border-radius:var(--radius-sm);display:block;cursor:pointer;
  border:1px solid var(--border)}
.spinner{display:inline-block;width:16px;height:16px;border:2px solid rgba(255,255,255,.3);
  border-top-color:#fff;border-radius:50%;animation:spin .7s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

.footer{display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;
  padding:24px 16px;border-top:1px solid var(--border);color:var(--muted);font-size:.85rem}

/* Mobile nav */
@media (max-width: 800px) {
  .nav-actions { display: flex; }
  .nav-toggle {
    display: block;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    padding: 6px 11px;
    border-radius: 10px;
    cursor: pointer;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 50;
  }
  /* На мобильных баланс вынесен в .nav-actions — в меню его дубль не нужен */
  .nav-links .credits-pill { display: none; }
  .nav-links a { padding: 10px 12px; border-radius: 10px; }
  .nav-open .nav-links { display: flex; }

  .hero { padding: 40px 0 20px; }
  .composer { flex-direction: column; align-items: stretch; }
  .composer button { width: 100%; }
  .ws-side { position: static; }
}
/* Mode switch (для image-моделей) */
.mode-switch {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.mode-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  border-radius: 8px;
  cursor: pointer;
  transition: .15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0a0e1a;
}

/* File input */
.mode-pane { margin-bottom: 10px; }
.file-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: .15s;
}
.file-label:hover { border-color: var(--primary); }
.file-label-text { font-weight: 600; font-size: .9rem; color: var(--text); }
.file-label input[type="file"] {
  margin-top: 6px;
  padding: 6px;
  font-size: .85rem;
}
/* ═══════════ Форма генерации изображений ═══════════ */
.gen-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 16px;
}

/* Переключатель режимов */
.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.mode-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    font-size: .9rem;
    line-height: 1.2;
    text-align: center;
    border-radius: 9px;
    cursor: pointer;
    transition: color .18s, background .18s, box-shadow .18s;
}

.mode-tab:hover { color: var(--text); }

.mode-tab.is-active {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #0a0e1a;
    box-shadow: 0 2px 10px rgba(124,92,255,.35);
}

/* Плавное раскрытие панели загрузки */
.mode-pane {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .28s ease, opacity .22s ease;
    opacity: 0;
}

.mode-pane.is-open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.mode-pane-inner {
    overflow: hidden;
    min-height: 0;
}

/* Dropzone */
.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 22px 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s;
}

.file-drop:hover,
.file-drop.is-drag {
    border-color: var(--primary);
    background: rgba(124,92,255,.06);
}

.file-drop-text { font-weight: 600; color: var(--text); }
.file-drop-hint { font-size: .8rem; color: var(--muted); }

/* Превью */
.file-preview {
    position: relative;
    margin-top: 10px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
}

.file-preview img {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
}

.file-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(10,14,26,.8);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: background .15s;
}
.file-remove:hover { background: rgba(239,68,68,.9); }

/* Поле промпта — не сжимается */
.gen-form textarea {
    min-height: 110px;
    resize: vertical;
    font-size: 1rem;
}

.gen-form-actions {
    display: flex;
    justify-content: flex-end;
}

/* Галерея результатов */
.image-grid img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    transition: transform .15s;
}
.image-grid img:hover { transform: scale(1.02); }

/* Мобильная адаптация */
@media (max-width: 640px) {
    .gen-form { padding: 12px; gap: 12px; }
    .mode-tab { font-size: .85rem; padding: 9px 8px; min-height: 44px; }
    .gen-form textarea { min-height: 100px; font-size: .95rem; }
    .gen-form-actions { justify-content: stretch; }
    .gen-form-actions .btn { width: 100%; }
    .file-preview img { max-height: 160px; }
    .file-drop { padding: 18px 12px; }
    .file-drop-text { font-size: .92rem; }
}
/* ═══════════ Карточки направлений ═══════════ */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}
@media (min-width: 720px) { .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; } }

.cat-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.cat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cat-gradient, linear-gradient(135deg, var(--primary), var(--primary-2)));
  opacity: .08;
  z-index: -1;
  transition: opacity .25s;
}
.cat-card:hover,
.cat-card:focus-visible {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
  text-decoration: none;
  outline: none;
}
.cat-card:hover::before { opacity: .16; }

.cat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.55rem;
  background: var(--cat-gradient);
  color: #0a0e1a;
  box-shadow: 0 6px 16px rgba(0,0,0,.3);
  flex-shrink: 0;
}
.cat-count {
  font-size: .8rem;
  color: var(--muted);
  background: var(--bg);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.cat-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  background: var(--cat-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.cat-desc {
  margin: 0;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.5;
}

.cat-top {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cat-top-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.cat-top-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .9rem;
}
.cat-top-list li { line-height: 1.4; }
.cat-top-list .muted { font-size: .82rem; }

.cat-cta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  transition: gap .2s ease;
}
.cat-card:hover .cat-cta { gap: 14px; }

@media (max-width: 640px) {
  .cat-card { padding: 18px; gap: 12px; }
  .cat-icon { width: 46px; height: 46px; font-size: 1.35rem; border-radius: 12px; }
  .cat-title { font-size: 1.1rem; }
  .cat-desc { font-size: .9rem; }
}

/* ═══════════ Шаги ═══════════ */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 560px)  { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps-grid { grid-template-columns: repeat(4, 1fr); } }

.step {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0a0e1a;
  font-weight: 800;
  margin-bottom: 10px;
}
.step h4 { margin: 0 0 6px; font-size: 1rem; }
.step p { margin: 0; font-size: .9rem; }

/* ═══════════ Хиро категории (catalog.php) ═══════════ */
.cat-hero {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 26px;
  margin: 16px 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.cat-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--cat-gradient);
  opacity: .1;
  z-index: -1;
}
.cat-hero-icon {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  background: var(--cat-gradient);
  color: #0a0e1a;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.cat-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  line-height: 1.2;
}
.cat-hero .lead { margin: 0 0 12px; font-size: 1rem; }

@media (max-width: 640px) {
  .cat-hero { flex-direction: column; align-items: flex-start; padding: 20px; gap: 14px; }
  .cat-hero-icon { width: 56px; height: 56px; font-size: 1.8rem; border-radius: 14px; }
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: .8rem;
  border-radius: 999px;
  background: rgba(124,92,255,.12);
  border: 1px solid rgba(124,92,255,.25);
  color: #b7a7ff;
  font-weight: 500;
}
/* ═══════════ Aiventra App ═══════════ */
.aiventra-app {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 24px;
  margin: 20px 0 48px;
  align-items: start;
}

.av-sidebar {
  position: sticky;
  top: 84px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* никакой внутренней прокрутки — весь блок виден сразу,
     прокручивается только страница */
  max-height: none;
  overflow: visible;
}
/* Планшеты: чуть уже, но без скролла */
@media (max-width: 1100px) {
  .aiventra-app {
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 18px;
  }
}

/* Мобильные: одна колонка, липкость отключаем */
@media (max-width: 900px) {
  .aiventra-app {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .av-sidebar {
    position: static;
    top: auto;
  }
  .av-result {
    min-height: 40vh;
  }
}
.av-sidebar-head {
  position: relative;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.av-sidebar-head::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 56px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  border-radius: 2px;
}
.av-sidebar-head h1 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
}
.av-cost-line { margin: 0; color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: 8px; }
.av-cost-line strong {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.av-field { display: flex; flex-direction: column; gap: 8px; }
.av-label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.7;
  color: var(--text);
}
.av-hint {
  display: inline;
  margin-left: 4px;
  font-weight: 400;
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Dropzone */
.av-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 12px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 10px;
  background: var(--bg); transition: border-color .15s, background .15s;
}
.av-drop:hover, .av-drop.is-drag { border-color: var(--primary); background: rgba(124,92,255,.05); }
.av-drop-text { font-weight: 600; font-size: .85rem; }
.av-drop-hint { font-size: .75rem; color: var(--muted); }

/* Preview */
.av-preview { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.av-preview img { display: block; width: 100%; max-height: 180px; object-fit: contain; background: var(--bg); }
.av-remove {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: rgba(10,14,26,.8); color: #fff;
  cursor: pointer; font-size: .85rem; display: grid; place-items: center;
}
.av-remove:hover { background: rgba(239,68,68,.9); }

.av-preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.av-preview-grid .av-thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
.av-preview-grid img { width: 100%; height: 100%; object-fit: cover; }
.av-preview-grid .av-remove { width: 22px; height: 22px; font-size: .7rem; top: 4px; right: 4px; }
.av-counter { text-align: right; font-size: .75rem; color: var(--muted); }

/* Segmented */
.av-segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.av-segmented button {
  flex: 1; min-width: 0; padding: 8px 6px; border: none; background: transparent;
  color: var(--muted); font: inherit; font-weight: 600; font-size: .82rem;
  border-radius: 7px; cursor: pointer; transition: .15s; white-space: nowrap;
}
.av-segmented button:hover { color: var(--text); }
.av-segmented button.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0a0e1a;
}
.av-ratios button { font-size: .78rem; padding: 8px 4px; }

/* Result */
/* ═══════════ Aiventra: результат ═══════════ */
.av-result {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  scrollbar-width: thin;
  min-height: 60vh;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-width: 0;
}

/* Центрирование только когда пусто — через flex:1 на плейсхолдере */
.av-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--muted);
}

.av-placeholder-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

/* Изображение результата */
.av-result > img {
  display: block;
  max-width: min(100%, 720px);
  max-height: 72vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  align-self: center;
}

/* Кнопки под изображением */
.av-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Мобильная адаптация */
@media (max-width: 640px) {
  .av-result {
    padding: 14px;
    gap: 12px;
  }
  .av-result > img {
    max-height: 60vh;
    border-radius: 10px;
  }
  .av-result-actions {
    flex-direction: column;
    gap: 8px;
  }
  .av-result-actions .btn {
    width: 100%;
  }
}
/* ═══════════ Aiventra: режимы и tooltip ═══════════ */
.av-modes { grid-template-columns: 1fr 1fr; display: grid; gap: 4px; }
.av-modes button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  line-height: 1.2;
}
.av-mode-hint {
  font-size: .68rem;
  font-weight: 400;
  opacity: .75;
}
.av-modes button.is-active .av-mode-hint { opacity: .9; }

/* Панели режимов */
.av-pane { display: none; flex-direction: column; gap: 16px; }
.av-pane.is-open { display: flex; }

/* Info tooltip */
/* Info-иконка — всегда справа, никогда не сжимается и не переносится */
.av-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: -3px;
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  margin-left: 5px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: .68rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .15s, transform .15s;
}
.av-info:hover,
.av-info:focus {
  background: var(--primary);
  color: #0a0e1a;
  outline: none;
  transform: scale(1.1);
}
.av-info.is-open { background: var(--primary); color: #0a0e1a; }
/* Тултип: появляется под иконкой, по центру относительно неё */
.av-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  max-width: calc(100vw - 32px);
  padding: 10px 12px;
  background: #1a2234;
  color: var(--text);
  font-size: .8rem;
  font-weight: 400;
  line-height: 1.5;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  z-index: 100;
  display: none;
  text-align: left;
  white-space: normal;
}
.av-tooltip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #1a2234;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

/* Показ: hover/focus на десктопе, .is-open — универсально (для мобильных) */
@media (hover: hover) {
  .av-info:hover .av-tooltip,
  .av-info:focus .av-tooltip {
    display: block;
    animation: av-tip-in .18s ease;
  }
}
.av-info.is-open .av-tooltip {
  display: block;
}
@keyframes av-tip-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* Динамические атрибуты */
.av-attrs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.av-attrs input {
  padding: 9px 12px;
  font-size: .9rem;
}

/* Мобильная адаптация */
/* На мобильных — тултип справа от иконки, расширяется влево (внутрь экрана) */
/* ═══════════ МОБИЛЬНЫЕ: увеличенная иконка + fixed-тултип по центру ═══════════ */
@media (max-width: 900px) {
  /* Крупная иконка — палец не промахнётся */
  .av-info {
    width: 26px;
    height: 26px;
    font-size: .82rem;
    vertical-align: -5px;
    margin-left: 8px;
  }
  /* Убираем scale при hover/focus — иначе fixed-потомок привяжется к иконке */
  .av-info:hover,
  .av-info:focus { transform: none; }

  /* Затемнение фона при открытой подсказке */
  .av-info.is-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(10,14,26,.72);
    backdrop-filter: blur(2px);
    z-index: 990;
  }

  /* Тултип по центру экрана, не привязан к иконке */
  .av-tooltip,
  .av-info.is-open .av-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: calc(100vw - 40px);
    max-width: 340px;
    padding: 16px 18px;
    font-size: .88rem;
    line-height: 1.55;
    border-radius: 14px;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    animation: av-tip-center-in .2s ease;
  }
  .av-tooltip::before { display: none; }

  @keyframes av-tip-center-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  }
}

@media (max-width: 480px) {
  
  .av-mode-hint { font-size: .62rem; }
}
/* ═══════════ Иконка монетки ═══════════ */
.coin-icon { display: inline-block; vertical-align: -2px; flex-shrink: 0; }
.credits-inline { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.credits-num { font-weight: 600; }
.credits-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: .85rem; border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.credits-pill:hover { border-color: var(--primary); text-decoration: none; }
.credits-pill-inline { display: inline-flex; align-items: center; }

.app-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ═══════════ Тарифы ═══════════ */
.tariff-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
@media (min-width: 640px) { .tariff-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tariff-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

.tariff-card {
  position: relative; padding: 24px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.tariff-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.tariff-card.is-featured {
  border-color: var(--primary);
  background: linear-gradient(180deg, rgba(124,92,255,.12), var(--surface));
  box-shadow: 0 12px 36px rgba(124,92,255,.25);
}
.tariff-tag {
  position: absolute; top: -10px; right: 16px;
  padding: 3px 10px; border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0a0e1a; font-weight: 700; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em;
}
.tariff-name { margin: 0; font-size: 1.15rem; }
.tariff-price { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.tariff-rub { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.tariff-credits { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.tariff-bonus { color: #22c55e; font-size: .85rem; font-weight: 600; }
.tariff-per-unit { font-size: .82rem; color: var(--muted); }
.tariff-features { list-style: none; padding: 0; margin: 4px 0 8px; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.tariff-features li::before { content: '✓ '; color: var(--success); font-weight: 700; }

/* ═══════════ FAQ ═══════════ */
.faq-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .faq-grid { grid-template-columns: repeat(2, 1fr); } }
.faq-item {
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }

/* ═══════════ История ═══════════ */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 20px; }
.filter-bar select { width: auto; min-width: 160px; }

.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-card {
  display: grid; grid-template-columns: 100px 1fr auto; gap: 14px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); align-items: flex-start;
}
@media (max-width: 720px) {
  .history-card { grid-template-columns: 80px 1fr; }
  .history-meta { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
}
.history-thumb {
  width: 100px; height: 100px; border-radius: 10px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 720px) { .history-thumb { width: 80px; height: 80px; } }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-thumb-empty { font-size: 2rem; opacity: .5; }
.history-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.history-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.history-prompt { font-size: .9rem; color: var(--muted); line-height: 1.5; word-wrap: break-word; }
.history-result summary { cursor: pointer; font-size: .85rem; color: var(--primary-2); }
.history-result pre {
  margin-top: 8px; padding: 12px; background: var(--bg);
  border-radius: 10px; font-size: .85rem; white-space: pre-wrap;
  word-wrap: break-word; max-height: 260px; overflow-y: auto;
}
.history-meta { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; text-align: right; }
.history-cost { font-weight: 600; }

.pagination { display: flex; gap: 6px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); text-decoration: none;
}
.page-link:hover { border-color: var(--primary); }
.page-link.is-active { background: var(--primary); color: #0a0e1a; border-color: var(--primary); font-weight: 700; }

/* ═══════════ Кабинет ═══════════ */
.account-hero {
  display: flex; gap: 20px; align-items: center;
  padding: 24px; margin: 24px 0 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.account-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0a0e1a; font-weight: 800; font-size: 1.6rem;
}
.account-info h1 { margin: 0 0 4px; font-size: 1.4rem; }
.account-info p { margin: 2px 0; }

.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (min-width: 720px) { .account-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
@media (max-width: 480px) { .account-grid { grid-template-columns: 1fr; } }

.balance-card {
  background: linear-gradient(135deg, rgba(124,92,255,.2), var(--surface));
  border-color: rgba(124,92,255,.4);
  display: flex; flex-direction: column; gap: 10px;
}
.balance-big { font-size: 2rem; font-weight: 800; line-height: 1.1; }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-big { font-size: 1.6rem; font-weight: 700; }

.form-narrow { max-width: 480px; display: flex; flex-direction: column; gap: 14px; }

.alert.success { background: rgba(34,197,94,.12); color: #86efac; border: 1px solid rgba(34,197,94,.3); }

/* ═══════════ Checkout ═══════════ */
.checkout-card { max-width: 520px; display: flex; flex-direction: column; gap: 12px; }
.checkout-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.checkout-row:last-of-type { border-bottom: none; }
.checkout-total { font-size: 1.05rem; padding-top: 14px; margin-top: 6px; border-top: 2px solid var(--border); }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; }

.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }
/* ═══════════ Юридические страницы ═══════════ */
.legal-page {
  max-width: 820px;
  margin: 24px auto 48px;
  padding: 0 4px;
  line-height: 1.65;
}
.legal-page h1 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.25;
  margin: 0 0 8px;
}
.legal-page h2 {
  font-size: 1.15rem;
  margin: 32px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.legal-page h2:first-of-type {
  border-top: none;
  padding-top: 0;
}
.legal-page p { margin: 0 0 12px; }
.legal-page ul { margin: 0 0 14px; padding-left: 22px; }
.legal-page li { margin: 4px 0; }
.legal-page a { color: var(--primary-2); }
.legal-page mark.placeholder-data {
  background: #fbbf24;
  color: #0a0e1a;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-family: monospace;
}

/* ═══════════ Футер ═══════════ */
.footer {
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .85rem;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.footer-links a {
  color: var(--text);
  text-decoration: none;
}
.footer-links a:hover { color: var(--primary-2); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  color: var(--muted);
}

/* ═══════════ Cookie-баннер ═══════════ */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  padding: 14px 16px;
  background: rgba(10,14,26,.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(0,0,0,.3);
}
.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.cookie-banner-text {
  margin: 0;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.5;
  flex: 1;
  min-width: 260px;
}
.cookie-banner-text a { color: var(--primary-2); }
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 640px) {
  .cookie-banner-inner { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { justify-content: stretch; }
  .cookie-banner-actions .btn { flex: 1; }
}

/* ═══════════ Consent-галочка ═══════════ */
.consent-checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .88rem;
  line-height: 1.5;
}
.consent-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.consent-checkbox a { color: var(--primary-2); }
.consent-checkbox:hover { border-color: var(--primary); }

/* Статусы платежей */
.status-paid      { background: rgba(34,197,94,.15);  color: #86efac; }
.status-pending   { background: rgba(234,179,8,.15);  color: #fde68a; }
.status-failed    { background: rgba(239,68,68,.15);  color: #fca5a5; }
.status-cancelled { background: rgba(148,163,184,.15); color: #cbd5e1; }
/* Примеры работ */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
@media (min-width: 720px)  { .examples-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .examples-grid { grid-template-columns: repeat(3, 1fr); } }

.example-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.example-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}
.example-card a { display: block; }
.example-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bg);
}
.example-card figcaption {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: .9rem;
}
.example-card figcaption strong { font-weight: 600; }
/* ═══════════ Админка: Aiventra-логи и обратная связь ═══════════ */
.av-admin-list { display: flex; flex-direction: column; gap: 10px; }

.av-admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
}
.av-admin-card[open] { border-color: var(--primary); }

.av-admin-card > summary {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: .9rem;
}
.av-admin-card > summary::-webkit-details-marker { display: none; }

.av-admin-id { font-weight: 700; color: var(--primary-2); }

.av-admin-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: .9rem;
  line-height: 1.55;
}
.av-admin-body pre {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .85rem;
  margin: 4px 0 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
}
.av-admin-body strong { color: var(--text); }

.av-admin-fields { display: flex; flex-direction: column; gap: 10px; }

.av-admin-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: .85rem;
  color: var(--muted);
}
.av-admin-meta strong { color: var(--text); font-weight: 600; }

.av-admin-prompt summary {
  cursor: pointer;
  font-size: .9rem;
  padding: 6px 0;
}

.filter-bar input[type="text"] { width: 180px; }
@media (max-width: 640px) {
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select, .filter-bar .btn { width: 100%; }
  .av-admin-card > summary { font-size: .82rem; }
}
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: .85rem;
}
.oauth-divider::before,
.oauth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.oauth-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  justify-content: center;
  padding: 10px;
}
.oauth-btn:hover { border-color: var(--primary); background: var(--surface); }
.oauth-yandex { border-left: 3px solid #fc3f1d; }
.oauth-google { border-left: 3px solid #4285f4; }
.oauth-vk { border-left: 3px solid #0077ff; }
/* ═══════════ Aiventra: Расширенные настройки ═══════════ */
.av-advanced {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.av-advanced > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.av-advanced > summary::-webkit-details-marker { display: none; }
.av-advanced > summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform .2s;
  margin-top: -3px;
}
.av-advanced[open] > summary::after {
  transform: rotate(-135deg);
  margin-top: 3px;
}
.av-advanced > summary:hover { color: var(--text); }
.av-advanced-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ═══════════ Aiventra: Модальные окна ═══════════ */
.av-modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,14,26,.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: avFadeIn .15s ease;
}
@keyframes avFadeIn { from { opacity: 0; } to { opacity: 1; } }

.av-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: avSlideUp .2s ease;
}
@keyframes avSlideUp {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.av-modal-title { margin: 0 0 10px; font-size: 1.15rem; line-height: 1.3; }
.av-modal-message { margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.av-modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.av-modal-actions .btn { min-width: 100px; }

@media (max-width: 480px) {
  .av-modal { padding: 20px; }
  .av-modal-actions { flex-direction: column-reverse; }
  .av-modal-actions .btn { width: 100%; }
}
/* ═══════════ Видео: ползунок длительности ═══════════ */
.duration-field { gap: 10px; }

.duration-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}
.duration-value strong {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}
.duration-unit { font-size: .9rem; color: var(--muted); }

.duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--primary) 0%,
    var(--primary-2) var(--percent, 71%),
    var(--border) var(--percent, 71%),
    var(--border) 100%
  );
  outline: none;
  cursor: pointer;
  padding: 0;
  margin: 10px 0 8px;
}
.duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: grab;
  box-shadow: 0 2px 10px rgba(124, 92, 255, .55);
  transition: transform .15s;
}
.duration-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.12);
}
.duration-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--primary);
  cursor: grab;
  box-shadow: 0 2px 10px rgba(124, 92, 255, .55);
}
.duration-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}
.duration-slider::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}

.duration-marks {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--muted);
  padding: 0 4px;
  user-select: none;
}
/* Превью видео в истории */
.history-thumb-video { position: relative; }
.history-thumb-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.history-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
  pointer-events: none;
}
.history-thumb-video a:hover .history-play { transform: scale(1.15); }
.history-result video { display: block; }
/* ═══════════ Aiventra: премиальные штрихи ═══════════ */

/* Мягкое свечение в углу сайдбара */
.av-sidebar {
  background:
    radial-gradient(circle at 0% 0%, rgba(124,92,255,.10), transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(76,201,240,.06), transparent 40%),
    var(--surface);
}

/* Shimmer на кнопке «Сгенерировать» */
#av-generate {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
#av-generate::after {
  content: '';
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-20deg);
  transition: left .65s ease;
  pointer-events: none;
}
#av-generate:hover::after { left: 130%; }
#av-generate:active { transform: scale(.985); }
#av-generate:disabled { opacity: .85; cursor: wait; }

/* Плейсхолдер с плавающим кристаллом */
.av-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
}
.av-placeholder-orb {
  animation: av-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 12px 24px rgba(124,92,255,.35));
}
.av-placeholder-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
@keyframes av-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(-3deg); }
}

/* ═══════════ Премиальный лоадер ═══════════ */
.av-loading-premium {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 24px;
  animation: avFadeIn .3s ease;
}

.av-loader {
  position: relative;
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}
.av-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(124, 92, 255, .35);
  animation: av-ripple 2.4s cubic-bezier(.4, 0, .6, 1) infinite;
}
.av-loader-ring:nth-child(2) { animation-delay: .8s;  border-color: rgba(76, 201, 240, .35); }
.av-loader-ring:nth-child(3) { animation-delay: 1.6s; border-color: rgba(124, 92, 255, .25); }

.av-loader-core {
  position: relative;
  z-index: 2;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow:
    0 0 30px rgba(124, 92, 255, .55),
    0 0 60px rgba(76, 201, 240, .35),
    inset 0 1px 2px rgba(255,255,255,.4);
  animation: av-pulse 1.8s ease-in-out infinite;
}

@keyframes av-ripple {
  0%   { transform: scale(.45); opacity: .8; }
  80%  { opacity: .15; }
  100% { transform: scale(1.35); opacity: 0; }
}
@keyframes av-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 0 30px rgba(124,92,255,.55), 0 0 60px rgba(76,201,240,.35); }
  50%      { transform: scale(1.08); box-shadow: 0 0 40px rgba(76,201,240,.7),  0 0 80px rgba(124,92,255,.5); }
}

.av-loading-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}
.av-loading-step {
  margin: 0;
  min-height: 1.4em;
  color: var(--primary-2);
  font-weight: 600;
  font-size: .92rem;
  transition: opacity .18s ease;
}
.av-loading-hint {
  margin: 8px 0 0;
  font-size: .8rem;
  color: var(--muted);
}

/* Плавное появление картинки/видео в результате */
.av-result > img,
.av-result > video {
  animation: av-reveal .7s cubic-bezier(.2, .8, .3, 1.1);
}
@keyframes av-reveal {
  0%   { opacity: 0; transform: scale(.95); filter: blur(10px); }
  60%  { filter: blur(2px); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

/* Кнопки под результатом — плавное появление снизу */
.av-result-actions {
  animation: av-slide-up .5s cubic-bezier(.2, .8, .3, 1.1) .15s both;
}
@keyframes av-slide-up {
  0%   { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Фон результата с мягким свечением, когда есть картинка */
.av-result.has-image {
  background:
    radial-gradient(circle at 50% 0%, rgba(124,92,255,.10), transparent 55%),
    var(--surface);
}
/* ═══════════ Фиксы переполнения по ширине (Safari iOS) ═══════════ */
/* grid-template-columns: 1fr не даёт элементу сжаться меньше контента.
   minmax(0, 1fr) — даёт. Это классическая причина горизонтального скролла
   на iPhone, когда внутри grid лежит что-то длинное или с фикс. шириной. */
.aiventra-app,
.examples-grid,
.cat-grid,
.tariff-grid,
.account-grid,
.av-preview-grid {
  min-width: 0;
}
.aiventra-app > *,
.examples-grid > *,
.cat-grid > *,
.tariff-grid > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .aiventra-app {
    grid-template-columns: minmax(0, 1fr);
  }
  .av-result {
    position: static;
    max-height: none;
    overflow-y: visible;
    min-height: 40vh;
  }
  .av-tooltip {
    width: 240px;
    max-width: calc(100vw - 40px);
  }
}

/* На любом разрешении — примеры работ не должны раздвигать страницу */
.examples-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) {
  .examples-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.example-card img { max-width: 100%; height: auto; }

/* То же самое для каталога на мобильных */
.cat-grid {
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 720px) {
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* ═══════════ Aiventra: страховка от горизонтального скролла ═══════════ */
@media (max-width: 900px) {
  .aiventra-app {
    overflow-x: clip;
    max-width: 100%;
  }
  .av-sidebar,
  .av-result {
    overflow-x: clip;
    max-width: 100%;
  }
}
/* ═══════════ SEO-текст ═══════════ */
.seo-text {
  max-width: 820px;
  margin: 48px auto 16px;
  line-height: 1.7;
}
.seo-text h2 {
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  line-height: 1.3;
  margin: 0 0 16px;
}
.seo-text h3 {
  font-size: 1.1rem;
  margin: 24px 0 10px;
  color: var(--text);
}
.seo-text p {
  margin: 0 0 14px;
  color: var(--muted);
}
.seo-text ul {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
}
.seo-text li {
  margin: 6px 0;
}
.seo-text strong {
  color: var(--text);
}
.seo-text-links {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .92rem;
}
.seo-text-links a {
  color: var(--primary-2);
  text-decoration: none;
}
.seo-text-links a:hover {
  text-decoration: underline;
}
/* Стоимость под кнопкой «Сгенерировать» (для авторизованных) */
.av-cost-line-bottom {
  margin: 0;
  justify-content: center;
  text-align: center;
  font-size: .85rem;
  padding: 10px 0 0;
  border-top: 1px dashed var(--border);
}
.av-cost-line-bottom strong {
  font-size: 1.15rem;
}
/* Строка «Стоимость · Баланс» под кнопкой */
.av-cost-line-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0;
  padding: 12px 0 0;
  border-top: 1px dashed var(--border);
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}
.av-cost-line-bottom .av-cost-label {
  font-size: .82rem;
  color: var(--muted);
}
.av-cost-line-bottom strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.av-cost-sep {
  color: var(--border);
  font-size: 1rem;
  margin: 0 2px;
}

/* Баланс — зелёный если хватает, красный если нет */
#av-balance.av-balance-ok {
  color: #22c55e;
}
#av-balance.av-balance-low {
  color: #ef4444;
}
#av-balance.av-balance-low::after {
  content: ' ⚠';
  font-size: .9rem;
}

/* На мобильных — компактнее, чтобы влезало в одну строку */
@media (max-width: 480px) {
  .av-cost-line-bottom {
    font-size: .78rem;
    gap: 4px;
  }
  .av-cost-line-bottom strong { font-size: .92rem; }
  .av-cost-line-bottom .av-cost-label { font-size: .75rem; }
}
.av-tooltip strong {
  color: var(--primary-2);
  font-weight: 700;
}
/* ═══════════ Тултип, открывающийся вверх ═══════════ */
.av-info.av-info-up {
  z-index: 50;  /* выше кнопки, у которой isolation: isolate */
}

.av-info.av-info-up .av-tooltip {
  top: auto;
  bottom: calc(100% + 8px);
}

.av-info.av-info-up .av-tooltip::before {
  top: auto;
  bottom: -6px;
  transform: translateX(-50%) rotate(225deg);
  border-top: none;
  border-left: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* На мобильных тултип по центру экрана — «вверх» не нужно */
@media (max-width: 900px) {
  .av-info.av-info-up .av-tooltip {
    bottom: auto;
    top: 50%;
  }
  .av-info.av-info-up .av-tooltip::before {
    display: none;
  }
}
/* ═══════════ Текстовый генератор: стриминг ═══════════ */
.text-stream-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  text-align: left;
}

.text-reasoning-block,
.text-answer-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.text-reasoning-block {
  border-color: rgba(124, 92, 255, .35);
  background: rgba(124, 92, 255, .06);
}
.text-reasoning-label,
.text-answer-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.text-reasoning-label { color: var(--primary-2); }

.text-reasoning-content {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.55;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-style: italic;
}

.text-answer-content {
  font-size: .98rem;
  line-height: 1.65;
  white-space: pre-wrap;
  color: var(--text);
}

/* Индикатор «печатает» */
.text-answer-content:empty::after {
  content: '▋';
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 640px) {
  .text-stream-wrap { gap: 12px; }
  .text-reasoning-block,
  .text-answer-block { padding: 12px; }
}
/* ═══════════ Текстовый генератор: режимы в виде карточек ═══════════ */
.av-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.av-mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.av-mode-card:hover {
  border-color: var(--primary);
  background: rgba(124, 92, 255, .05);
}
.av-mode-card:active { transform: scale(.99); }

.av-mode-card.is-active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(124,92,255,.15), rgba(76,201,240,.08));
  box-shadow: 0 0 0 1px var(--primary) inset;
}

.av-mode-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .15s;
}
.av-mode-card.is-active .av-mode-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent;
}

.av-mode-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.av-mode-title {
  font-weight: 700;
  font-size: .92rem;
  line-height: 1.3;
}
.av-mode-hint {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.3;
}
.av-mode-card.is-active .av-mode-hint { color: var(--primary-2); }

@media (max-width: 480px) {
  .av-mode-card { padding: 10px 12px; gap: 10px; }
  .av-mode-icon { width: 32px; height: 32px; font-size: 1rem; }
  .av-mode-title { font-size: .88rem; }
  .av-mode-hint { font-size: .74rem; }
}