/* =============================================
   Гид PRO ГОСТ ISO/IEC 17025-2019 — Стили
   ============================================= */

:root {
  --color-primary: #1a3a5c;
  --color-primary-dark: #0f2740;
  --color-primary-light: #2a5280;
  --color-accent: #c8a951;
  --color-accent-dark: #a8892e;
  --color-pro: #8b6914;
  --color-bg: #f4f6f9;
  --color-bg-white: #ffffff;
  --color-text: #1e2a3a;
  --color-text-muted: #5a6a7e;
  --color-border: #d8dfe8;
  --color-success: #2d6a4f;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Merriweather', Georgia, serif;
  --shadow-sm: 0 1px 3px rgba(15, 39, 64, 0.08);
  --shadow-md: 0 4px 16px rgba(15, 39, 64, 0.1);
  --shadow-lg: 0 8px 32px rgba(15, 39, 64, 0.14);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --color-on-accent: #0f2740;
}

[data-theme="dark"] {
  --color-primary: #4a8ec9;
  --color-primary-dark: #7eb3e0;
  --color-primary-light: #9ecbf0;
  --color-accent: #d4b86a;
  --color-accent-dark: #b89a4a;
  --color-pro: #c9a84c;
  --color-bg: #0f1419;
  --color-bg-white: #1a2332;
  --color-text: #e8edf4;
  --color-text-muted: #94a3b8;
  --color-border: #2d3a4d;
  --color-success: #52b788;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .header,
[data-theme="dark"] .chat-sidebar,
[data-theme="dark"] .chat-main,
[data-theme="dark"] .modal__content,
[data-theme="dark"] .admin-login,
[data-theme="dark"] .auth-card {
  background: var(--color-bg-white);
}

[data-theme="dark"] .msg {
  background: transparent;
  color: var(--color-text);
}

[data-theme="dark"] .msg__bubble {
  background: #f4f5f7;
  color: #1a1a1a;
}

[data-theme="dark"] .msg--own .msg__bubble {
  background: #4a4f58;
  color: #f2f2f4;
}

[data-theme="dark"] .msg--own {
  color: #f2f2f4;
}

[data-theme="dark"] .chat-messages {
  background: linear-gradient(180deg, #3d2e32 0%, #35282c 50%, #2f2428 100%);
}

[data-theme="dark"] .msg--pinned {
  background: #2d3848;
  border-color: var(--color-accent);
}

[data-theme="dark"] .msg__reply {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form__input,
[data-theme="dark"] .form__input:focus {
  background: #243044;
  color: var(--color-text);
  border-color: var(--color-border);
}

[data-theme="dark"] .payment-banner,
[data-theme="dark"] .payment-info,
[data-theme="dark"] .pro-status {
  background: #243044;
}

[data-theme="dark"] .reply-preview,
[data-theme="dark"] .chat-sidebar__info,
[data-theme="dark"] .chat-guest-notice,
[data-theme="dark"] .user-profile-bar,
[data-theme="dark"] .user-profile {
  background: #243044;
}

[data-theme="dark"] .topic-item {
  background: #243044;
}

[data-theme="dark"] .topic-item:hover,
[data-theme="dark"] .topic-item--active {
  background: var(--color-primary);
}

[data-theme="dark"] .chat-rail__tab {
  background: #243044;
}

[data-theme="dark"] .chat-rail__tab--active {
  background: var(--color-primary);
}

[data-theme="dark"] .logo:hover,
[data-theme="dark"] a:hover {
  color: var(--color-accent);
}

[data-theme="dark"] .chat-form__input {
  background: #243044;
}

[data-theme="dark"] .chat-form__input:focus {
  background: #2a384c;
}

[data-theme="dark"] .chat-compose,
[data-theme="dark"] .chat-guest-notice {
  background: var(--color-bg-white);
}

/* Тёмная тема — читаемость текста и контраст кнопок */
[data-theme="dark"] .hero {
  background: linear-gradient(160deg, #0a1628 0%, #1a3a5c 55%, #243b5c 100%);
}

[data-theme="dark"] .section--contacts,
[data-theme="dark"] .footer {
  background: #0a1628;
}

[data-theme="dark"] .section__title,
[data-theme="dark"] .pricing-card__title,
[data-theme="dark"] .about-card__title,
[data-theme="dark"] .feature__title,
[data-theme="dark"] .chat-sidebar__title,
[data-theme="dark"] .chat-main__header h2,
[data-theme="dark"] .payment-info__title,
[data-theme="dark"] .legal-content h1,
[data-theme="dark"] .legal-content h2,
[data-theme="dark"] .admin-header h1,
[data-theme="dark"] .modal__title,
[data-theme="dark"] .auth-panel__title {
  color: #e8edf4;
}

[data-theme="dark"] .pricing-card--pro .pricing-card__price {
  color: var(--color-accent);
}

[data-theme="dark"] .msg__author {
  color: var(--color-primary-light);
}

[data-theme="dark"] .btn--outline {
  color: var(--color-primary-light);
  border-color: var(--color-primary-light);
}

[data-theme="dark"] .btn--outline:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

[data-theme="dark"] .btn--ghost {
  color: var(--color-text-muted);
}

[data-theme="dark"] .btn--ghost:hover {
  color: var(--color-text);
  background: #243044;
}

[data-theme="dark"] .badge--pro {
  background: #3d3520;
  color: var(--color-accent);
}

[data-theme="dark"] .badge--expired,
[data-theme="dark"] .user-badge--expired {
  background: #3d2020;
  color: #f5a8a8;
  border-color: #5c3030;
}

[data-theme="dark"] .stat-card {
  background: var(--color-bg-white);
}

[data-theme="dark"] .stat-card__num {
  color: var(--color-text);
}

[data-theme="dark"] .form__error {
  background: #3d2020;
  color: #f5a8a8;
}

[data-theme="dark"] .payment-info__list dd,
[data-theme="dark"] .payment-info__text {
  color: var(--color-text);
}

[data-theme="dark"] .btn--write-admin:hover {
  background: #fff;
  color: var(--color-on-accent);
}

[hidden] {
  display: none !important;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-dark);
}

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}

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

.logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-radius: 6px;
}

.logo__mark--sm {
  font-size: 0.6rem;
  padding: 4px 6px;
}

.nav {
  display: flex;
  gap: 28px;
}

.nav__link {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav__link:hover {
  color: var(--color-primary);
}

.header__actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  align-items: center;
}

.btn-theme {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-theme:hover {
  border-color: var(--color-primary-light);
  background: var(--color-bg-white);
  transform: scale(1.05);
}

.btn-theme__icon {
  font-size: 1rem;
  line-height: 1;
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  transition: var(--transition);
}

.burger--open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger--open span:nth-child(2) {
  opacity: 0;
}

.burger--open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn--primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  color: #fff;
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn--outline:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn--ghost:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}

.btn--pro {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: var(--color-on-accent);
  border-color: var(--color-accent);
  font-weight: 700;
}

.btn--pro:hover {
  background: linear-gradient(135deg, var(--color-accent-dark) 0%, var(--color-pro) 100%);
  color: #fff;
  border-color: var(--color-accent-dark);
}

.btn--lg {
  padding: 14px 28px;
  font-size: 0.95rem;
}

.btn--block {
  width: 100%;
}

/* ---- Hero ---- */

.hero {
  background: linear-gradient(160deg, var(--color-primary-dark) 0%, var(--color-primary) 55%, var(--color-primary-light) 100%);
  color: #fff;
  padding: 80px 0 96px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 80% 20%, rgba(200, 169, 81, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 10% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
  pointer-events: none;
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  align-items: start;
  position: relative;
}

.hero__badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero__title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.25;
  margin-bottom: 20px;
  color: #fff;
}

.hero__desc {
  font-size: 1.05rem;
  line-height: 1.7;
  opacity: 0.92;
  max-width: 640px;
}

.hero__desc--secondary {
  font-size: 0.95rem;
  opacity: 0.78;
  margin-top: 12px;
}

.hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero__buttons .btn--outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.hero__buttons .btn--outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  color: #fff;
}

