/* ============================================================
   Aidue — стили (тёмная + светлая зелёная темы)
   Темы переключаются через data-theme на <html>:
   - по умолчанию (или data-theme="dark") — тёмная
   - data-theme="light" — светлая на зелёном фоне #00A651
   ============================================================ */

:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
    --bg: #f0f6fc;
    --bg-elevated: rgba(255, 255, 255, 0.72);
    --bg-input: rgba(255, 255, 255, 0.7);
    --bg-sidebar: #f7fbff;
    --border: rgba(255, 255, 255, 0.9);
    --border-strong: #d3e1f1;
    --text-primary: #172d49;
    --text-secondary: #6f859e;
    --text-tertiary: #8a9bb0;
    --text-quaternary: #9cabbc;
    --hover: rgba(33, 118, 255, 0.08);
    --danger: #d64541;
    --success: #3c9f83;
    --accent: #2176ff;
    --accent-text: #ffffff;
    --ambient-1: rgba(185, 216, 250, 0.35);
    --ambient-2: rgba(255, 255, 255, 0.5);
    --noise-opacity: 0;
    --gradient-text-end: #2176ff;
    --topbar-h: 78px;
    --sidebar-w: 280px;
}

/* В светлой теме убираем агрессивный gradient на заголовках */
:root[data-theme="light"] .hero-greeting,
:root[data-theme="light"] .page-title,
:root[data-theme="light"] .error-title {
    background: linear-gradient(180deg, #0A0A0B 0%, rgba(10, 10, 11, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Topbar в светлой теме */
:root[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

/* Кнопка primary в светлой теме — чёрная */
:root[data-theme="light"] .topbar-btn.primary,
:root[data-theme="light"] .btn-primary {
    background: #0A0A0B;
    color: #FFFFFF;
    border-color: #0A0A0B;
}
:root[data-theme="light"] .topbar-btn.primary:hover,
:root[data-theme="light"] .btn-primary:hover {
    background: #1f1f23;
}

/* Send button (стрелка) в светлой — чёрная */
:root[data-theme="light"] .send-circle {
    background: #0A0A0B;
    color: #FFFFFF;
}
:root[data-theme="light"] .send-circle:hover {
    background: #1f1f23;
}

/* Theme toggle button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.2s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--hover);
    color: var(--text-primary);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }


* { box-sizing: border-box; margin: 0; padding: 0; }

/* iOS Safari: предотвращаем zoom при фокусе на инпуте.
   Safari масштабирует страницу, если font-size инпута < 16px.
   На десктопе оставляем дизайн-размеры, на тач-устройствах форсим 16px. */
@media (hover: none) and (pointer: coarse), (max-width: 768px) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

input, textarea, select, button {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Убираем стандартные iOS-эффекты на инпутах */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], textarea {
    -webkit-appearance: none;
    appearance: none;
}

/* Запрещаем zoom жестами на всём документе */
html {
    touch-action: pan-x pan-y;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

html, body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: Inter, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============ ТИПОГРАФИКА ============
   Борьба со словами-сиротами и неравномерным распределением строк.
   text-wrap: pretty — балансирует последние 4 строки и предотвращает orphans
   (поддерживается в Chrome 117+, Safari 17.5+, Firefox 121+).
   В старых браузерах просто игнорируется без вреда. */

p, li, blockquote, .hero-subtitle, .page-lead,
.suggestion-desc, .error-text, .footer-tagline,
.post-excerpt, .auth-foot, .form-group > div,
.attachment-name, .msg-body, .composer-attachment-name {
    text-wrap: pretty;
    hyphens: manual;
    -webkit-hyphens: manual;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Для заголовков — balance: равномерное распределение по строкам */
h1, h2, h3, h4,
.hero-greeting, .page-title, .error-title,
.post-title, .context-info h2,
.brand-name, .footer-brand-name, .topbar-brand-name {
    text-wrap: balance;
    hyphens: manual;
    -webkit-hyphens: manual;
}

/* Защита висячих знаков пунктуации (Safari, скоро Chrome) */
.hero-subtitle, .page-lead, .error-text, p {
    hanging-punctuation: first last;
}

html { scroll-behavior: smooth; }
body { min-height: 100vh; position: relative; }

/* Ambient effects */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, var(--ambient-1), transparent 60%),
        radial-gradient(ellipse 60% 80% at 50% 100%, var(--ambient-2), transparent 60%);
    pointer-events: none;
    z-index: 1;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
    opacity: var(--noise-opacity);
    mix-blend-mode: overlay;
}

button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ============ TOPBAR ============ */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 40;
    background: rgba(10, 10, 11, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.topbar-home { color: var(--text-primary); }

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}
.topbar-brand svg {
    width: 22px; height: 22px;
    color: var(--text-primary);
}
.topbar-brand-name {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.topbar-nav { display: flex; gap: 28px; }
.nav-link {
    font-size: 13px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: none;
    font-weight: 400;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-btn {
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.topbar-btn:hover { background: var(--hover); color: var(--text-primary); }
.topbar-btn.primary {
    background: var(--text-primary);
    color: var(--bg);
    border-color: var(--text-primary);
}
.topbar-btn.primary:hover { background: #fff; color: var(--bg); }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
    flex-shrink: 0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
}
.avatar:hover { border-color: rgba(255, 255, 255, 0.25); }
.avatar svg { width: 16px; height: 16px; }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-mark {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}
.sidebar-mark svg {
    width: 22px;
    height: 22px;
    animation: rotate 60s linear infinite;
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.sidebar-body { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }

.sidebar-section { margin-bottom: 20px; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    text-decoration: none;
}
.sidebar-item:hover { background: var(--hover); color: var(--text-primary); }
.sidebar-item.active { background: var(--hover); color: var(--text-primary); }
.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-tertiary); }
.sidebar-item:hover svg, .sidebar-item.active svg { color: var(--text-primary); }

.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px 12px; }

.sidebar-history-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-quaternary);
    padding: 4px 12px 8px;
}

.history-item {
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
}
.history-item:hover, .history-item.active { background: var(--hover); color: var(--text-secondary); }
.history-item.active { color: var(--text-primary); }

.history-empty {
    padding: 9px 12px;
    font-size: 12.5px;
    color: var(--text-quaternary);
    font-style: italic;
}

.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; flex-shrink: 0; }

.profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.profile-card:hover { background: var(--hover); }

.profile-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a4a52, #2a2a30);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}
.profile-avatar svg { width: 14px; height: 14px; }
.profile-info { flex: 1; min-width: 0; }
.profile-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

.invite-btn {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}
.invite-btn:hover { background: var(--hover); color: var(--text-primary); }
.invite-btn svg { width: 16px; height: 16px; }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ============ MOBILE MENU ============ */
.mobile-menu {
    position: fixed;
    top: 0; bottom: 0; right: 0;
    width: 86%;
    max-width: 340px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    z-index: 60;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mobile-menu.open { transform: translateX(0); }

.mobile-menu-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.mobile-menu-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-secondary);
}
.mobile-menu-body { flex: 1; overflow-y: auto; padding: 14px 12px; }

