/* II Proxy — стиль в духе study24.ai: светлая тема, навигация, карточки */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #f4f6fb;
  --bg-gradient: linear-gradient(180deg, #eef2ff 0%, #f4f6fb 32%, #f8fafc 100%);
  --fg: #0f172a;
  --fg-soft: #334155;
  --border: #e2e8f0;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --surface: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --nav-h: 2.65rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--fg);
  min-height: 100dvh;
}

/* Страница чата: без вертикального скролла у окна — прокрутка только у ленты сообщений */
body.page-chat {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

/* ——— Верхняя навигация (как на study24.ai) ——— */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.65rem;
  min-height: var(--nav-h);
  padding: 0 0.75rem 0 0.9rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.45rem;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  grid-column: 2;
  justify-self: center;
  min-width: 0;
}

.nav-link {
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-soft);
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-link-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  grid-column: 3;
  justify-self: end;
  min-width: 0;
}

.top-nav .brand {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--fg-soft);
  box-shadow: var(--shadow-sm);
}

.balance-pill strong {
  color: var(--fg);
  font-weight: 600;
}

/* ——— Оболочка страницы ——— */
.main-shell {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.page-chat .main-shell {
  max-width: 58rem;
}

.page-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.page-lead {
  margin: -0.5rem 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Карточка чата */
.chat-shell {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.page-chat .chat-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

select,
input[type="text"],
input[type="password"],
input[type="tel"],
input[type="number"] {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
}

/* Выбор модели: вкладки по категориям + горизонтальная прокрутка карточек */
.model-picker {
  padding: 0.45rem 0 0.4rem;
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
}

.model-picker-empty {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.model-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  padding: 0 0.65rem 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--border);
}

.model-tabs::-webkit-scrollbar {
  height: 4px;
}

.model-tabs::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.model-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0.32rem 0.65rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.9);
  color: var(--fg-soft);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    box-shadow 0.15s;
}

.model-tab:hover {
  background: #f1f5f9;
  border-color: var(--border);
}

.model-tab--active {
  background: var(--surface);
  border-color: #c7d2fe;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.model-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.model-tab-emoji {
  font-size: 1rem;
  line-height: 1;
}

.model-tab-panels {
  padding: 0.4rem 0 0.35rem;
}

.model-tab-panel {
  outline: none;
}

.model-scroll-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.45rem;
  padding: 0.05rem 0.65rem 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.model-scroll-row::-webkit-scrollbar {
  height: 6px;
}

.model-scroll-row::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 999px;
}

.model-card {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 0 0 auto;
  width: min(17.5rem, 78vw);
  min-height: 3.65rem;
  padding: 0.45rem 0.6rem;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.model-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.1);
}

.model-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.model-card--selected {
  border-color: var(--accent);
  background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
  box-shadow: 0 2px 14px rgba(79, 70, 229, 0.16);
}

.model-card-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.model-card-icon-img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
  display: block;
  filter: opacity(0.92);
}

.model-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.model-card-avatar {
  --hue: 230;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-height: 3.25rem;
  border-radius: 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  background: linear-gradient(
    135deg,
    hsl(var(--hue), 58%, 52%) 0%,
    hsl(calc(var(--hue) + 38), 50%, 44%) 100%
  );
}

.model-card-avatar--sm {
  width: 2rem;
  height: 2rem;
  max-height: none;
  font-size: 0.95rem;
  border-radius: 0.5rem;
}

/* Производитель и название — одна строка (с усечением) */
.model-card-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.15rem 0.35rem;
  min-width: 0;
  line-height: 1.25;
}

.model-card-title-provider {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-soft);
}

.model-card-title-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--fg);
}

.model-card-title-row .model-card-free-badge {
  flex-shrink: 0;
  margin-left: 0.1rem;
}