.hero-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(8px);
}

.hero-card__title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 16px;
  font-weight: 600;
}

.hero-card__list li {
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  opacity: 0.9;
}

.hero-card__list li:last-child {
  border-bottom: none;
}

.hero-card__list li::before {
  content: '▸';
  margin-right: 8px;
  color: var(--color-accent);
}

/* ---- Sections ---- */

.section {
  padding: 80px 0;
}

.section--light {
  background: var(--color-bg-white);
}

.section--pricing {
  background: var(--color-bg);
}

.section--contacts {
  padding: 60px 0;
  background: var(--color-primary-dark);
  color: #fff;
}

.section__header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 48px;
}

.section__title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2rem);
  color: var(--color-primary-dark);
  margin-bottom: 12px;
}

.section--contacts .section__title {
  color: #fff;
}

.section__subtitle {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* ---- About ---- */

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

.about-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.about-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.about-card__icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.about-card__icon svg {
  width: 24px;
  height: 24px;
  color: #fff;
}

.about-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 10px;
}

.about-card__text {
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

/* ---- Topics ---- */

.topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.topics-list__item {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-primary);
  transition: background var(--transition), border-color var(--transition);
}

.topics-list__item:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ---- Pricing ---- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  align-items: start;
}

.pricing-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.pricing-card--pro {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg);
}

.pricing-card__badge {
  position: absolute;
  top: -14px;
  right: 28px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-on-accent);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 6px 16px;
  border-radius: 20px;
}

.pricing-card__header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.pricing-card__title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--color-primary-dark);
  margin-bottom: 6px;
}

.pricing-card__label {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.pricing-card__price {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  margin: 8px 0 6px;
  line-height: 1.1;
}

.pricing-card__price span {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.pricing-card--pro .pricing-card__price {
  color: var(--color-pro);
}

.pricing-card__list {
  margin-bottom: 28px;
}

.pricing-card__list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
  color: var(--color-text);
  padding-left: 24px;
  position: relative;
}

.pricing-card__list li:last-child {
  border-bottom: none;
}

.pricing-card__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-weight: 700;
}