.mobile-profile {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.mobile-profile .profile-avatar { width: 44px; height: 44px; font-size: 16px; }
.mobile-profile .profile-avatar svg { width: 18px; height: 18px; }
.mobile-profile-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.mobile-profile-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ============ MAIN ============ */
.main {
    padding-top: var(--topbar-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-content { flex: 1; }

/* ============ HERO ============ */
.hero {
    min-height: calc(100vh - var(--topbar-h));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px 100px;
    position: relative;
    z-index: 2;
}

.hero-mark {
    margin-bottom: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hero-mark svg {
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    opacity: 0.95;
    animation: rotate 60s linear infinite;
}

.hero-greeting {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: clamp(44px, 7vw, 88px);
    line-height: 1;
    letter-spacing: -0.04em;
    text-align: center;
    margin-bottom: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0 8px;
}

.hero-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    margin-bottom: 48px;
    text-align: center;
    padding: 0 8px;
}

/* По умолчанию (десктоп) — принудительный br скрыт */
.mobile-only-br { display: none; }
@media (max-width: 640px) {
    .mobile-only-br { display: inline; }
}

.hero-input-wrap {
    width: 100%;
    max-width: 720px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 4px;
    transition: border-color 0.2s;
}
.hero-input-wrap:focus-within { border-color: rgba(255, 255, 255, 0.2); }
.hero-input-inner { padding: 18px 20px 8px; }

.hero-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    min-height: 28px;
    max-height: 200px;
}
.hero-textarea::placeholder { color: var(--text-tertiary); }

.hero-input-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px;
    gap: 8px;
    flex-wrap: nowrap;
}
.hero-input-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.send-circle { flex-shrink: 0; }

.pill-btn {
    height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: inherit;
}
.pill-btn:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--hover); }
.pill-btn svg { width: 14px; height: 14px; }