.model-card-desc {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.model-card-free-badge {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #15803d;
  background: #dcfce7;
  border-radius: 0.25rem;
  padding: 0.1rem 0.3rem;
}

.tag-free {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #15803d;
  background: #ecfdf5;
  border-radius: 999px;
  vertical-align: middle;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-soft);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

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

.btn-primary,
.btn-accent {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover,
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.chat-area {
  min-height: 14rem;
  max-height: min(56vh, 28rem);
  overflow-y: auto;
  padding: 1rem 1.1rem;
  background: #fafbfc;
}

/* Лента диалога забирает свободную высоту; скролл только здесь */
.page-chat .chat-area {
  flex: 1 1 0;
  min-height: 8rem;
  max-height: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem;
}

.composer,
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.composer input[type="text"],
.input-row input[type="text"] {
  flex: 1;
  border-radius: 999px;
  padding-left: 1rem;
  padding-right: 1rem;
}

.input-row {
  margin-top: 0;
  padding-top: 0.875rem;
}

.msg {
  margin-bottom: 1rem;
  display: flex;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(100%, 36rem);
  padding: 0.65rem 0.95rem;
  border-radius: 1.125rem;
  font-size: 0.875rem;
  line-height: 1.55;
}

.msg.user .bubble {
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.msg.assistant .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-bottom-left-radius: 0.25rem;
}

.bubble .md a {
  color: var(--accent);
}

.bubble .cost {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.bubble .gen-img-wrap {
  margin: 0.5rem 0 0;
}

.bubble .gen-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.typing {
  color: var(--muted);
  font-size: 0.8125rem;
}

.video-panel {
  margin: 0;
  padding: 0.55rem 1.1rem 0.65rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fffefb 0%, #fff 100%);
}

.video-panel .hint {
  text-align: left !important;
  margin-top: 0.5rem;
}

.video-debug {
  display: none;
  margin: 0.35rem 0 0;
  padding: 0.5rem 0.65rem;
  font-size: 0.7rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 8rem;
  overflow: auto;
}

.video-debug--inline {
  max-height: 6rem;
}

.msg.assistant .bubble .assistant-video {
  width: 100%;
  max-width: 100%;
  max-height: min(70vh, 28rem);
  margin-top: 0.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0a0a0a;
  display: block;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

.footer-hint {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

.err {
  margin: 0 1rem;
  margin-top: 0.75rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Тарифы / логин layout */
.layout {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

.layout-wide {
  max-width: 52rem;
}

/* Новости */
.page-news-main {
  padding-bottom: 2rem;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.news-card__meta {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.news-card__title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Масштаб без обрезки: лимит по высоте как раньше; ширина пропорциональна исходнику. */
.news-card__media {
  display: flex;
  justify-content: center;
  margin: 0 0 0.75rem;
}

.news-card__img {
  display: block;
  max-height: clamp(11rem, 28vw, 14rem);
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.news-card__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.news-empty,
.news-err {
  font-size: 0.9375rem;
  color: var(--muted);
}

.news-err {
  color: #991b1b;
}

/* Логин */
.login-wrap {
  min-height: calc(100dvh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.login-box {
  width: 100%;
  max-width: 26rem;
  padding: 2rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.login-box h1 {
  margin: 0 0 0.35rem;
  font-size: 1.375rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.login-box p {
  font-size: 0.875rem;
  color: var(--muted);
  text-align: center;
  margin: 0 0 1.25rem;
}

.login-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: var(--fg-soft);
}

.login-box .field {
  margin-bottom: 0.85rem;
}

/* OAuth: Яндекс ID / VK ID (цвета и подписи как у типовых кнопок провайдеров) */
.login-box .login-oauth-intro {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.oauth-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease;
  box-sizing: border-box;
}

.oauth-btn:hover {
  filter: brightness(1.05);
}

.oauth-btn:active {
  transform: scale(0.99);
}

.oauth-btn:focus-visible {
  outline: 2px solid var(--accent, #818cf8);
  outline-offset: 2px;
}

.oauth-btn--yandex {
  background: #fc3f1d;
}

.oauth-btn--yandex:active {
  filter: brightness(0.94);
}

.oauth-btn--vk {
  background: #0077ff;
}

.oauth-btn--vk:active {
  filter: brightness(0.93);
}

.oauth-btn__badge {
  flex-shrink: 0;
  width: 1.875rem;
  height: 1.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
}

.oauth-btn__badge--yandex {
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1;
  color: #fc3f1d;
  background: #fff;
}

.oauth-btn__badge--vk {
  font-family: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.oauth-btn__label {
  flex: 1;
  text-align: left;
}

.login-box--wide {
  max-width: 28rem;
}

.login-box-lead {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.login-banner-err {
  color: #b91c1c;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.login-oauth-miss {
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
  margin: 0 0 1rem;
  line-height: 1.45;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.login-divider span {
  padding: 0 0.75rem;
}

.login-local {
  margin-top: 0.25rem;
}

.login-auth-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: color-mix(in oklab, var(--border) 35%, transparent);
  border-radius: 10px;
}

.login-auth-tab {
  flex: 1;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.login-auth-tab--active {
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
}

.login-field span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-soft);
}

.login-field input {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.9375rem;
}

.login-field input:focus {
  outline: 2px solid color-mix(in oklab, var(--accent, #818cf8) 70%, white);
  outline-offset: 0;
}

.login-submit {
  margin-top: 0.25rem;
  width: 100%;
  justify-content: center;
}

.login-local-msg {
  font-size: 0.8125rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.login-local-msg--err {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.login-local-msg--ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.login-field-hint {
  font-size: 0.75rem;
  margin: -0.15rem 0 0;
}

.login-field-hint--ok {
  color: #059669;
}

.login-field-hint--err {
  color: #b91c1c;
}

.login-oauth-miss--top {
  margin-bottom: 1rem;
}

.login-choice-local-btn {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  box-sizing: border-box;
  text-align: center;
  justify-content: center;
}

.login-local-view {
  margin-top: 0;
}

.login-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0 0.85rem;
  padding: 0.35rem 0;
  border: none;
  background: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent, #6366f1);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-back-btn:hover {
  color: var(--fg);
}

.login-form.login-form--aligned {
  --login-label-col: 7.5rem;
  --login-label-gap: 0.75rem;
}

.login-form.login-form--aligned .login-field.login-field--grid {
  display: grid;
  grid-template-columns: var(--login-label-col) minmax(0, 1fr);
  gap: 0.35rem var(--login-label-gap);
  align-items: start;
}

.login-field--grid > .login-field-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-soft);
  padding-top: 0.55rem;
  text-align: right;
  line-height: 1.25;
}

.login-field--grid .login-field-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.login-field--grid .login-field-control input {
  width: 100%;
  box-sizing: border-box;
}

.login-form--aligned .login-submit {
  margin-top: 0.15rem;
  margin-left: calc(var(--login-label-col) + var(--login-label-gap));
  width: calc(100% - var(--login-label-col) - var(--login-label-gap));
  max-width: none;
  box-sizing: border-box;
}

.login-form--aligned .login-register-disclaimer {
  margin-left: calc(var(--login-label-col) + var(--login-label-gap));
  width: calc(100% - var(--login-label-col) - var(--login-label-gap));
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .login-form.login-form--aligned .login-field.login-field--grid {
    grid-template-columns: 1fr;
  }

  .login-field--grid > .login-field-label {
    text-align: left;
    padding-top: 0;
  }

  .login-form--aligned .login-submit,
  .login-form--aligned .login-register-disclaimer {
    margin-left: 0;
    width: 100%;
  }
}

.login-register-disclaimer {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: color-mix(in oklab, var(--border) 25%, transparent);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Страницы «Настройки» / «Аккаунт» (общие классы) */
.page-account-main {
  padding-bottom: 2rem;
}

.account-user-summary {
  margin: -0.25rem 0 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--fg-soft);
}

.account-user-summary strong {
  color: var(--fg);
  font-weight: 600;
}

.account-user-id-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.account-user-id-code {
  font-size: 0.8rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  background: color-mix(in oklab, var(--border) 35%, transparent);
  border: 1px solid var(--border);
  color: var(--fg);
  word-break: break-all;
}

.account-blocked-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.9rem;
  line-height: 1.5;
}

.account-content {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 1rem;
}

.settings-tabs-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.15rem;
  margin: 0 0 1.1rem;
  border-radius: var(--radius);
  background: color-mix(in oklab, var(--border) 28%, transparent);
  border: 1px solid var(--border);
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.settings-tab:hover {
  color: var(--fg);
  background: color-mix(in oklab, var(--panel) 80%, transparent);
}

.settings-tab--active {
  color: var(--fg);
  background: var(--panel);
  border-color: var(--border);
  box-shadow: 0 1px 2px color-mix(in oklab, #000 08%, transparent);
}

.settings-tab__icon {
  font-size: 1.15rem;
  line-height: 1;
}

.settings-tab__label {
  white-space: nowrap;
}

.settings-tab-panels {
  min-height: 1rem;
}

.settings-tab-panel[hidden] {
  display: none !important;
}

.account-section {
  margin: 0;
}

.account-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.account-subsection-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 0.45rem;
  color: var(--fg);
}

select.settings-select {
  width: 100%;
  max-width: 28rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--fg);
  font: inherit;
}

.account-lead {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

.account-form-max {
  max-width: 28rem;
}

.account-hint-warn {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: -0.35rem 0 0.85rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, #f59e0b 45%, var(--border));
  background: color-mix(in oklab, #fef3c7 35%, var(--surface));
}

.tariffs h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  margin-bottom: 0.85rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card .meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--fg-soft);
}

.site-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Чат: колонка + боковая панель истории */
.app-layout {
  display: flex;
  max-width: 88rem;
  margin: 0 auto;
  align-items: stretch;
  min-height: calc(100dvh - var(--nav-h));
}

.page-chat .app-layout {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.page-chat .app-main-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.app-main-column {
  flex: 1;
  min-width: 0;
}

.page-chat .main-shell--chat {
  max-width: none;
  margin: 0;
  padding: 0.4rem 0.65rem 0.75rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-chat .page-title {
  font-size: 1.15rem;
  margin: 0 0 0.3rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.page-chat .page-lead {
  margin: 0 0 0.45rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  flex-shrink: 0;
}

.chat-page-notes {
  flex-shrink: 0;
  margin-top: 0.25rem;
  max-height: 6.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-right: 0.2rem;
}

.chat-page-notes .footer-hint {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  line-height: 1.35;
}

.chat-page-notes .footer-hint:first-child {
  margin-top: 0;
}

.page-chat .composer {
  padding: 0.65rem 0.85rem;
}

.chat-sidebar {
  width: 17rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.75rem 0.6rem 1rem;
  background: rgba(255, 255, 255, 0.75);
  border-right: 1px solid var(--border);
}

.sidebar-new-chat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #eceff3;
  color: var(--fg);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.sidebar-new-chat:hover {
  background: #e2e8f0;
}

.sidebar-new-chat:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar-new-icon {
  font-size: 1rem;
  line-height: 1;
}

.sidebar-section-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.5rem 0.5rem 0.25rem;
}

.sidebar-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  max-height: calc(100dvh - var(--nav-h) - 8rem);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-thread-item {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--fg-soft);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.35;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}

.sidebar-thread-title {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: inherit;
}

.sidebar-thread-model {
  width: 100%;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-thread-item:hover {
  background: #f1f5f9;
}

.sidebar-thread-item:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sidebar-thread-item--active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-thread-item--active .sidebar-thread-model {
  color: var(--accent);
  opacity: 0.85;
}

@media (max-width: 900px) {
  .app-layout {
    flex-direction: column;
  }

  .chat-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 13rem;
  }

  .sidebar-thread-list {
    max-height: 8rem;
  }
}

@media (max-width: 640px) {
  .top-nav {
    display: flex;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

  .top-nav .brand {
    grid-column: unset;
    justify-self: unset;
  }

  .nav-links {
    grid-column: unset;
    justify-self: unset;
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 0.15rem;
  }

  .nav-actions {
    grid-column: unset;
    justify-self: unset;
    margin-left: auto;
  }
}

/* ——— Пользовательское соглашение / юридический текст ——— */
.page-legal-main {
  padding-top: 0.75rem;
  max-width: 40rem;
}

.legal-doc__meta {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.legal-doc__meta a {
  color: var(--link);
  text-decoration: none;
}

.legal-doc__meta a:hover {
  text-decoration: underline;
}

.legal-doc__date {
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legal-doc h2 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.legal-doc p {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--fg-soft);
}

.legal-doc a {
  color: var(--link);
  text-decoration: none;
}

.legal-doc a:hover {
  text-decoration: underline;
}

/* ——— Страница «Контакты» ——— */
.page-contact-main {
  padding-top: 0.75rem;
  max-width: 56rem;
}

.contact-page p {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--fg-soft);
}

.contact-page__lead {
  font-size: 1.02rem;
  color: var(--fg);
  font-weight: 600;
}

.contact-page__channels-title {
  margin: 1rem 0 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg);
}

.contact-page__channels {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--fg-soft);
}

.contact-page__channels a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.contact-page__channels a:hover {
  text-decoration: underline;
}

.support-section {
  margin-top: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.support-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.support-note {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--fg-soft);
}

.support-form,
.support-reply-form {
  display: grid;
  gap: 0.75rem;
}

.support-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.support-field input,
.support-field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  color: var(--fg);
}

.support-field textarea {
  resize: vertical;
  min-height: 6.5rem;
}

.support-captcha-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.support-captcha-question {
  font-weight: 600;
  color: var(--fg);
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
}

.support-empty {
  font-size: 0.85rem;
  color: var(--muted);
}

.support-list {
  display: grid;
  gap: 0.65rem;
}

.support-item {
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  display: grid;
  gap: 0.35rem;
}

.support-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.support-item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.support-item-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.support-item-preview {
  font-size: 0.85rem;
  color: var(--fg-soft);
}

.support-unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

.support-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.support-thread-title {
  margin: 0;
  font-size: 1rem;
}

.support-thread-meta {
  margin: 0.4rem 0 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.support-messages {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.support-message {
  border-radius: 0.6rem;
  padding: 0.6rem 0.7rem;
  background: var(--accent-soft);
  color: var(--fg);
  font-size: 0.88rem;
  line-height: 1.45;
}

.support-message--admin {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.support-message-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.login-terms-line {
  margin: 1.15rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.login-terms-line a {
  color: var(--link);
  text-decoration: none;
}

.login-terms-line a:hover {
  text-decoration: underline;
}

/* ——— Страница тарифов: вкладки ——— */
.page-tariffs-main {
  padding-top: 0.75rem;
}

.tariffs-promo {
  margin: 0 0 1.1rem;
  padding: 0.9rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid #c7d2fe;
  background: linear-gradient(120deg, #eef2ff 0%, #eff6ff 55%, #f0fdf4 100%);
  box-shadow: var(--shadow-sm);
}

.tariffs-promo__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.tariffs-promo__text {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--fg-soft);
}

.tariffs-promo__text + .tariffs-promo__text {
  margin-top: 0.65rem;
}

.tariffs-filter-row {
  margin: 0 0 0.85rem;
  max-width: 28rem;
}

.tariffs-filter-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.tariffs-filter-row input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}

.tariff-card-cat {
  color: var(--accent);
  font-weight: 500;
}

.tariffs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tariffs-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-soft);
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}

.tariffs-tab:hover {
  background: var(--accent-soft);
  border-color: #c7d2fe;
}

.tariffs-tab--active {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.tariffs-tab-emoji {
  font-size: 1rem;
  line-height: 1;
}

.tariffs-panel[hidden] {
  display: none !important;
}

.tariffs-subsection-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tariffs-panel > .hint + .tariffs-subsection-label {
  margin-top: 0;
}

.tariffs-grid + .tariffs-subsection-label {
  margin-top: 0.9rem;
}

.tariffs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 0.85rem;
}

.tariff-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
  cursor: pointer;
}

/* Иначе .tariff-card { display: flex } перекрывает UA [hidden] и фильтр на странице тарифов не скрывает карточки */
.tariff-card.tariff-card--hidden,
article.tariff-card[hidden] {
  display: none !important;
}

.tariff-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.tariff-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.25;
}

.tariff-billing-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.2rem 0.45rem;
  border-radius: 0.35rem;
  max-width: 11rem;
  text-align: right;
  line-height: 1.25;
}

.tariff-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.tariff-meta code {
  font-size: 0.72rem;
  word-break: break-all;
}

.tariff-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--fg-soft);
}

.tariff-pricing-note {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--fg-soft);
  padding: 0.5rem 0.6rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tariff-token-prices {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--fg);
}

.tariff-price-line {
  margin: 0;
  font-size: 0.875rem;
}

.tariff-price-hint {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.tariff-open-chat {
  margin-top: auto;
  align-self: flex-start;
  text-decoration: none;
  text-align: center;
}

/* ——— Модальное окно пополнения (ЮKassa Simple Pay) ——— */
.pay-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pay-modal[hidden] {
  display: none !important;
}

.pay-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}

.pay-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 30rem);
  max-width: 100%;
  margin: min(4dvh, 2rem) auto max(1.75rem, env(safe-area-inset-bottom));
  overflow: visible;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 1.25rem 1.35rem;
  padding-bottom: max(3.75rem, calc(2.5rem + env(safe-area-inset-bottom)));
}

.pay-modal__close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pay-modal__close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.pay-modal__title {
  margin: 0 1.75rem 0.75rem 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pay-modal__hint {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.pay-modal__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.pay-modal__field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-soft);
}

.pay-modal__next {
  width: 100%;
  margin-top: 0.25rem;
}

.pay-modal__err {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: #b91c1c;
}

.pay-modal__panel .yoomoney-payment-form {
  margin: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding-bottom: 1rem;
}

.pay-modal__panel .ym-payment-btn-block.ym-align-space-between {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  row-gap: 0.85rem;
  justify-content: flex-start;
  margin-bottom: 0;
  padding-bottom: 2.5rem;
}

.pay-modal__panel .ym-input-icon-rub {
  flex: 1 1 10rem;
  min-width: 0;
}

.pay-modal__panel .ym-input-icon-rub .ym-input,
.pay-modal__panel .ym-sum-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.pay-modal__panel .ym-btn-pay {
  flex: 0 0 auto;
}

.pay-modal__panel .ym-logo {
  flex: 0 0 auto;
  width: 114px;
  height: 27px;
  margin-left: 0;
  margin-right: auto;
  margin-bottom: 0;
  align-self: center;
}

/* Логотип на отдельной строке под суммой и кнопкой — не обрезается */
.pay-modal__panel .ym-payment-btn-block .ym-logo {
  flex-basis: 100%;
  order: 3;
  margin-top: 0.35rem;
}

.pay-modal__panel .ym-customer-info {
  margin-top: 0.5rem;
}

/* Голос: STT, микрофон, аудиоответ */
.voice-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.voice-toolbar-label {
  font-size: 0.8125rem;
  color: var(--fg-soft);
  white-space: nowrap;
}

.voice-stt-select {
  flex: 1 1 12rem;
  min-width: 8rem;
  max-width: 22rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  font: inherit;
  font-size: 0.875rem;
  background: #fff;
}

.btn-mic--recording {
  animation: voice-mic-pulse 1s ease-in-out infinite;
  border-color: #dc2626;
  color: #dc2626;
}

@keyframes voice-mic-pulse {
  50% {
    opacity: 0.72;
  }
}

.assistant-audio {
  width: 100%;
  max-width: 28rem;
  margin-top: 0.5rem;
}

.msg.user .bubble.bubble--user-content {
  min-width: 0;
}

.user-attached-img-wrap {
  margin: 0 0 0.5rem 0;
}

.user-attached-img-wrap:last-child {
  margin-bottom: 0;
}

.user-attached-image {
  display: block;
  max-width: min(100%, 22rem);
  max-height: 20rem;
  width: auto;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  object-fit: contain;
}

.user-msg-text-after-media {
  margin-top: 0.65rem !important;
}

.msg.user .bubble.bubble--voice {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.12),
    rgba(147, 51, 234, 0.08)
  );
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.user-voice-msg {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.user-voice-msg__icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.user-voice-msg__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.user-voice-msg__title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--fg);
}

.user-voice-msg__hint {
  font-size: 0.8125rem;
  color: var(--fg-soft);
}

.user-voice-transcript {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(59, 130, 246, 0.22);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--fg);
  white-space: pre-wrap;
}

.user-voice-transcript--lead {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 0.875rem;
  line-height: 1.4;
  word-break: break-word;
}

.user-voice-foot {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.35rem;
  font-size: 0.68rem;
  line-height: 1.25;
  color: var(--muted);
}

.user-voice-meta-compact {
  flex-shrink: 0;
}

.user-voice-meta-compact-label {
  margin-left: 0.12rem;
  font-weight: 500;
  color: var(--fg-soft);
}

.voice-spend-inline {
  font-variant-numeric: tabular-nums;
}

.user-voice-compact-only {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--fg-soft);
}

.user-voice-compact-label {
  font-weight: 500;
}

.voice-spend-line--assistant {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.voice-spend-line--user {
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
}

.assistant-audio-block {
  margin-top: 0.65rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.assistant-audio-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 0.35rem;
}

/* Глобальное объявление о техработах (см. site-banner.js) */
#site-banner-slot {
  flex-shrink: 0;
}

.site-banner {
  background: linear-gradient(95deg, #fff7ed 0%, #ffedd5 45%, #fef3c7 100%);
  border-bottom: 1px solid #f59e0b;
  color: #92400e;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  text-align: center;
}

.site-banner__msg {
  margin: 0;
  font-weight: 500;
}

.site-banner__schedule {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.95;
}

/* Микрофон в строке композера: удержание без скролла страницы */
.page-chat .composer .btn-mic {
  flex-shrink: 0;
  touch-action: none;
  min-width: 2.75rem;
}