.pricing-card--pro .pricing-card__list li::before {
  color: var(--color-accent-dark);
}

.pricing-card__note {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---- Features ---- */

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.feature {
  background: var(--color-bg);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 24px 28px;
}

.feature__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.feature__text {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* ---- Contacts ---- */

.contacts-block {
  text-align: center;
}

.contacts-block__text {
  opacity: 0.8;
  margin: 12px 0 20px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.admin-contacts {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 20px auto;
}

.admin-contacts--compact {
  justify-content: flex-start;
  margin: 16px 0 0;
}

.admin-contact-icon {
  display: block;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  line-height: 0;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.admin-contact-icon img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: cover;
}

.admin-contact-icon--sm img {
  width: 40px;
  height: 40px;
}

.admin-contact-icon:hover {
  transform: scale(1.06);
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-contacts--compact .admin-contact-icon {
  border-color: var(--color-border);
}

.admin-contacts--compact .admin-contact-icon:hover {
  border-color: var(--color-primary);
}

.btn--write-admin {
  margin-top: 8px;
}

.btn--accent {
  background: var(--color-accent);
  color: var(--color-on-accent);
  border: none;
  font-weight: 600;
}

.btn--accent:hover {
  background: #fff;
  color: var(--color-on-accent);
}

/* ---- Footer ---- */

.footer {
  background: var(--color-primary-dark);
  color: rgba(255, 255, 255, 0.75);
  padding: 48px 0 32px;
}

.footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}

.footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
}

.footer__link {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.85rem;
}

.footer__link:hover {
  color: var(--color-accent);
}

.footer__copy {
  font-size: 0.8rem;
  opacity: 0.5;
}

/* ---- Modal / Forms ---- */

.modal {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
  background: var(--color-bg-white);
}

.modal::backdrop {
  background: rgba(15, 39, 64, 0.55);
  backdrop-filter: blur(4px);
}

.modal__content {
  padding: 36px 32px;
  position: relative;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--transition);
}

.modal__close:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.modal__title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--color-primary-dark);
  margin-bottom: 24px;
}

.modal__desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

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

.form__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
}

.form__input {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--color-bg-white);
}

.form__input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(42, 82, 128, 0.15);
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field .form__input {
  width: 100%;
  padding-right: 88px;
}

.password-field__toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary-light);
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}

.password-field__toggle:hover {
  color: var(--color-primary);
  background: var(--color-bg);
}

.form__checkboxes {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.form__checkbox input {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--color-primary);
}

.form__checkbox a {
  color: var(--color-primary-light);
  text-decoration: underline;
}

.form__link {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-primary-light);
}

/* ---- Responsive ---- */

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

  .hero__aside {
    max-width: 480px;
  }

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

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

@media (max-width: 768px) {
  .nav,
  .header__actions {
    display: none;
  }

  .nav.nav--open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--color-bg-white);
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    gap: 16px;
  }

  .header__actions.header__actions--open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(72px + 180px);
    left: 24px;
    right: 24px;
    background: var(--color-bg-white);
    padding: 0 0 20px;
    gap: 10px;
  }

  .header__actions.header__actions--open .btn {
    width: 100%;
  }

  .header__inner {
    position: relative;
  }

  .burger {
    display: flex;
  }

  .hero {
    padding: 56px 0 64px;
  }

  .hero__buttons {
    flex-direction: column;
  }

  .hero__buttons .btn {
    width: 100%;
  }

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

  .section {
    padding: 56px 0;
  }

  .footer__nav {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .modal__content {
    padding: 28px 20px;
  }

  .pricing-card {
    padding: 28px 20px;
  }
}

/* =============================================
   Chat, PRO, Admin — дополнительные стили
   ============================================= */

.nav__link--active {
  color: var(--color-primary);
  font-weight: 600;
}

.sync-notice {
  background: #fff8e6;
  border-bottom: 1px solid #e6c96a;
  color: #5c4a12;
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 10px 16px;
  text-align: center;
}

[data-theme="dark"] .sync-notice {
  background: #2a2418;
  border-bottom-color: rgba(200, 169, 81, 0.35);
  color: #e8dcc0;
}

.sync-notice--ok {
  background: #edf9f0;
  border-bottom-color: #8fd4a0;
  color: #1e5c32;
}

[data-theme="dark"] .sync-notice--ok {
  background: #152419;
  border-bottom-color: rgba(143, 212, 160, 0.35);
  color: #b8e6c8;
}

.btn--sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn--danger {
  background: #c0392b;
  color: #fff;
  border-color: #c0392b;
}