.send-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--text-primary);
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.send-circle:hover { transform: scale(1.05); }
.send-circle:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }
.send-circle svg { width: 16px; height: 16px; }

.hero-suggestions { width: 100%; max-width: 720px; margin-top: 28px; }

.suggestions-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-quaternary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.suggestions-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.suggestion {
    text-align: left;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-family: inherit;
    color: inherit;
}
.suggestion:hover {
    border-color: var(--border-strong);
    background: rgba(30, 30, 34, 0.6);
    transform: translateY(-1px);
}

.suggestion-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-quaternary);
    letter-spacing: 0.1em;
    padding-top: 2px;
    flex-shrink: 0;
}
.suggestion-content { flex: 1; min-width: 0; }
.suggestion-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 3px;
    display: block;
}
.suggestion-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.45;
    display: block;
}

/* ============ CHAT ============ */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: calc(100vh - var(--topbar-h));
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.rail {
    border-right: 1px solid var(--border);
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
}
.rail-section { margin-bottom: 32px; }
.rail-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-quaternary);
    margin-bottom: 14px;
}

.rail-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-quaternary);
    line-height: 1.5;
}
.rail-footer strong {
    color: var(--text-secondary);
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

.chat-body {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-h));
}

.chat-context {
    padding: 20px 36px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.context-info h2 {
    font-family: 'Manrope', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.context-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
}

.context-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
}
.context-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-primary);
    animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.messages {
    flex: 1;
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.msg { max-width: 720px; animation: msgFade 0.5s ease-out; }
@keyframes msgFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-quaternary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.msg.user { align-self: flex-end; }
.msg.user .msg-meta { justify-content: flex-end; }

.msg-body {
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--text-primary);
    word-wrap: break-word;
}
.msg.bot .msg-body { color: rgba(245, 245, 247, 0.92); }
.msg.bot .msg-body p + p { margin-top: 12px; }
.msg.bot .msg-body strong { color: var(--text-primary); font-weight: 600; }
.msg.bot .msg-body ul, .msg.bot .msg-body ol { padding-left: 22px; margin: 10px 0; }
.msg.bot .msg-body li { margin-bottom: 6px; }
.msg.bot .msg-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
}

.msg.user .msg-body {
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 18px 18px 4px 18px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 8px 0;
}
.typing-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typing 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

.composer-wrap {
    padding: 16px 36px 28px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, transparent, var(--bg) 30%);
}
.composer {
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 4px;
    transition: border-color 0.2s;
}
.composer:focus-within { border-color: rgba(255, 255, 255, 0.2); }
.composer-text { padding: 14px 18px 6px; }
.composer textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 160px;
}
.composer textarea::placeholder { color: var(--text-tertiary); }

.composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px 6px 8px;
    flex-wrap: nowrap;
    gap: 8px;
}
.composer-tools { display: flex; gap: 4px; flex: 1; min-width: 0; }

/* ============ ATTACHMENTS ============ */
.msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.msg.user .msg-attachments { justify-content: flex-end; }

.attachment {
    display: flex;
    align-items: center;
    border-radius: 12px;
    overflow: hidden;
    transition: opacity 0.15s, transform 0.15s;
    text-decoration: none;
    color: inherit;
}
.attachment:hover { opacity: 0.85; transform: translateY(-1px); }

.attachment-image {
    max-width: 240px;
    max-height: 240px;
    border: 1px solid var(--border);
    background: var(--bg-input);
}
.attachment-image img {
    width: 100%;
    height: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}