.btn--danger:hover {
  background: #962d22;
  border-color: #962d22;
  color: #fff;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-menu__nick {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu__email {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Профиль пользователя ---- */

.user-profile-bar {
  background: var(--color-bg-white);
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
  box-shadow: var(--shadow-sm);
}

.user-profile-bar .user-profile {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.user-profile {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.user-profile__head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.user-profile__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.user-profile__nick {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.user-profile__email {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.user-profile__head .user-badge {
  margin-left: auto;
}

.user-profile__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.user-profile__row dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.user-profile__row dd {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
}

.chat-sidebar__info .user-profile {
  margin-bottom: 16px;
  padding: 14px;
}

.chat-sidebar__info .user-profile__meta {
  grid-template-columns: 1fr;
  gap: 8px;
}

.chat-sidebar__info .user-profile__head {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

@media (max-width: 768px) {
  .user-profile__meta {
    grid-template-columns: 1fr;
  }
}

.user-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.user-badge--pro {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-on-accent);
  border-color: var(--color-accent);
}

.user-badge--expired {
  background: #fdecea;
  color: #c0392b;
  border-color: #f5c6cb;
}

/* ---- Chat layout ---- */

.page-chat .chat-layout,
.page-admin .admin-layout {
  min-height: calc(100vh - 72px);
}

.chat-layout {
  padding: 24px 0 40px;
}

.chat-layout__inner {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.chat-sidebar {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: sticky;
  top: 96px;
}

.chat-sidebar--pro {
  border-color: var(--color-accent);
}

.chat-sidebar__title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.chat-sidebar__desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.chat-sidebar__info {
  font-size: 0.85rem;
  padding: 12px;
  background: var(--color-bg);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.chat-main {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 600px;
  max-height: calc(100vh - 120px);
}

.chat-main__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
}

.chat-main__header h2 {
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-main__count {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, #fff7f3 0%, #ffece4 48%, #ffdfd2 100%);
}

.chat-empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: 40px 20px;
}

.chat-empty--center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-compose {
  border-top: 1px solid var(--color-border);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--color-bg-white);
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
  z-index: 5;
}

.chat-guest-notice {
  border-top: 1px solid var(--color-border);
  padding: 16px 12px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  text-align: center;
  background: var(--color-bg-white);
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 100%;
  margin-top: auto;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.chat-form__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.chat-form__attach {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background var(--transition), color var(--transition);
  margin: 0;
}

.chat-form__attach:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}

.chat-form__attach-icon {
  font-size: 1.35rem;
  line-height: 1;
  pointer-events: none;
}

.chat-form__input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  max-height: 128px;
  resize: none;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 21px;
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1.35;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  box-sizing: border-box;
}

.chat-form__input:focus {
  background: var(--color-bg-white);
}

.chat-form__send {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  max-width: 36px;
  border-radius: 50%;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  line-height: 0;
}

.chat-form__send.btn {
  padding: 0;
  min-width: 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-width: 0;
  white-space: nowrap;
}

.chat-form__send-icon {
  display: block;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.chat-form__send.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.chat-form__send.btn--primary:hover {
  background: var(--color-primary-light);
}

.chat-form__send.btn--pro {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-on-accent);
}

.chat-form__files {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 0;
}

.chat-form__files:empty {
  display: none;
}

.chat-form__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.chat-form__hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.file-upload input {
  display: none;
}

.file-upload__hint {
  flex: 1;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-form__hint {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.msg__file--missing {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg);
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.reply-preview button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

/* ---- Messages ---- */

.msg {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: 88%;
}

.msg__layout {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.msg--own .msg__layout {
  flex-direction: row-reverse;
}

.msg__bubble {
  flex: 1;
  min-width: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.msg-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
}

.msg-avatar--img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  display: block;
}

.msg-avatar--initial {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.msg__reactions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  width: 100%;
}

.msg__reaction-count {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}

.msg__reaction-count:hover {
  color: var(--color-primary);
}

.msg-reaction-popover,
.msg-details-popover {
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  max-width: 220px;
}

.msg-details-popover {
  flex-direction: column;
  gap: 0;
  padding: 10px 12px;
  min-width: 160px;
}

.msg-details-popover__title {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.msg-details-popover__list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
}

.msg-details-popover__list li {
  padding: 4px 0;
  font-size: 0.88rem;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.msg-details-popover__list li:last-child {
  border-bottom: none;
}

.msg__btn--icon {
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
}

.msg__meta {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.msg__meta-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.msg__meta-btn:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.msg__link {
  color: var(--color-primary-light);
  text-decoration: underline;
  word-break: break-all;
}

.msg__link:hover {
  color: var(--color-primary);
}

.msg__edit {
  margin-top: 8px;
}

.msg__edit-input {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  margin-bottom: 8px;
}

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

.msg--editing .msg__reactions,
.msg--editing .msg__meta {
  display: none;
}

.msg__reaction-add {
  display: none;
}

.msg__reaction-picker {
  display: none;
}

.msg__btn--react {
  display: none;
}

.msg__reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  font-size: 0.82rem;
  cursor: pointer;
}

.msg__reaction--active {
  border-color: var(--color-primary-light);
  background: rgba(42, 82, 128, 0.1);
}

.msg__reaction span {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.msg__reaction-pick {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.msg__reaction-pick:hover {
  background: var(--color-bg);
}

.msg--pinned .msg__bubble {
  border-color: var(--color-accent);
  background: #fdfaf3;
}

.msg__pin-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  margin-bottom: 6px;
}

.msg__header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.msg__author {
  font-size: 0.85rem;
  color: var(--color-primary);
}

.msg__time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.msg__reply {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-bg-white);
  padding: 6px 10px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  border-left: 3px solid var(--color-primary-light);
}

.msg__text {
  font-size: 0.92rem;
  line-height: 1.55;
}

.msg__files {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg__file--img img,
.msg__file--video video {
  max-width: 100%;
  max-height: 280px;
  border-radius: var(--radius);
}

.msg__file figcaption,
.msg__file--doc {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.msg__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.msg__btn {
  background: none;
  border: none;
  font-size: 0.75rem;
  color: var(--color-primary-light);
  cursor: pointer;
  padding: 0;
}

.msg__btn:hover {
  text-decoration: underline;
}

.msg__btn--danger {
  color: #c0392b;
}

/* ---- Topic list (PRO) ---- */

.chat-rail {
  display: none;
}

.chat-rail__tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 6px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.chat-rail__tab:hover {
  border-color: var(--color-primary-light);
  color: var(--color-primary);
}

.chat-rail__tab--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.chat-rail__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

.chat-rail__tab--active .chat-rail__badge {
  background: #fff;
  color: #e74c3c;
}

/* Desktop sidebar: список чатов с непрочитанными */
.desktop-chats-nav {
  display: none;
}

@media (min-width: 993px) {
  .desktop-chats-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
  }

  .desktop-chats-nav__head {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
  }

  .desktop-chats-nav__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--color-text);
    font-size: 0.88rem;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition);
  }

  .desktop-chats-nav__item:hover {
    background: var(--color-bg);
    border-color: var(--color-border);
  }

  .desktop-chats-nav__item--active {
    background: var(--color-bg);
    border-color: var(--color-primary-light);
    font-weight: 600;
    color: var(--color-primary-dark);
  }

  .desktop-chats-nav__item--locked {
    opacity: 0.85;
  }

  .desktop-chats-nav__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .desktop-chats-nav__item .m-card__tier {
    flex-shrink: 0;
    font-size: 0.62rem;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 700;
  }

  .desktop-chats-nav__item .m-card__tier--pro {
    background: var(--color-accent);
    color: #fff;
  }

  .desktop-chats-nav__item .m-card__tier--free {
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
  }

  .desktop-chats-nav__item .m-card__tier--dm {
    background: rgba(42, 82, 128, 0.12);
    color: var(--color-primary);
    border: 1px solid rgba(42, 82, 128, 0.2);
  }

  .desktop-chats-nav__item .m-card__unread {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
  }

  .desktop-chats-nav__empty {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    padding: 8px 10px;
    margin: 0;
  }

  .page-pro .pro-topics-panel .desktop-chats-nav {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .page-pro .pro-topics-panel .pro-sidebar-tools {
    flex-shrink: 0;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 12px;
  }

  .page-pro .pro-topics-panel .topic-list {
    display: none !important;
  }

  .page-chats-hub .m-main {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px 48px;
  }

  .page-chats-hub .m-page__title {
    font-size: 1.5rem;
    padding: 0;
    margin-bottom: 20px;
  }

  .page-chats-hub .m-cards--compact {
    gap: 10px;
  }
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.topic-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.topic-item:hover,
.topic-item--active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.topic-item--pinned {
  font-weight: 600;
}

.topic-item__title {
  display: block;
  font-weight: 600;
  line-height: 1.3;
}

.topic-item__unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  vertical-align: middle;
}

.topic-item--active .topic-item__unread,
.topic-item:hover .topic-item__unread {
  background: #fff;
  color: #e74c3c;
}

.topic-item__meta {
  display: none;
  font-size: 0.76rem;
  line-height: 1.35;
  opacity: 0.88;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.pro-chat-back {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.pro-chat-back:hover {
  border-color: var(--color-primary-light);
  background: var(--color-bg-white);
}

.topic-list__empty {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.pro-status {
  font-size: 0.85rem;
  padding: 10px;
  background: #fdfaf3;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
}

/* ---- PRO request / payment ---- */

.payment-plans {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.payment-plan {
  background: #fdfaf3;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
}

.payment-plan--pro {
  border-color: var(--color-accent);
}

.payment-plan--selected {
  box-shadow: 0 0 0 1px var(--color-accent);
}

.payment-plan__title {
  margin: 0 0 4px;
  font-size: 1rem;
}

.payment-plan__price {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.payment-plan__desc {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.payment-manual {
  margin-bottom: 16px;
}

.payment-manual summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.payment-info {
  background: #fdfaf3;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.payment-info__title {
  font-size: 0.9rem;
  color: var(--color-primary-dark);
  margin-bottom: 12px;
}

.payment-info__list {
  margin-bottom: 12px;
}

.payment-info__list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.payment-info__list dt:first-child {
  margin-top: 0;
}

.payment-info__list dd {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.payment-info__list dd a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

.payment-info__text {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--color-text);
  border-top: 1px solid rgba(200, 169, 81, 0.4);
  padding-top: 12px;
}

.chat-sidebar__note {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.payment-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: linear-gradient(135deg, #fdfaf3 0%, #f5edd8 100%);
  border-bottom: 2px solid var(--color-accent);
  padding: 16px 20px;
}

.payment-banner__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.payment-banner__text {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-text);
}

.msg--welcome {
  background: linear-gradient(135deg, #fdfaf3 0%, #f5edd8 100%);
  border: 1px solid rgba(200, 169, 81, 0.45);
  border-radius: var(--radius);
  padding: 12px 14px;
}

[data-theme="dark"] .msg--welcome {
  background: linear-gradient(135deg, #2a2418 0%, #1f1a12 100%);
  border-color: rgba(200, 169, 81, 0.35);
}

.mod-msg__files {
  font-size: 0.82rem;
  color: var(--color-primary);
  margin: 6px 0;
}

/* ---- Login page ---- */

.page-login .auth-page {
  padding: 40px 0 60px;
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.auth-page__inner {
  width: 100%;
  max-width: 440px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
}

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

.auth-panel {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.auth-panel h1 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.auth-panel__desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.search-results,
.search-result {
  font-size: 0.82rem;
}

.search-result {
  padding: 8px;
  background: var(--color-bg);
  border-radius: var(--radius);
  margin-top: 6px;
}

.search-result--empty {
  color: var(--color-text-muted);
}

/* ---- Admin ---- */

.admin-layout {
  padding: 32px 0 60px;
}

.admin-header {
  margin-bottom: 28px;
}

.admin-header h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--color-primary-dark);
}

.admin-header p {
  color: var(--color-text-muted);
  margin-top: 6px;
}

.admin-demo-hint {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fdfaf3;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--color-text);
}

.admin-demo-hint--block {
  display: block;
  margin-bottom: 20px;
}

.admin-login {
  max-width: 420px;
  margin: 60px auto;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.admin-login h1 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.admin-login__desc {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.form__error {
  color: #c0392b;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: #fdecea;
  border-radius: var(--radius);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card--alert {
  border-color: #e74c3c;
  background: #fdf2f2;
  cursor: pointer;
}

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

.stat-card--pulse {
  animation: pulse-alert 2s ease-in-out infinite;
}

@keyframes pulse-alert {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}

.admin-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #fdf2f2 0%, #fdecea 100%);
  border: 2px solid #e74c3c;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.admin-alert__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.92rem;
}

.tab-badge,
.nav-badge,
.notif-badge,
.m-card__unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.m-card__row .m-card__unread {
  margin-left: auto;
}

.tab-badge,
.nav-badge {
  margin-left: 6px;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.btn-notifications {
  position: relative;
}

/* Панель уведомлений (колокольчик) */
.notif-panel {
  position: fixed;
  z-index: 500;
  width: min(320px, calc(100vw - 16px));
  max-height: min(70vh, 480px);
  overflow-y: auto;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
}

.notif-panel__title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.notif-panel__section + .notif-panel__section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

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

.notif-panel__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-bg);
  margin-bottom: 6px;
}

.notif-panel__item:hover {
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg));
}

.notif-panel__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
}

.notif-panel__count {
  flex-shrink: 0;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.notif-panel__system {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.notif-panel__system:last-child {
  border-bottom: none;
}

.notif-panel__system time {
  display: block;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.notif-panel__system p {
  margin: 0;
  color: var(--color-text);
}

.notif-panel__close {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: transparent;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.tab-badge--inline {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 6px;
}

.admin-tab--has-new {
  border-color: #e74c3c;
  color: #c0392b;
  font-weight: 700;
}

.pro-requests-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pro-request {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.pro-request--new {
  border-color: #e74c3c;
  border-left: 4px solid #e74c3c;
  background: #fffbfb;
}

.pro-request__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pro-request__nick {
  display: block;
  font-size: 1rem;
  color: var(--color-primary-dark);
}

.pro-request__email {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.pro-request__header time {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.pro-request__text {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.pro-request__files {
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-bottom: 12px;
}

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

.stat-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}

.stat-card--pro {
  border-color: var(--color-accent);
}

.stat-card--warn {
  border-color: #f5c6cb;
}

.stat-card__num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.stat-card__label {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 10px 20px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.admin-tab--active,
.admin-tab:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.admin-panel {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.admin-panel__toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-panel__toolbar .form__input {
  flex: 1;
  min-width: 180px;
}

.admin-panel__desc {
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.admin-subtitle {
  font-size: 1rem;
  margin: 24px 0 12px;
  color: var(--color-primary-dark);
}

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

.admin-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.admin-card--warn {
  border-color: #f5c6cb;
}

.admin-card h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--color-primary-dark);
}

.admin-card__desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.form--inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form__input--select {
  min-width: 140px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

.admin-table th {
  background: var(--color-bg);
  font-weight: 600;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.admin-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge--pro { background: #fdf3d7; color: var(--color-pro); }
.badge--free { background: var(--color-bg); color: var(--color-text-muted); }
.badge--expired { background: #fdecea; color: #c0392b; }
.badge--blocked { background: #fdecea; color: #962d22; }
.badge--admin { background: var(--color-primary); color: #fff; }

.subs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subs-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--color-bg);
  border-radius: var(--radius);
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.subs-item span:first-child {
  flex: 1;
  min-width: 180px;
}

.mod-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mod-msg {
  padding: 14px;
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.mod-msg p {
  margin: 8px 0;
  font-size: 0.88rem;
}

.admin-dm-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 16px;
  min-height: 480px;
}

.admin-dm-inbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 640px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--color-bg);
}

.admin-dm-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
}

.admin-dm-item--active {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface));
}

.admin-dm-item--new {
  border-left: 3px solid var(--color-accent);
}

.admin-dm-item__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.admin-dm-item__badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.admin-dm-item__email,
.admin-dm-item__preview {
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.admin-dm-item__preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-dm-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--color-bg);
}

.admin-dm-thread__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.admin-dm-thread__email {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.admin-dm-thread__messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.dm-msg {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.dm-msg--own {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
}

.dm-msg__meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.admin-dm-reply textarea {
  width: 100%;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .admin-dm-layout {
    grid-template-columns: 1fr;
  }
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Legal pages ---- */

.page-legal {
  padding: 40px 0 60px;
}

.legal-content {
  max-width: 760px;
  margin: 0 auto;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.legal-content h1 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--color-primary-dark);
  margin-bottom: 8px;
}

.legal-content .legal-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.legal-content h2 {
  font-size: 1.05rem;
  color: var(--color-primary-dark);
  margin: 24px 0 10px;
}

.legal-content p,
.legal-content li {
  font-size: 0.92rem;
  color: var(--color-text);
  margin-bottom: 10px;
}

.legal-content ul {
  list-style: disc;
  padding-left: 24px;
  margin-bottom: 16px;
}

.legal-back {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 0.88rem;
}

@media (max-width: 992px) {
  .page-chat {
    overflow: hidden;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
  }

  .page-chat .header .container {
    padding: 0 10px;
    max-width: 100%;
  }

  .page-chat .user-profile-bar {
    display: none;
  }

  .page-chat .header__inner {
    height: 56px;
  }

  .page-chat .logo__text {
    display: none;
  }

  .page-chat .chat-layout {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    margin: 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
    z-index: 1;
  }

  .chat-layout__inner {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    gap: 0;
    overflow: hidden;
  }

  .chat-sidebar {
    order: 1;
    flex: 0 0 58px;
    width: 58px;
    min-width: 58px;
    max-width: 58px;
    height: 100%;
    padding: 6px 4px;
    margin: 0;
    border-radius: 0;
    border-top: none;
    border-bottom: none;
    border-left: none;
    border-right: 1px solid var(--color-border);
    position: relative;
    top: auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    align-self: stretch;
  }

  .chat-sidebar__body {
    display: none !important;
  }

  .chat-rail {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    min-height: min-content;
  }

  .chat-rail__tab {
    min-height: 42px;
    font-size: 0.58rem;
    padding: 4px 2px;
    border-radius: 5px;
  }

  .topic-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 0;
    width: 100%;
    flex: 1;
  }

  .topic-item {
    min-height: 42px;
    padding: 4px 2px;
    font-size: 0.56rem;
    line-height: 1.12;
    text-align: center;
    word-break: break-word;
    hyphens: auto;
    border-radius: 5px;
  }

  .topic-list__empty {
    font-size: 0.52rem;
    line-height: 1.15;
    padding: 4px 2px;
    text-align: center;
  }

  .chat-main {
    order: 2;
    flex: 1 1 auto;
    width: auto;
    max-width: 100%;
    min-width: 0;
    height: 100%;
    border-radius: 0;
    border-top: none;
    border-right: none;
    border-bottom: none;
    border-left: none;
    max-height: none;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .chat-main__header {
    grid-row: 1;
    padding: 8px 8px;
    min-width: 0;
  }

  .chat-main__header h2 {
    font-size: 0.82rem;
    max-width: none;
  }

  .chat-main__count {
    font-size: 0.68rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .payment-banner {
    display: none;
  }

  .page-pro-request .chat-main {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .page-pro-request .payment-banner {
    display: flex;
    grid-row: 2;
    padding: 8px;
    gap: 8px;
    flex-shrink: 0;
    max-height: 32vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-pro-request .payment-banner__icon {
    font-size: 1.1rem;
  }

  .page-pro-request .payment-banner__text {
    font-size: 0.72rem;
    line-height: 1.45;
  }

  .page-pro-request .chat-messages,
  .page-pro-request .chat-empty {
    grid-row: 3;
  }

  .page-pro-request .chat-compose {
    grid-row: 4;
  }

  .chat-messages,
  .chat-empty,
  .chat-empty--center,
  #no-topic {
    grid-row: 2;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chat-messages {
    padding: 8px 6px;
    gap: 8px;
    word-break: break-word;
    overflow-x: hidden;
  }

  .chat-compose,
  .chat-guest-notice {
    grid-row: 3;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 0 -2px 12px rgba(15, 39, 64, 0.08);
  }

  .chat-compose {
    padding: 6px 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    background: var(--color-bg-white);
  }

  [data-theme="dark"] .chat-compose {
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
  }

  .chat-form,
  .chat-form__bar {
    min-width: 0;
    max-width: 100%;
  }

  .chat-form__bar {
    gap: 4px;
  }

  .chat-form__attach {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
  }

  .chat-form__attach-icon {
    font-size: 1.05rem;
  }

  .chat-form__input {
    min-height: 34px;
    max-height: 96px;
    padding: 8px 10px;
    font-size: 16px;
    border-radius: 17px;
  }

  .chat-form__send,
  .chat-form__send.btn {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    max-width: 32px;
  }

  .chat-form__send-icon {
    width: 16px;
    height: 16px;
  }

  .chat-form__hint {
    display: none;
  }

  .msg {
    padding: 8px 10px;
    font-size: 0.88rem;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .msg__header {
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .msg__time {
    font-size: 0.68rem;
  }

  .msg__actions {
    flex-wrap: wrap;
    gap: 4px;
  }

  .msg__btn {
    font-size: 0.72rem;
    padding: 2px 6px;
  }

  .msg__meta {
    font-size: 0.72rem;
  }

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

  /* PRO: список тем → отдельный чат (как в Telegram) */
  .page-pro .chat-layout__inner {
    display: block;
    position: relative;
  }

  .page-pro .pro-topics-panel {
    flex: none;
    width: 100%;
    max-width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .page-pro .pro-topics-panel .chat-sidebar__body {
    display: block !important;
    flex-shrink: 0;
    padding: 12px 14px 10px;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-white);
  }

  .page-pro .pro-topics-panel .chat-sidebar__title {
    font-size: 1.15rem;
    margin-bottom: 4px;
  }

  .page-pro .pro-topics-panel .chat-sidebar__desc {
    font-size: 0.82rem;
    margin-bottom: 12px;
  }

  .page-pro .pro-topics-panel .chat-sidebar__info {
    display: none;
  }

  .page-pro .pro-topics-panel .topic-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px 12px;
    gap: 8px;
    margin-top: 0;
    -webkit-overflow-scrolling: touch;
  }

  .page-pro .pro-topics-panel .topic-item {
    min-height: auto;
    padding: 14px 14px;
    font-size: 0.92rem;
    text-align: left;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .page-pro .pro-topics-panel .topic-item__meta {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--color-text-muted);
    white-space: normal;
  }

  .page-pro .pro-topics-panel .topic-item--active .topic-item__meta {
    color: rgba(255, 255, 255, 0.88);
  }

  .page-pro .pro-chat-panel {
    display: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    flex: none;
    order: unset;
  }

  .page-pro:not(.pro-chat-open) .pro-chat-panel {
    visibility: hidden;
    pointer-events: none;
  }

  .page-pro.pro-chat-open .pro-topics-panel {
    display: none;
  }

  .page-pro.pro-chat-open .pro-chat-panel {
    display: grid;
    visibility: visible;
    pointer-events: auto;
  }

  .page-pro.pro-chat-open .pro-chat-back {
    display: inline-flex;
  }

  .page-pro.pro-chat-open .chat-main__header {
    gap: 6px;
  }
}

@media (max-width: 768px) {
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .form--inline {
    flex-direction: column;
    align-items: stretch;
  }

  .msg {
    max-width: 100%;
  }
}

/* ===== Личный кабинет ===== */
.page-account {
  background: var(--color-bg-alt, #f5f6f8);
}

.account-page {
  padding: 2rem 0 4rem;
}

.account-header {
  margin-bottom: 2rem;
}

.account-header h1 {
  font-family: var(--font-serif, Merriweather, serif);
  margin: 0 0 0.5rem;
}

.account-header__desc {
  color: var(--color-text-muted);
  margin: 0;
}

.account-loading,
.account-error {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted);
}

.account-error {
  color: var(--color-danger, #c0392b);
}

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.account-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
}

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

.account-card h2 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
}

.account-card__desc {
  color: var(--color-text-muted);
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.account-profile-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.account-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.account-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.account-avatar-upload {
  cursor: pointer;
  margin: 0;
}

.account-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-primary, #1a5fb4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.account-avatar--has-img {
  background: var(--color-bg);
  padding: 0;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.account-nick {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.account-email {
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
}

.account-meta {
  margin: 0;
}

.account-meta__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.account-meta__row:last-child {
  border-bottom: none;
}

.account-meta__row dt {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.account-meta__row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.account-days {
  color: var(--color-pro, #7c3aed);
  font-weight: 700;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.account-blocked {
  color: var(--color-danger, #c0392b);
  margin: 0;
  font-size: 0.9375rem;
}

.account-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.25rem 0;
}

.account-subtitle {
  font-size: 1rem;
  margin: 1.25rem 0 0.75rem;
}

.account-list-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9375rem;
}

.account-list-item:last-child {
  border-bottom: none;
}

.account-list-item span {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  margin-left: 0.5rem;
}

.account-list-item p {
  margin: 0.35rem 0 0;
  color: var(--color-text);
}

.account-list-item__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.account-empty {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  margin: 0;
}

.account-messages {
  margin-top: 1rem;
}

.account-msg {
  padding: 0.75rem;
  background: var(--color-bg-alt, #f5f6f8);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.account-msg time {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.account-msg p {
  margin: 0.35rem 0 0;
}

.account-modal {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 2rem);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.account-modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.account-modal__inner {
  padding: 1.5rem;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.account-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.account-modal__body {
  margin-top: 0.5rem;
}

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

  .account-card--wide {
    grid-column: auto;
  }
}