.attachment-file {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    max-width: 280px;
    gap: 12px;
}
.attachment-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: 8px;
    color: var(--text-secondary);
}
.attachment-icon svg { width: 16px; height: 16px; }
.attachment-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.attachment-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.attachment-size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Превью прикреплённых файлов в composer (до отправки) */
.composer-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 8px;
    margin-bottom: 8px;
}
.composer-attachments:empty { display: none; }

.composer-attachment {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 32px 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    font-size: 12.5px;
    color: var(--text-secondary);
    max-width: 240px;
}
.composer-attachment-thumb {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: var(--bg-elevated);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.composer-attachment-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.composer-attachment-thumb svg {
    width: 16px; height: 16px;
    color: var(--text-tertiary);
}
.composer-attachment-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.composer-attachment-remove {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: var(--border-strong);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}
.composer-attachment-remove:hover { background: var(--text-primary); color: var(--bg); }
.composer-attachment.uploading { opacity: 0.6; }
.composer-attachment.error {
    border-color: rgba(255, 122, 89, 0.4);
    color: var(--danger);
}

/* ============ FOOTER ============ */
.footer {
    position: relative;
    z-index: 2;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding: 56px 32px 32px;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }

.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid var(--border);
}
.footer-brand-block { max-width: 320px; }

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.footer-brand svg { width: 24px; height: 24px; color: var(--text-primary); }
.footer-brand-name {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.footer-tagline {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.55;
    margin-bottom: 24px;
}

.footer-newsletter-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-quaternary);
    margin-bottom: 10px;
}
.newsletter-form {
    display: flex;
    gap: 6px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    padding: 4px;
    background: var(--bg-input);
}
.newsletter-form input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    padding: 0 12px;
}
.newsletter-form input::placeholder { color: var(--text-tertiary); }
.newsletter-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: var(--text-primary);
    color: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.newsletter-btn:hover { transform: translateX(1px); }
.newsletter-btn svg { width: 14px; height: 14px; }

.footer-col-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-quaternary);
    margin-bottom: 18px;
}
.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.footer-links a {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--text-primary); }
.footer-links a.with-arrow { display: inline-flex; align-items: center; gap: 6px; }
.footer-links a.with-arrow::after {
    content: '↗';
    font-size: 10px;
    color: var(--text-quaternary);
    transition: color 0.15s;
}
.footer-links a.with-arrow:hover::after { color: var(--text-primary); }

.footer-bottom {
    padding-top: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.footer-bottom-left { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-copy {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-quaternary);
    letter-spacing: 0.04em;
}
.footer-legal-mini { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-legal-mini a {
    font-size: 11px;
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.15s;
}
.footer-legal-mini a:hover { color: var(--text-primary); }

.footer-socials { display: flex; gap: 8px; }
.social-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.social-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.social-btn svg { width: 14px; height: 14px; }

.footer-disclaimer {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-quaternary);
    line-height: 1.65;
    max-width: 900px;
}

/* ============ AUTH PAGES ============ */
.auth-page {
    min-height: calc(100vh - var(--topbar-h));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    position: relative;
    z-index: 2;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
}
.auth-card h1 {
    font-family: 'Manrope', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.auth-card .auth-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-quaternary);
    margin-bottom: 28px;
}
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.25);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }

.btn-primary {
    width: 100%;
    height: 44px;
    border-radius: 14px;
    border: none;
    background: var(--text-primary);
    color: var(--bg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
    width: 100%;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.btn-ghost:hover { background: var(--hover); color: var(--text-primary); }

.auth-foot {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-tertiary);
}
.auth-foot a { color: var(--text-primary); }
.auth-foot a:hover { opacity: 0.8; }

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid;
}
.alert.error { background: rgba(255, 122, 89, 0.08); border-color: rgba(255, 122, 89, 0.3); color: #ffb499; }
.alert.success { background: rgba(110, 231, 183, 0.08); border-color: rgba(110, 231, 183, 0.3); color: var(--success); }

/* ============ BLOG ============ */
.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 60px 24px 80px;
    position: relative;
    z-index: 2;
}
.page-head { margin-bottom: 44px; }
.page-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-quaternary);
    margin-bottom: 12px;
}
.page-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.page-lead {
    font-size: 15px;
    color: var(--text-tertiary);
    max-width: 640px;
    line-height: 1.6;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.post-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--bg-elevated);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.post-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.post-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-quaternary);
    margin-bottom: 14px;
    display: flex;
    gap: 14px;
}
.post-title {
    font-family: 'Manrope', sans-serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-bottom: 10px;
}
.post-excerpt {
    font-size: 13.5px;
    color: var(--text-tertiary);
    line-height: 1.55;
    flex: 1;
    margin-bottom: 16px;
}
.post-arrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-body {
    max-width: 720px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-secondary);
}
.article-body h2, .article-body h3 {
    color: var(--text-primary);
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-top: 36px;
    margin-bottom: 14px;
}
.article-body h2 { font-size: 26px; }
.article-body h3 { font-size: 20px; }
.article-body p { margin-bottom: 16px; }
.article-body ul, .article-body ol { padding-left: 24px; margin-bottom: 16px; }
.article-body li { margin-bottom: 8px; }
.article-body a { color: var(--text-primary); text-decoration: underline; }
/* Кнопки внутри article-body НЕ подчёркиваем */
.article-body a.cta-button,
.article-body a.tariff-card__button,
.article-body a.topbar-btn { text-decoration: none; }
.article-body blockquote {
    border-left: 2px solid var(--text-primary);
    padding: 4px 0 4px 18px;
    margin: 24px 0;
    color: var(--text-primary);
    font-style: italic;
}

/* ============ TARIFF CARDS ============ */
.tariffs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1100px;
    margin: 0 auto 64px;
    padding: 0 24px;
}
.tariff-card {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
}
.tariff-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.tariff-card--highlighted {
    border-color: var(--text-primary);
    background: var(--bg-elevated);
}
.tariff-card--highlighted:hover {
    border-color: var(--text-primary);
}
.tariff-card__badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg);
    padding: 4px 12px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.tariff-card__name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
}
.tariff-card__price {
    font-family: 'Manrope', sans-serif;
    font-size: 40px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}
.tariff-card__price-note {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}
.tariff-card__desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.tariff-card__features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tariff-card__features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.tariff-card__check {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-primary);
    margin-top: 2px;
}
.tariff-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 20px;
    border-radius: 22px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}
.tariff-card__button:hover {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}
.tariff-card__button svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}
.tariff-card__button:hover svg {
    transform: translateX(2px);
}
.tariff-card--highlighted .tariff-card__button {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}
.tariff-card--highlighted .tariff-card__button:hover {
    opacity: 0.9;
}

/* CTA-кнопка внизу страницы (для всех страниц с CTA) */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 24px;
    border-radius: 22px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.cta-button:hover {
    opacity: 0.9;
}

@media (max-width: 640px) {
    .tariffs-grid {
        gap: 12px;
        padding: 0 16px;
    }
    .tariff-card {
        padding: 28px 24px;
    }
    .tariff-card__price {
        font-size: 34px;
    }
}

/* ============ COMPARISON CARDS ============ */
.comparison-section {
    max-width: 1100px;
    margin: 0 auto 64px;
    padding: 0 24px;
}
.comparison-section__head {
    text-align: center;
    margin-bottom: 32px;
}
.comparison-section__title {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.2;
}
.comparison-section__subtitle {
    font-size: 15px;
    color: var(--text-tertiary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.comparison-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
    position: relative;
}
.comparison-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}
.comparison-card--highlighted {
    border-color: var(--text-primary);
}
.comparison-card--highlighted:hover {
    border-color: var(--text-primary);
}
.comparison-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.comparison-card__icon svg {
    width: 20px;
    height: 20px;
}
.comparison-card--highlighted .comparison-card__icon {
    background: var(--accent);
    color: var(--accent-text);
}
.comparison-card__name {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}
.comparison-card__subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
}
.comparison-card__price {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
.comparison-card__price-note {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 14px;
}
.comparison-card__desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
    .comparison-section { padding: 0 16px; }
    .comparison-grid { gap: 10px; }
    .comparison-card { padding: 20px 18px; }
}

/* ============ ACCOUNT / SESSIONS LIST ============ */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.session-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
    transition: all 0.15s;
    text-decoration: none;
    color: inherit;
    gap: 16px;
}
.session-row:hover {
    border-color: var(--border-strong);
    background: rgba(30, 30, 34, 0.6);
}
.session-row-info { flex: 1; min-width: 0; }
.session-row-title {
    font-size: 14.5px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-row-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-quaternary);
    display: flex;
    gap: 14px;
}
.session-row-arrow {
    color: var(--text-quaternary);
    flex-shrink: 0;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    color: var(--text-tertiary);
}

/* ============ ERROR PAGES (404, 403) ============ */
.error-page {
    min-height: calc(100vh - var(--topbar-h) - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    position: relative;
    z-index: 2;
}
.error-mark {
    width: 56px;
    height: 56px;
    margin-bottom: 32px;
    opacity: 0.4;
}
.error-mark svg {
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    animation: rotate 60s linear infinite;
}
.error-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-quaternary);
    margin-bottom: 18px;
}
.error-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: clamp(36px, 6vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    background: linear-gradient(180deg, #FFFFFF 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 720px;
}
.error-text {
    font-size: 15px;
    color: var(--text-tertiary);
    line-height: 1.65;
    max-width: 520px;
    margin-bottom: 32px;
}
.error-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1280px) {
    .footer-top { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
    .footer-col:nth-child(5) { display: none; }
}

@media (max-width: 1024px) {
    .chat-layout { grid-template-columns: 1fr; }
    .rail { display: none; }
    .topbar-nav { display: none; }
    .footer-top { grid-template-columns: 1fr 1fr 1fr; gap: 32px; }
    .footer-col:nth-child(4) { display: none; }
    .footer-brand-block {
        grid-column: 1 / -1;
        max-width: none;
        padding-bottom: 24px;
        border-bottom: 1px solid var(--border);
        margin-bottom: 8px;
    }
}

@media (max-width: 768px) {
    .topbar { padding: 0 16px; }
    .topbar-btn span.btn-text { display: none; }
    .topbar-btn { padding: 0 10px; }
    .footer { padding: 40px 20px 24px; }
    .footer-top { grid-template-columns: 1fr 1fr; gap: 28px; padding-bottom: 32px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
    .hero { padding: 80px 20px 100px; }
    .hero-greeting { font-size: 44px; margin-bottom: 14px; }
    .hero-subtitle { margin-bottom: 36px; }
    .suggestion-grid { grid-template-columns: 1fr; }
    .chat-context { padding: 20px; }
    .messages { padding: 24px 20px; gap: 24px; }
    .composer-wrap { padding: 14px 20px 20px; }
    .footer { padding: 36px 18px 24px; }
    .footer-top { grid-template-columns: 1fr; gap: 28px; }
}

@media (min-width: 1025px) { .mobile-only { display: none !important; } }
@media (max-width: 1024px) { .desktop-only { display: none !important; } }

/* ============ ADMIN ============ */
.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.admin-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
}
.admin-sidebar .admin-brand-name { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.admin-sidebar .admin-brand-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-quaternary);
}
.admin-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.15s;
}
.admin-nav a:hover { background: var(--hover); color: var(--text-primary); }
.admin-nav a.active { background: var(--hover); color: var(--text-primary); }

.admin-content {
    padding: 36px 40px;
    max-width: 1200px;
}
.admin-content h1 {
    font-family: 'Manrope', sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.admin-content .admin-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-quaternary);
    margin-bottom: 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 36px;
}
.stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-elevated);
}
.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-quaternary);
    margin-bottom: 10px;
}
.stat-value {
    font-family: 'Manrope', sans-serif;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}
.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.data-table th {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-quaternary);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--hover); }
.data-table .row-actions { display: flex; gap: 8px; }
.data-table a.row-link { color: var(--text-primary); }

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
}
.badge.admin { color: var(--text-primary); border-color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.badge.guest { color: var(--text-quaternary); }

.btn-sm {
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
}
.btn-sm:hover { background: var(--hover); color: var(--text-primary); }
.btn-sm.danger { color: var(--danger); border-color: rgba(255, 122, 89, 0.3); }
.btn-sm.danger:hover { background: rgba(255, 122, 89, 0.08); }

@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: relative; height: auto; }
    .admin-content { padding: 24px 20px; }
}
