﻿/* Local Inter fonts */
@font-face {
    font-family: 'Inter';
    src: url('/static/vendor/inter-reg.woff2') format('woff2');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('/static/vendor/inter.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* --- ЦВЕТОВЫЕ ПЕРЕМЕННЫЕ (С ДОБАВЛЕНИЕМ КРАСНОГО ЦВЕТА И ЦВЕТОВ КНОПОК) --- */
/* Cross-document View Transitions (Chrome 126+ и др.; игнорируется старыми браузерами) */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.32s;
        animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    }

    ::view-transition-old(privchat-main),
    ::view-transition-new(privchat-main) {
        animation-duration: 0.34s;
        animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    }
}

/* Language Switcher */
.lang-switcher {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 16px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.lang-switcher-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-switcher-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.lang-switcher-btn.active {
    background: linear-gradient(135deg, #0B3D91 0%, #105BD8 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(252, 61, 33, 0.4);
}

html[data-theme="light"] .lang-switcher {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .lang-switcher-btn {
    color: rgba(0, 0, 0, 0.6);
}

html[data-theme="light"] .lang-switcher-btn:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .lang-switcher-btn.active {
    color: #fff;
}

:root{
    --bg-1: #050A14;
    --bg-2: #1A0A2E;
    --panel: rgba(255,255,255,0.03);
    --muted: #9fb0c8;
    --text: #e6f0fb;
    /* Зелёный акцент: linear-gradient(145deg, #0B3D91 0%, #105BD8 52%, #FC3D21 100%) */
    --accent-from: #0B3D91;
    --accent-to: #105BD8;
    --accent-mid: #FC3D21;
    --bubble-other: rgba(255,255,255,0.03);
    --bubble-other-border: rgba(255,255,255,0.04);
    --shadow: rgba(2,6,23,0.7);
    --color-plus-bg: linear-gradient(90deg, #0B3D91, #0B3D91 30%, #105BD8 75%, #FC3D21);

    /* НОВЫЕ ЦВЕТА ДЛЯ КНОПОК И ВВОДА */
    --primary-color: var(--accent-from); /* Основной цвет (Синий) */
    --primary-color-hover: var(--accent-to);
    --red-color: #622d3d; /* Яркий красный для записи/опасностей */
    --red-color-hover: #c0392b;
    --btn-size: 44px; /* Фиксированный размер для круглых кнопок */
    --input-padding: 12px 16px;
    /* Размер шрифта интерфейса (управляется через localStorage) */
    --ui-font-size: 15px;
}

*{box-sizing: border-box}
html {
    color-scheme: dark;
}
html[data-theme="light"] {
    color-scheme: light;
}
@media (prefers-reduced-motion: no-preference) {
    html {
        transition: color-scheme 0.25s ease;
    }
    body {
        transition:
            background 0.38s cubic-bezier(0.4, 0, 0.2, 1),
            color 0.28s ease;
    }
}
html,body{
    margin:0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    font-size: var(--ui-font-size, 15px);
    background: radial-gradient(1000px 600px at 10% 10%, rgba(26, 10, 46,0.06), transparent),
                linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
    color:var(--text);
    -webkit-font-smoothing:antialiased;
    -moz-osx-font-smoothing:grayscale;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
}

/* Override background for dashboard page */
body.dashboard-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
}

/* layout container */
.container{
    max-width:1200px;
    margin:0 auto;
}






.toggle-pill-dark input[type="checkbox"] {
  display: none;
}
.toggle-pill-dark input[type="checkbox"] + label {
  display: block;
  position: relative;
  width: 3em;
  height: 1.6em;
  margin-bottom: 20px;
  border-radius: 1em;
  background: #303e58;
  box-shadow: inset 0px 0px 5px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-transition: background 0.1s ease-in-out;
  transition: background 0.1s ease-in-out;
}
.toggle-pill-dark input[type="checkbox"] + label:before {
  content: "";
  display: block;
  width: 1.2em;
  height: 1.2em;
  border-radius: 1em;
  background: #e84d4d;
  position: absolute;
  left: 0.2em;
  top: 0.2em;
  -webkit-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  -webkit-transform: rotate(90deg);
  transform: rotate(90deg);
}
.toggle-pill-dark input[type="checkbox"]:checked + label:before {
  background: #47cf73;
  box-shadow: -2px 0px 5px rgba(0, 0, 0, 0.2);
  left: 1.6em;
  -webkit-transform: rotate(295deg);
  transform: rotate(295deg);
}









code {
    color: var(--muted);
}

/* AUTH / GENERAL panels (оставлены как в оригинале) */
.auth-container{
    max-width:420px;
    margin:80px auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    padding:28px;
    border-radius:14px;
    box-shadow: 0 6px 30px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.03);
}

.auth-container h1{
    text-align:center;
    margin:0 0 22px 0;
    color:var(--text);
    font-weight:600;
    letter-spacing:0.2px;
}

/* --- СТИЛИ ДЛЯ КНОПКИ "ВЫЙТИ ИЗ ЧАТА" НА ДЭШБОРДЕ --- */
.chat-list li {
    /* Добавляем пространство между ссылкой и кнопкой */
    justify-content: space-between; 
}
.chat-list li .chat-name-container {
    /* Чтобы название и код чата оставались вместе */
    display: flex;
    align-items: baseline; 
    gap: 10px;
}

.chat-list li .leave-form {
    margin: 0;
    padding: 0;
    flex-shrink: 0; /* Не сжимать форму */
}

.btn-leave-chat {
    background-color: var(--red-color);
    color: white;
    border: none;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    -webkit-tap-highlight-color: transparent;
}

.btn-leave-chat:hover {
    background-color: var(--red-color-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.dashboard-page .btn-leave-chat-exit {
    background-color: rgba(20, 32, 53, 0.95);
    color: var(--muted);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.dashboard-page .btn-leave-chat-exit:hover {
    background-color: rgba(26, 40, 64, 0.98);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

html[data-theme="light"] .dashboard-page .btn-leave-chat-exit {
    background: rgba(248, 250, 252, 0.95);
    color: var(--muted);
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .dashboard-page .btn-leave-chat-exit:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--text);
}

.form-group{margin-bottom:16px}
.form-group label{
    display:block;
    margin-bottom:8px;
    color:var(--muted);
    font-weight:600;
    font-size:0.9rem;
}
.form-group input{
    width:100%;
    padding:12px 14px;
    border-radius:10px;
    border:1px solid rgba(255,255,255,0.03);
    background: rgba(255,255,255,0.02);
    color:var(--text);
    outline:none;
    transition:box-shadow .18s, border-color .18s;
}
.btn-primary2 {
    background: linear-gradient(135deg, var(--accent-from), #e74c3c);
    color: white;
    max-width: 300px;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    width: 70%;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.18);
    font-size: 15px;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
.form-group input:focus{
    box-shadow: 0 6px 20px rgba(252, 61, 33,0.12);
    border-color: rgba(252, 61, 33,0.6);
}

/* Buttons (оставлены как в оригинале) */
.btn-primary{
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color:white;
    border:none;
    padding:12px 16px;
    border-radius:10px;
    cursor:pointer;
    width:100%;
    font-weight:600;
    box-shadow: 0 8px 24px rgba(16, 91, 216,0.18);
    font-size: 15px;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
.btn-primary:hover{ transform: translateY(-1px); }

.auth-links { text-align:center; margin-top:14px; }
.auth-links a{ color:var(--muted); text-decoration:none; }

/* Dashboard blocks (оставлены как в оригинале) */
.dashboard-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:20px;
}
.btn-logout{
    background:rgba(252, 61, 33,0.12);
    color:#ff7b7b;
    padding:8px 14px;
    border-radius:10px;
    text-decoration:none;
    border:1px solid rgba(255,255,255,0.03);
}

.divider {
   border-top: 1px solid #0d1b2c;
 }

/* generic panel style (оставлены как в оригинале) */
.dashboard-content > div{
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    padding:18px;
    border-radius:12px;
    margin-bottom:18px;
    border:1px solid rgba(255,255,255,0.03);
    box-shadow: 0 8px 30px rgba(2,6,23,0.6);
}

/* chat layout: скролл только у ленты сообщений, шапка и ввод закреплены */
.chat-container{
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
    scrollbar-color: rgba(255, 255, 255, 0.15) var(--bg-2);
    scrollbar-width: none;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}
.chat-container::-webkit-scrollbar {
    display: none;
}

/* header (оставлены как в оригинале) */
.chat-header {
    z-index: 40;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.chat-header h1{
    margin:0;
    font-size:1.1rem;
    font-weight:600;
    color:var(--text);
    flex-grow: 1;         /* 1. Сказать заголовку занять всё свободное место */
    min-width: 0;         /* 2. Позволить ему сжиматься (тех. трюк для flex) */
    margin-right: 15px;   /* 3. Добавить отступ справа от кнопок */
    
    /* 4. Добавить троеточие, если текст длинный */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-header-buttons {
    display: flex;        /* Выстроить кнопки в ряд */
    align-items: center;  /* Выровнять их по центру */
    gap: 10px;            /* Пробел между кнопками */
    flex-shrink: 0;       /* ВАЖНО: Запретить этому блоку сжиматься */
    margin-top: 2px;
}
body.chat-page .chat-header .chat-header-main h1 {
    margin-right: 0;
}
.chat-header-main {
    min-width: 0;
    flex: 1 1 auto;
}
.chat-header-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}
.chat-info-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    margin: 8px auto 16px;
    max-width: fit-content;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
}
html[data-theme="light"] .chat-info-panel {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}
.chat-privacy-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
}
.chat-privacy-chip--hint {
    text-transform: none;
    letter-spacing: 0.01em;
    font-weight: 500;
    font-size: 0.75rem;
    border-style: dashed;
    opacity: 0.92;
}
.chat-privacy-chip--dm {
    border-color: rgba(16, 91, 216, 0.35);
    background: rgba(16, 91, 216, 0.1);
    color: #cfe9ff;
}
.chat-privacy-chip--private {
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(252, 61, 33, 0.12);
    color: #bfdbfe;
}
.chat-privacy-chip--public {
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}
.chat-privacy-chip--ai {
    border-color: rgba(168, 85, 247, 0.45);
    background: rgba(168, 85, 247, 0.12);
    color: #e9d5ff;
}
.chat-privacy-chip--ttl {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 600;
    font-size: 0.72rem;
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
    color: #fde68a;
}

.chat-realtime-bar {
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 16px;
    text-align: center;
    line-height: 1.35;
    background: rgba(234, 179, 8, 0.16);
    color: #fef3c7;
    border-bottom: 1px solid rgba(234, 179, 8, 0.22);
}
.chat-realtime-bar--hidden {
    display: none;
}
.chat-realtime-bar--error {
    background: rgba(239, 68, 68, 0.16);
    color: #fecaca;
    border-bottom-color: rgba(239, 68, 68, 0.28);
}
.chat-realtime-bar--reconnect {
    background: rgba(252, 61, 33, 0.14);
    color: #bfdbfe;
    border-bottom-color: rgba(252, 61, 33, 0.22);
}

.chat-messages-stage {
    flex: 1 1 0;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}
.chat-messages-stage .chat-messages {
    flex: 1 1 0;
    min-height: 0;
}

.chat-skeleton {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    box-sizing: border-box;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0));
    transition:
        opacity 0.32s ease,
        visibility 0.32s ease;
}
.chat-shell-ready .chat-skeleton {
    opacity: 0;
    visibility: hidden;
}
.chat-skeleton-row {
    height: 52px;
    border-radius: 16px;
    max-width: 78%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 0%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 100%
    );
    background-size: 200% 100%;
    animation: chatSkShimmer 1.1s ease-in-out infinite;
}
.chat-skeleton-row--me {
    align-self: flex-end;
    max-width: 62%;
    opacity: 0.85;
}
.chat-skeleton-row--short {
    max-width: 48%;
    height: 44px;
}
.chat-skeleton-row--me.chat-skeleton-row--short {
    max-width: 40%;
}
@media (prefers-reduced-motion: reduce) {
    .chat-skeleton-row {
        animation: none;
        background: rgba(255, 255, 255, 0.04);
    }
}
@keyframes chatSkShimmer {
    0% {
        background-position: 100% 0;
    }
    100% {
        background-position: -100% 0;
    }
}

html[data-theme="light"] .chat-privacy-chip {
    border-color: rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.75);
    color: var(--muted);
}
html[data-theme="light"] .chat-privacy-chip--dm {
    background: rgba(16, 91, 216, 0.12);
    color: #0B3D91;
    border-color: rgba(16, 91, 216, 0.25);
}
html[data-theme="light"] .chat-privacy-chip--private {
    background: rgba(16, 91, 216, 0.1);
    color: #0B3D91;
    border-color: rgba(16, 91, 216, 0.22);
}
html[data-theme="light"] .chat-privacy-chip--ttl {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.22);
}
html[data-theme="light"] .chat-skeleton {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.03), transparent);
}
html[data-theme="light"] .chat-skeleton-row {
    background: linear-gradient(
        90deg,
        rgba(15, 23, 42, 0.05) 0%,
        rgba(15, 23, 42, 0.09) 50%,
        rgba(15, 23, 42, 0.05) 100%
    );
    background-size: 200% 100%;
}
@media (prefers-reduced-motion: reduce) {
    html[data-theme="light"] .chat-skeleton-row {
        background: rgba(15, 23, 42, 0.06);
    }
}

/* messages area — единственная прокручиваемая колонка (basis 0 → корректный скролл во flex) */
.btn-back{
    background: rgba(255, 255, 255, 0.08);
    color:var(--muted);
    padding:8px 12px;
    border-radius:10px;
    text-decoration:none;
    border:1px solid rgba(255,255,255,0.12);
}

.chat-messages{
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 22px;
    padding-bottom: 28px;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.00));
}

/* scrollbar (оставлены как в оригинале) */
.chat-messages::-webkit-scrollbar{ width:10px; }
.chat-messages::-webkit-scrollbar-track{ background:transparent; }
.chat-messages::-webkit-scrollbar-thumb{
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-radius:10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* message row (оставлены как в оригинале) */
.message{
    display:flex;
    align-items:flex-end;
    gap:12px;
    margin-bottom:16px;
    max-width:85%;
    transition:transform .12s;
}
.message:hover{ transform: translateY(-2px); }

/* avatar (оставлены как в оригинале) */
img.avatar-small {
    padding: 2px;
    background: var(--color-plus-bg);
}
.avatar-small{
    width:38px;
    height:38px;
    border-radius:50%;
    object-fit:cover;
    box-shadow: 0 6px 18px rgb(255 255 255 / 60%);
    flex-shrink:0;
    filter: invert(100%);
}

/* message content (оставлены как в оригинале) */
.message-content{
    background: var(--bubble-other);
    border:1px solid var(--bubble-other-border);
    color:var(--text);
    padding:10px 12px;
    border-radius:16px;
    max-width:100%;
    box-shadow: 0 6px 20px rgba(2,6,23,0.45);
    display:inline-block;
    word-wrap:break-word;
}

/* meta row inside bubble (оставлены как в оригинале) */
.message-meta{
    display:flex;
    align-items:center;
    gap:8px;
    margin-bottom:6px;
}
.message-author{
    font-weight:600;
    font-size:0.85rem;
    color:var(--text);
}
.message-time{
    font-size:0.75rem;
    color:var(--muted);
}

/* message text (оставлены как в оригинале) */
.message-text{
    font-size:0.95rem;
    color:var(--text);
    line-height:1.35;
    white-space:pre-wrap;
}

.message-text-wrap { font-size:0.95rem; color:var(--text); line-height:1.35; }
.message-caption { white-space:pre-wrap; word-break:break-word; margin-top:6px; }
.message-att { margin-bottom: 6px; border-radius: 12px; overflow: hidden; max-width: 100%; }
.message-att-img {
    display: block;
    max-width: min(340px, 88vw);
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    vertical-align: bottom;
}
.message-att-file-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.92rem;
    max-width: 100%;
    word-break: break-all;
}
.message-att-file-link:hover { text-decoration: underline; opacity: 0.95; }
.message.me .message-caption { color: rgba(255,255,255,0.98); }
.message.me .message-att-file-link {
    background: rgba(255,255,255,0.22);
    color: #fff;
}

/* Аудиоплеер в сообщении (анонимный голос) */
.message-att-audio { margin-bottom: 4px; }
.message-att-audio-player {
    display: block;
    width: min(280px, 80vw);
    height: 36px;
    border-radius: 18px;
    outline: none;
}
.message.me .message-att-audio-player {
    filter: brightness(1.1);
}

/* Кастомный аудиоплеер */
.msg-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.07);
    width: min(220px, 75vw);
    margin-bottom: 4px;
    border: 1px solid rgba(255,255,255,0.08);
}
.message.me .msg-audio-player {
    background: rgba(0,0,0,0.18);
    border-color: rgba(255,255,255,0.15);
}
.msg-audio-play {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: transform 0.12s, filter 0.12s;
    box-shadow: 0 2px 8px rgba(46,125,50,0.35);
}
.msg-audio-play:hover { transform: scale(1.08); filter: brightness(1.1); }
.msg-audio-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.msg-audio-progress {
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.message.me .msg-audio-progress {
    background: rgba(255,255,255,0.25);
}
.msg-audio-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    transition: width 0.1s linear;
}
.msg-audio-time {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.message.me .msg-audio-time { color: rgba(255,255,255,0.7); }
.msg-audio-icon {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.6;
}
.message.me .msg-audio-icon { color: rgba(255,255,255,0.6); }

html[data-theme="light"] .msg-audio-player {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
}
html[data-theme="light"] .message.me .msg-audio-player {
    background: rgba(0,0,0,0.12);
}
html[data-theme="light"] .msg-audio-progress {
    background: rgba(0,0,0,0.12);
}
html[data-theme="light"] .msg-audio-time { color: #64748b; }
html[data-theme="light"] .message.me .msg-audio-time { color: rgba(255,255,255,0.8); }

/* ========= Landing Page ========= */
.landing-page .container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.landing-root {
    position: relative;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 40px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    overflow-x: hidden;
}

.landing-bg {
    position: fixed;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.18), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.14), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.10), transparent 46%);
    animation: landingBgShift 18s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes landingBgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(3%, 2%) rotate(2deg); }
}

.landing-noise {
    position: fixed;
    inset: 0;
    opacity: 0.035;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.landing-main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.landing-brand {
    text-align: center;
    margin-bottom: 24px;
}

.landing-logo-ring {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    display: grid;
    place-items: center;
    box-shadow: 0 12px 40px rgba(16, 91, 216, 0.35);
    animation: landingLogoPulse 3s ease-in-out infinite;
}

@keyframes landingLogoPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(16, 91, 216, 0.35); }
    50% { transform: scale(1.03); box-shadow: 0 16px 50px rgba(16, 91, 216, 0.45); }
}

.landing-logo-ring i {
    font-size: 32px;
    color: #fff;
}

.landing-title {
    margin: 0 0 8px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.landing-tagline {
    margin: 0;
    font-size: 1rem;
    color: rgba(226, 232, 240, 0.75);
    font-weight: 400;
}

.landing-card {
    width: 100%;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 28px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.landing-card-title {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-card-title i {
    color: var(--accent-from);
}

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

.landing-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.landing-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.landing-label i {
    color: var(--accent-from);
    font-size: 0.75rem;
}

.landing-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.landing-input::placeholder {
    color: rgba(148, 163, 184, 0.55);
}

.landing-input:focus {
    border-color: var(--accent-from);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.18);
}

.landing-captcha .captcha-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.landing-captcha > .landing-label {
    text-align: center;
    justify-content: center;
}

.captcha-img {
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.captcha-img:hover {
    transform: scale(1.02);
    border-color: var(--accent-from);
}

.landing-btn {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.landing-btn:active {
    transform: scale(0.98);
}

.landing-btn-primary {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.35);
}

.landing-btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 30px rgba(16, 91, 216, 0.45);
}

.landing-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: rgba(148, 163, 184, 0.6);
    font-size: 0.85rem;
}

.landing-divider::before,
.landing-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.landing-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.landing-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.landing-features {
    width: 100%;
}

.landing-section-title {
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 20px;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 91, 216, 0.25);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.feature-icon i {
    font-size: 18px;
    color: #fff;
}

.feature-card h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.feature-card p {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(226, 232, 240, 0.65);
    line-height: 1.5;
}

.landing-quick {
    width: 100%;
}

.quick-card {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.15), rgba(14, 165, 233, 0.1));
    border: 1px dashed rgba(16, 91, 216, 0.3);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.quick-card > i {
    font-size: 24px;
    color: var(--accent-from);
}

.quick-card > span {
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.85);
}

.quick-link {
    color: var(--accent-from);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

.quick-link:hover {
    color: #0B3D91;
}

.quick-link i {
    font-size: 0.75rem;
}

.landing-footer {
    width: 100%;
    text-align: center;
    margin-top: 8px;
}

.footer-links {
    margin-bottom: 16px;
}

.footer-links a {
    color: rgba(148, 163, 184, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

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

.footer-donate {
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.55);
}

.footer-donate code {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .landing-root {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

html[data-theme="light"] .landing-bg {
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.22), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.18), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.16), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.14), transparent 46%);
}

html[data-theme="light"] .landing-title {
    background: linear-gradient(90deg, #0f172a 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .landing-tagline {
    color: var(--muted);
}

html[data-theme="light"] .landing-card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .landing-card-title {
    color: #0f172a;
}

html[data-theme="light"] .landing-label {
    color: var(--muted);
}

html[data-theme="light"] .landing-input {
    background: #fff;
    border-color: var(--hairline);
    color: #0f172a;
}

html[data-theme="light"] .landing-input::placeholder {
    color: #94a3b8;
}

html[data-theme="light"] .landing-divider {
    color: var(--muted);
}

html[data-theme="light"] .landing-divider::before,
html[data-theme="light"] .landing-divider::after {
    background: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .landing-btn-secondary {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    border-color: var(--hairline);
}

html[data-theme="light"] .landing-section-title {
    color: #0f172a;
}

html[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .feature-card h3 {
    color: #0f172a;
}

html[data-theme="light"] .feature-card p {
    color: var(--muted);
}

html[data-theme="light"] .quick-card {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.08), rgba(14, 165, 233, 0.06));
    border-color: rgba(16, 91, 216, 0.2);
}

html[data-theme="light"] .quick-card > span {
    color: var(--muted);
}

html[data-theme="light"] .footer-links a {
    color: var(--muted);
}

html[data-theme="light"] .footer-donate code {
    background: rgba(15, 23, 42, 0.05);
    border-color: var(--hairline);
}

@media (min-width: 640px) {
    .landing-main {
        max-width: 520px;
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .landing-title {
        font-size: 2.4rem;
    }
    .landing-card {
        padding: 32px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-bg,
    .landing-logo-ring {
        animation: none !important;
    }
}

/* messages from current user (aligned right) (оставлены как в оригинале) */
.message.me{
    margin-left:auto;
    flex-direction:row-reverse;
}
.message.me .message-content{
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border: none;
    color: #fff;
    border-radius:18px 18px 4px 18px;
    box-shadow: 0 12px 34px rgba(16, 91, 216,0.18);
}
.message.me .message-time{ color: rgba(255,255,255,0.9); }

/* compact variant for system/notice messages (оставлены как в оригинале) */
.message.notice .message-content{
    background: transparent;
    border: 1px dashed rgba(255,255,255,0.04);
    color:var(--muted);
    border-radius:10px;
    padding:8px 10px;
    text-align:center;
}

/* ========================================================= */
/* --- ИСПРАВЛЕННЫЙ БЛОК: ЧАТ ВВОД И КНОПКИ (АДАПТИВ) --- */
/* ========================================================= */
.chat-input {
    flex-shrink: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.12); 
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    z-index: 40;
    position: relative;
}

/* Форма текстового ввода - должна занимать место */
.chat-input .text-input-form {
    display: flex;
    flex-grow: 1; /* Растягивает форму */
    gap: 10px;
    /* Убедимся, что форма не пытается занять место кнопки записи, когда она видна */
    flex-basis: auto; 
    min-width: 0;
}

/* Поле ввода текста (внутри формы) */
.chat-input input[type="text"], .chat-input textarea{
    flex-grow: 1; /* Поле ввода должно растягиваться */
    min-width: 50px;
    padding: var(--input-padding);
    border-radius:999px; /* Полностью скругленное */
    border:1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color:var(--text);
    outline:none;
    font-size:0.95rem;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    box-sizing: border-box;
}
.chat-input input::placeholder{ color: rgba(255,255,255,0.35); }


/* КНОПКИ: Отправки и Записи - ЕДИНЫЙ РАЗМЕР И ВИД */
.btn-send {
    border-radius: 50% 10% 50% 50%; }
.btn-record {
    border-radius: 50% 50% 10% 50%; }
.btn-send, .btn-record, .btn-attach {
    flex-shrink: 0; /* ВАЖНО: Не сжимать! */
    width: var(--btn-size);
    height: var(--btn-size);
    border: none;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.1s, background-color 0.2s;
}

.btn-attach {
    flex-shrink: 0;
    width: var(--btn-size);
    height: var(--btn-size);
    border-radius: 45% 50% 48% 12%;
    background: rgba(255,255,255,0.08);
    color: rgba(230,240,251,0.85);
    border: 1px solid rgba(255,255,255,0.12);
}
.btn-attach:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.12);
}

/* Кнопка отправки (самолетик) */
.btn-send {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    box-shadow: 0 6px 16px rgba(16, 91, 216,0.25);
}
.btn-send:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--accent-to), var(--accent-from));
}

/* Кнопка записи (микрофон) - КРАСНАЯ */
.btn-record {
    background-color: var(--red-color); /* Красный цвет */
    box-shadow: 0 6px 16px rgba(231, 76, 60, 0.25);
}
.btn-record:hover {
    background-color: var(--red-color-hover);
    transform: scale(1.05);
}

/* Контролы записи (появляются вместо текстового поля) */
.recording-controls {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    height: var(--btn-size);
    padding: 0 10px;
}
.recording-controls .timer {
    flex-grow: 1;
    color: var(--red-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 1rem;
}
.recording-controls .timer i {
    font-size: 1.1rem;
    animation: pulse 1s infinite alternate;
}

/* Кнопки "Отмена" и "Стоп" внутри контролов */
.recording-controls .btn-secondary,
.recording-controls .btn-danger {
    flex-shrink: 0;
    height: 36px; 
    border-radius: 999px;
    padding: 0 15px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}
/* Красная кнопка "Стоп" */
.recording-controls .btn-danger {
    background-color: var(--red-color);
    color: white;
}
.recording-controls .btn-danger:hover {
    background-color: var(--red-color-hover);
}

/* Серая кнопка "Отмена" */
.recording-controls .btn-secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}
.recording-controls .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
}




/* --- СТИЛИ ДЛЯ УДАЛЕНИЯ СООБЩЕНИЯ --- */
.message-meta {
    display: flex;
    align-items: center;
    gap: 8px; /* Расстояние между элементами метаданных */
}

/* Иконка урны */
.delete-message-btn {
    cursor: pointer;
    color: #e74c3c; /* Красный цвет */
    opacity: 0.5; /* Полупрозрачный по умолчанию */
    transition: opacity 0.2s ease, color 0.2s ease;
    font-size: 0.8em;
}

/* При наведении делаем урну более видимой */
.message:hover .delete-message-btn {
    opacity: 1;
}

.delete-message-btn:hover {
    color: #c0392b; /* Темнее при наведении */
}

/* --- СТИЛИ ДЛЯ СИСТЕМНЫХ УВЕДОМЛЕНИЙ --- */
.system-message {
    text-align: center;
    margin: 10px 0;
    width: 100%;
    /* Сбрасываем стандартное выравнивание, чтобы было по центру */
    justify-content: center;
}

.system-text {
    display: inline-block;
    background-color: rgba(0, 0, 0, 0.2); 
    color: #9fb0c8;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9em;
    max-width: 80%;
}

/* ========================================================= */
/* --- МОДАЛЬНОЕ ОКНО И ОБЩЕЕ --- */
/* ========================================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.72);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.22s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.is-open,
.modal-overlay.is-closing {
    display: flex;
}

.modal-overlay.is-open {
    opacity: 1;
}

.modal-overlay.is-closing {
    opacity: 0;
}

.modal-content {
    background: var(--bg-2);
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
    transform: scale(0.94);
    opacity: 0;
    transition:
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.24s ease;
}

.modal-overlay.is-open .modal-content {
    transform: scale(1);
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-content {
        transition-duration: 0.01ms !important;
    }
    .modal-content {
        transform: none !important;
        opacity: 1 !important;
    }
}

.modal-actions {
    display: flex;
    justify-content: space-around;
    gap: 15px;
}

/* Кнопки danger и secondary - общие стили для хедера и модалки */
.btn-danger {
    background-color: var(--red-color);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    flex-grow: 1;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}
.btn-danger:hover {
    background-color: var(--red-color-hover);
}
.btn-secondary {
    background-color: var(--muted);
    color: var(--bg-1);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    flex-grow: 1;
}
.btn-secondary:hover {
    background-color: #8998af;
}

/* Уведомления: верх страницы, не сдвигают потоковую вёрстку */
.flash-messages.flash-messages--toast {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    width: calc(100% - 28px);
    max-width: 560px;
    padding: calc(10px + env(safe-area-inset-top, 0px))
        env(safe-area-inset-right, 0px)
        0
        env(safe-area-inset-left, 0px);
    pointer-events: none;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flash-messages.flash-messages--toast .flash-message {
    pointer-events: auto;
    margin: 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.93rem;
    font-weight: 600;
    line-height: 1.38;
    text-align: center;
    box-shadow:
        0 14px 44px rgba(0, 0, 0, 0.3),
        0 6px 16px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    opacity: 0;
    transform: translateY(calc(-100% - 18px));
    transition:
        opacity 0.41s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.41s cubic-bezier(0.22, 1, 0.36, 1);
}

.flash-messages.flash-messages--toast .flash-message.flash-message--in {
    opacity: 1;
    transform: translateY(0);
}

.flash-messages.flash-messages--toast .flash-message.flash-message--out {
    opacity: 0;
    transform: translateY(calc(-100% - 18px));
    transition:
        opacity 0.32s cubic-bezier(0.4, 0, 1, 1),
        transform 0.34s cubic-bezier(0.4, 0, 1, 1);
}

@media (prefers-reduced-motion: reduce) {
    .flash-messages.flash-messages--toast .flash-message {
        transform: none;
        opacity: 0;
        transition: opacity 0.18s ease;
    }
    .flash-messages.flash-messages--toast .flash-message.flash-message--in {
        opacity: 1;
        transform: none;
    }
    .flash-messages.flash-messages--toast .flash-message.flash-message--out {
        opacity: 0;
        transform: none;
    }
}

.flash-message {
    padding: 10px 12px;
    background: rgba(252, 61, 33, 0.16);
    color: #cfe9ff;
    border-radius: 8px;
    border: 1px solid rgba(252, 61, 33, 0.2);
}

.flash-message.flash-success {
    background: rgba(16, 91, 216, 0.14);
    color: #cfe9ff;
    border-color: rgba(16, 91, 216, 0.35);
}

html[data-theme="light"] .flash-message.flash-success {
    background: rgba(16, 91, 216, 0.1);
    color: #0B3D91;
    border-color: rgba(16, 91, 216, 0.28);
}

/* small screens tweaks (оставлены как в оригинале) */
@media (max-width:700px){
    .auth-container{ margin:40px 12px; }
    .chat-header h1{ font-size:1rem; }
    .avatar-small{ width:34px; height:34px; }
    .chat-messages{ padding:16px; }
}

/* Базовые стили для Dashboard (оставлены как в оригинале) */
.input-field{
    padding:12px 14px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.03);
    background: rgba(255,255,255,0.02);
    color:var(--text);
    font-size:0.95rem;
    outline:none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 6px 18px rgba(2,6,23,0.45);
    transition:box-shadow .12s, border-color .12s, transform .08s;
    width:100%;
}
.dashboard-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px;
    box-sizing: border-box;
}

/* Дашборд: строки списков на всю ширину блока — без бокового padding контейнера */
.dashboard-page .dashboard-container.dash-dashboard-shell {
    padding-left: 0;
    padding-right: 0;
    padding-top: 10px;
    padding-bottom: 16px;
}

.dashboard-page .dashboard-header {
    margin-bottom: 6px;
    padding: 4px 20px;
    box-sizing: border-box;
}

.dashboard-page .chat-forms-container.dash-forms-desktop-only,
.dashboard-page .dash-divider,
.dashboard-page .dash-dashboard-footer {
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}
.dashboard-page .dashboard-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Линия под шапкой и блок списков: плотнее, симметричнее к верхнему отступу контейнера */
.dashboard-page .dash-divider {
    margin: 8px 0 10px;
    border: none;
    border-top: 1px solid #040b18;
}
.dashboard-page .chat-lists-container.dash-chat-lists {
    margin-top: 0;
    gap: 16px;
    padding-left: 20px;
    padding-right: 20px;
    box-sizing: border-box;
}
.dashboard-page .chat-list-wrapper > h2 {
    margin: 0 0 12px;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.8);
}
.dashboard-page .chat-list li:not(.empty-list) {
    margin-bottom: 10px;
}
.dashboard-page .dash-dashboard-footer {
    margin-top: 10px;
    padding-bottom: 4px;
    text-align: center;
}
.dashboard-page .dash-footer-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.dashboard-page .dash-footer-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.18s ease;
}
.dashboard-page .dash-footer-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.12s ease, opacity 0.12s ease;
}
.dashboard-page .dash-footer-donate {
    margin: 10px 0 0;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .dashboard-page .dash-dashboard-footer {
        margin-bottom: 10px;
    }
    .dashboard-page .dash-footer-donate {
        margin-top: 12px;
        margin-bottom: 18px;
    }
}

.dashboard-page .dash-footer-donate code {
    word-break: break-all;
}

/* Кнопка «Скачать Android APK» (сайт + дашборд) */
.site-android-apk-wrap {
    display: flex;
    justify-content: center;
    margin: 16px auto 14px;
    padding: 0 16px;
    box-sizing: border-box;
}
.dashboard-page .site-android-apk-wrap {
    margin: 14px auto 14px;
    padding-left: 0;
    padding-right: 0;
}
.site-android-apk-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-radius: 999px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.96rem;
    color: #fff;
    background: linear-gradient(145deg, #105bd8 0%, #0b3d91 45%, #d902de 100%);
    box-shadow:
        0 4px 0 rgba(13, 59, 16, 0.55),
        0 8px 24px rgba(9, 59, 134, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition:
        transform 0.14s ease,
        box-shadow 0.14s ease,
        filter 0.14s ease;
    max-width: 100%;
}
.site-android-apk-btn:hover {
    color: #fff;
    filter: brightness(1.06);
    box-shadow:
        0 3px 0 rgba(13, 59, 16, 0.5),
        0 10px 28px rgba(9, 59, 134, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
@media (prefers-reduced-motion: no-preference) {
    .site-android-apk-btn:hover {
        transform: translateY(-1px);
    }
}
.site-android-apk-btn:active {
    transform: translateY(2px);
    box-shadow:
        0 2px 0 rgba(13, 59, 16, 0.45),
        0 4px 14px rgba(9, 59, 134, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
@media (prefers-reduced-motion: reduce) {
    .site-android-apk-btn:active {
        transform: none;
    }
}
.site-android-apk-btn i {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}
.site-android-apk-btn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.22;
}
.site-android-apk-btn-title {
    letter-spacing: 0.02em;
}
.site-android-apk-btn-sub {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.88;
}

html[data-theme="light"] .site-android-apk-btn {
    color: #fff;
    background: linear-gradient(145deg, #0b3d91 0%, #105bd8 52%, #fc3d21 100%);
    box-shadow:
        0 4px 0 rgba(9, 59, 134, 0.35),
        0 8px 26px rgba(16, 91, 216, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
html[data-theme="light"] .site-android-apk-btn:hover {
    color: #fff;
}

@media (prefers-reduced-motion: no-preference) {
    /* Только opacity: transform на предке ломает position:fixed у нижнего дока */
    .dashboard-page.dash-loaded .dash-dashboard-shell {
        animation: dashPageEnter 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    @keyframes dashPageEnter {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
    .dashboard-page .chat-list > li:not(.empty-list) {
        animation: dashChatRowEnter 0.32s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(1) { animation-delay: 0.03s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(2) { animation-delay: 0.06s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(3) { animation-delay: 0.09s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(4) { animation-delay: 0.12s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(5) { animation-delay: 0.15s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(6) { animation-delay: 0.18s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(7) { animation-delay: 0.21s; }
    .dashboard-page .chat-list > li:not(.empty-list):nth-child(8) { animation-delay: 0.24s; }
    @keyframes dashChatRowEnter {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

.dashboard-page .chat-list li a.chat-link {
    display: inline-block;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: transform 0.12s ease, opacity 0.12s ease;
}
@media (prefers-reduced-motion: no-preference) {
    .dashboard-page .chat-list li a.chat-link:active {
        transform: scale(0.97);
        opacity: 0.92;
    }
    .dashboard-page .dash-footer-primary:active,
    .dashboard-page .dash-footer-secondary:active {
        transform: scale(0.98);
        opacity: 0.92;
    }
    .dashboard-page .dash-nav-item:active {
        transform: scale(0.96);
    }
}
.dashboard-page .chat-list.public-chats li .btn-join {
    transition: transform 0.12s ease, background-color 0.2s ease;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
}
@media (prefers-reduced-motion: no-preference) {
    .dashboard-page .chat-list.public-chats li .btn-join:active {
        transform: scale(0.96);
    }
}

.dashboard-page .chat-list li {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.dashboard-page .chat-list li:hover {
    transform: translateY(-2px) !important;
    border-color: rgba(16, 91, 216, 0.25) !important;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3) !important;
}
.dashboard-page .chat-list li a.chat-link {
    color: var(--text);
}
.dashboard-page .chat-list.public-chats li .chat-name {
    color: var(--text);
}
.dashboard-page .chat-list li.empty-list {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.08), rgba(14, 165, 233, 0.06)) !important;
    color: var(--muted);
    border: 1px dashed rgba(16, 91, 216, 0.2) !important;
}

html[data-theme="light"] .dashboard-page .chat-list li {
    background: rgb(255 255 255 / 58%);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.09);
}
html[data-theme="light"] .dashboard-page .chat-list li:hover {
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.11);
}
html[data-theme="light"] .dashboard-page .chat-list li.empty-list {
    background: rgba(248, 250, 252, 0.92);
    color: var(--muted);
    border: 1px dashed rgba(15, 23, 42, 0.14);
}

/* Dashboard Landing-style Background */
body.dashboard-page {
    position: relative;
    min-height: 100vh;
    background: linear-gradient(135deg, #000000 0%, #1e002e 100%) !important;
    overflow-x: hidden;
}

body.dashboard-page::before {
    content: '';
    position: fixed;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.18), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.14), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.10), transparent 46%);
    animation: dashboardBgShift 18s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

body.dashboard-page::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.035;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes dashboardBgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(3%, 2%) rotate(2deg); }
}

body.dashboard-page .dashboard-container {
    position: relative;
    z-index: 2;
}

html[data-theme="light"] body.dashboard-page {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
}

html[data-theme="light"] body.dashboard-page::before {
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.22), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.18), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.16), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.14), transparent 46%);
}

/* Горизонтальная форма на больших экранах (оставлены как в оригинале) */
.form-inline{ display:flex; gap:10px; align-items:center; }
.form-inline .input-field{ flex:1; }
.form-inline .btn-primary{ flex:0 0 auto; }

/* Адаптив: на узких экранах возвращаем колоночную форму (оставлены как в оригинале) */
@media (max-width: 820px) {
    .dashboard-container {
        padding: 20px;
    }
    .dashboard-page .dashboard-container.dash-dashboard-shell {
        padding-left: 0;
        padding-right: 0;
        padding-top: 8px;
        padding-bottom: 14px;
    }
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    .checkbox-label { min-width: auto; max-width: none; order: 0; margin-bottom: 6px; }
    .form-inline .btn-primary { width: 100%; min-width: auto; }
}
@media (min-width: 820px) {
.chat-container{
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}
}

/* --- Светлая тема (современный стиль) --- */
html[data-theme="light"] {
    --bg-1: #f8fafc;
    --bg-2: #f1f5f9;
    --panel: rgba(255, 255, 255, 0.94);
    --muted: #64748b;
    --text: #0f172a;
    /* Зелёный акцент для светлой темы */
    --accent-from: #105BD8;
    --accent-to: #0B3D91;
    --accent-mid: #0B3D91;
    --bubble-other: #ffffff;
    --bubble-other-border: rgba(15, 23, 42, 0.09);
    --shadow: rgba(15, 23, 42, 0.07);
    --hairline: rgba(15, 23, 42, 0.09);
    --surface-glass: rgba(255, 255, 255, 0.78);
}

html[data-theme="light"] body {
    background:
        radial-gradient(1200px 800px at 88% -8%, rgba(16, 91, 216, 0.09), transparent 52%),
        radial-gradient(800px 500px at -5% 40%, rgba(14, 165, 233, 0.07), transparent 48%),
        linear-gradient(168deg, #f8fafc 0%, #f1f5f9 42%, #e8eef7 100%);
    color: var(--text);
}

html[data-theme="light"] .flash-message {
    background: rgba(16, 91, 216, 0.09);
    color: #1e3a8a;
    border: 1px solid rgba(16, 91, 216, 0.18);
}

html[data-theme="light"] .flash-message.flash-error {
    background: rgba(239, 68, 68, 0.09);
    color: #991b1b;
    border-color: rgba(239, 68, 68, 0.22);
}

html[data-theme="dark"] .flash-message.flash-error {
    border-color: rgba(231, 76, 60, 0.35);
    background: rgba(231, 76, 60, 0.14);
    color: #fecaca;
}

html[data-theme="light"] .input-field {
    background: #ffffff;
    color: var(--text);
    border-color: var(--hairline);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .input-field:focus {
    border-color: rgba(16, 91, 216, 0.42);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.14);
}

html[data-theme="light"] .form-group input {
    background: #ffffff;
    color: var(--text);
    border-color: var(--hairline);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .form-group input:focus {
    border-color: rgba(16, 91, 216, 0.45);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.12);
}

html[data-theme="light"] .auth-container {
    background: var(--surface-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--hairline);
    box-shadow:
        0 4px 24px rgba(15, 23, 42, 0.06),
        0 1px 3px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .chat-form-wrapper {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--hairline);
    box-shadow:
        0 4px 22px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-theme="light"] .chat-form-wrapper h2 {
    border-bottom-color: var(--hairline);
}

html[data-theme="light"] .chat-list li {
    background: #ffffff;
    border: 1px solid var(--hairline);
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .chat-list li a.chat-link {
    color: var(--text);
}

html[data-theme="light"] .chat-list li.empty-list {
    background: #f8fafc;
    color: var(--muted);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

html[data-theme="light"] .divider,
html[data-theme="light"] .dash-divider {
    border-top-color: var(--hairline);
}

html[data-theme="light"] .btn-logout {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.14);
}

html[data-theme="light"] .btn-logout:hover {
    background: rgba(239, 68, 68, 0.12);
}

html[data-theme="light"] .dashboard-content > div {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--hairline);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

html[data-theme="light"] .chat-container {
    scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
    border-left-color: var(--hairline);
    border-right-color: var(--hairline);
}

html[data-theme="light"] .chat-header {
    background: rgba(255, 255, 255, 0.86) !important;
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--hairline);
}

html[data-theme="light"] .chat-header h1 {
    color: #0f172a;
}

html[data-theme="light"] .chat-messages {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.65) 0%, rgba(241, 245, 249, 0.35) 100%);
}

html[data-theme="light"] .avatar-small {
    filter: none !important;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] img.avatar-small {
    filter: none !important;
}

html[data-theme="light"] .message-content {
    box-shadow: 0 2px 14px rgba(15, 23, 42, 0.06);
}

html[data-theme="light"] .message.me .message-content {
    box-shadow: 0 10px 28px rgba(16, 91, 216, 0.22);
}

html[data-theme="light"] .chat-input {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--hairline);
}

html[data-theme="light"] .chat-input input[type="text"],
html[data-theme="light"] .chat-input textarea {
    background: #f8fafc;
    border: 1px solid var(--hairline);
    color: var(--text);
}

html[data-theme="light"] .chat-input input::placeholder {
    color: rgba(15, 23, 42, 0.38);
}

html[data-theme="light"] .btn-attach {
    background: #f1f5f9;
    color: var(--text);
    border: 1px solid var(--hairline);
}
html[data-theme="light"] .btn-attach:hover {
    background: #e2e8f0;
}
html[data-theme="light"] .message-text-wrap { color: var(--text); }

html[data-theme="light"] .recording-controls {
    background: #f1f5f9;
    border: 1px solid var(--hairline);
}

html[data-theme="light"] .recording-controls .btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

html[data-theme="light"] .recording-controls .btn-secondary:hover {
    background: #cbd5e1;
}

html[data-theme="light"] .btn-back {
    background: #ffffff;
    color: var(--muted);
    border: 1px solid var(--hairline);
}

html[data-theme="light"] .btn-back:hover {
    background: #f8fafc;
}

html[data-theme="light"] .modal-overlay {
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(6px);
}

html[data-theme="light"] .modal-content {
    background: #ffffff;
    border: 1px solid var(--hairline);
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .system-text {
    background: rgba(15, 23, 42, 0.06);
    color: var(--muted);
}

html[data-theme="light"] code {
    color: #475569;
}

html[data-theme="light"] .toggle-switch .slider {
    background-color: #cbd5e1;
}

html[data-theme="light"] .toggle-switch input:checked + .slider {
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
}

html[data-theme="light"] .btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

html[data-theme="light"] .btn-secondary:hover {
    background: #cbd5e1;
}

html[data-theme="light"] .chat-list.public-chats li .btn-join {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
}

html[data-theme="light"] .chat-list.public-chats li .btn-join:hover {
    filter: brightness(1.03);
}

html[data-theme="light"] .btn-primary {
    box-shadow: 0 10px 28px rgba(16, 91, 216, 0.22);
}

html[data-theme="light"] .btn-primary:hover {
    box-shadow: 0 12px 32px rgba(16, 91, 216, 0.28);
}

html[data-theme="light"] .delete-message-btn {
    color: #dc2626;
}

html[data-theme="light"] .chat-header .btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

html[data-theme="light"] .chat-header .btn-danger:hover {
    background: rgba(239, 68, 68, 0.16);
}

html[data-theme="light"] .message.notice .message-content {
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--muted);
}

/* --- Dashboard: шапка и mobile dock --- */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.dashboard-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.dash-btn-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.15s, transform 0.1s;
}
.dash-btn-icon:active {
    transform: scale(0.96);
}
[data-theme="light"] .dash-btn-icon {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.1);
}

.dash-dashboard-shell {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    view-transition-name: privchat-main;
}

.chat-page .chat-container.chat-vt-shell {
    view-transition-name: privchat-main;
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Высота ровно видимая область: иначе flex-родитель растягивается по контенту сообщений */
html:has(body.chat-page) {
    height: 100%;
}

body.chat-page {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

body.chat-page .container {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}

/* Mobile chat backgrounds */
@media (max-width: 819px) {
    body.chat-page {
        background: linear-gradient(135deg, rgba(15, 23, 42, 0.75) 0%, rgb(30 41 59 / 13%) 100%), url(/static/avatars/black.jpg) center / cover no-repeat fixed;
    }
    html[data-theme="light"] body.chat-page {
        background: linear-gradient(135deg, rgb(241 245 249 / 0%) 0%, rgb(226 232 240 / 0%) 100%), url(/static/avatars/white.jpg) center / cover no-repeat fixed;
    }
}

.voice-preview-panel {
    background: rgba(13, 26, 44, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px 14px;
    position: absolute;
    bottom: 16px;
    left: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

html[data-theme="light"] .voice-preview-panel {
    background: rgba(255,255,255,0.96);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
}

.voice-preview-panel audio {
    width: 100%;
    height: 40px;
    border-radius: 8px;
}

/* Подсказка между плеером и кнопками */
.voice-preview-hint {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}
.voice-preview-hint span { display: flex; align-items: center; gap: 6px; }
.voice-preview-hint i { width: 14px; text-align: center; }
.voice-preview-hint b { color: var(--text); font-weight: 600; }
html[data-theme="light"] .voice-preview-hint {
    background: rgba(0,0,0,0.04);
}

/* Кнопка отмены — только иконка */
.voice-preview-actions .btn-secondary {
    flex: 0 0 auto;
    width: 40px;
    padding: 10px 0;
}

.voice-preview-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 5px
}

.voice-preview-actions button {
    flex: 1;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, opacity 0.12s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.voice-preview-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-preview-actions .btn-secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.12);
}

html[data-theme="light"] .voice-preview-actions .btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.voice-preview-actions .btn-primary {
    background: linear-gradient(145deg, #105bd8 0%, #0b3d91 45%, #FC3D21 100%);
    color: #fff;
}

.voice-preview-actions .btn-danger {
    background: linear-gradient(145deg, #b71c1c 0%, #7f1d1d 45%, #c62828 100%);
    color: #fff;
}

.voice-preview-actions .btn-robot {
    background: linear-gradient(145deg, #1565c0 0%, #0d47a1 45%, #1976d2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: filter 0.15s, transform 0.12s;
}

.voice-preview-actions .btn-robot:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

html[data-theme="light"] .voice-preview-actions .btn-robot {
    background: linear-gradient(145deg, #1976d2 0%, #1565c0 45%, #42a5f5 100%);
}

.voice-preview-status {
    text-align: center;
    font-size: 13px;
    color: var(--muted-color);
}

@media (prefers-reduced-motion: no-preference) {
    .chat-page.chat-loaded .chat-container.chat-vt-shell {
        animation: chatPageEnter 0.36s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
    @keyframes chatPageEnter {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }

    .chat-page .btn-send:active,
    .chat-page .btn-record:active,
    .chat-page .btn-back:active {
        transform: scale(0.96);
    }
}

.chat-page .btn-send,
.chat-page .btn-record,
.chat-page .btn-back {
    transition: transform 0.12s ease, opacity 0.12s ease;
}

@media (max-width: 768px) {
    .dashboard-page .dash-forms-desktop-only {
        display: none !important;
    }
    .dashboard-page .dashboard-container.dash-dashboard-shell {
        padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px));
    }
    .dashboard-page .dash-open-settings-desktop {
        display: none !important;
    }
}

.dashboard-page .dash-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .dashboard-page .dash-bottom-nav {
        display: flex;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 50;
        justify-content: space-around;
        align-items: center;
        padding: 10px 8px;
        gap: 4px;
        background: rgba(17, 24, 39, 0.88);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-radius: 22px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    }
    html[data-theme="light"] .dashboard-page .dash-bottom-nav {
        background: rgb(255 255 255 / 81%);
        border-color: rgba(15, 23, 42, 0.1);
        box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
    }
    .dashboard-page .dash-nav-item {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 6px 4px;
        border: none;
        background: transparent;
        color: #e2e8f0;
        font-size: 0.68rem;
        font-weight: 600;
        cursor: pointer;
        border-radius: 14px;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
    }
    [data-theme="light"] .dashboard-page .dash-nav-item {
        color: #334155;
    }
    .dashboard-page .dash-nav-item i {
        font-size: 1.35rem;
        opacity: 0.95;
    }
    .dashboard-page .dash-nav-item:active {
        background: rgba(255, 255, 255, 0.08);
    }
    [data-theme="light"] .dashboard-page .dash-nav-item:active {
        background: rgba(15, 23, 42, 0.06);
    }
}

/* Модальные окна (мобильные; на десктопе те же для «Шестерёнки») */
.dash-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}
.dash-modal.dash-modal-visible {
    display: flex;
}
.dash-modal-sheet {
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow: auto;
    background: linear-gradient(180deg, #1e293b 0%, #0f2a23 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 22px 22px 0 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: dashSheetUp 0.22s ease-out;
}
[data-theme="light"] .dash-modal-sheet {
    background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
    border-color: rgba(15, 23, 42, 0.08);
}
@keyframes dashSheetUp {
    from {
        transform: translateY(100%);
        opacity: 0.6;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes dashSheetDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(105%);
        opacity: 0.55;
    }
}

.dash-modal-sheet.dash-modal-sheet-closing {
    animation: dashSheetDown 0.26s cubic-bezier(0.4, 0, 1, 1) forwards !important;
}

.dash-modal.dash-modal-closing {
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .dash-modal-sheet.dash-modal-sheet-closing {
        animation: none !important;
        opacity: 0;
        transform: translateY(100%);
    }
}
.dash-modal-sheet-wide {
    max-width: 640px;
}
.dash-modal-handle {
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    margin: 10px auto 6px;
}
[data-theme="light"] .dash-modal-handle {
    background: rgba(15, 23, 42, 0.15);
}
.dash-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .dash-modal-head {
    border-bottom-color: rgba(15, 23, 42, 0.12);
}
.dash-modal-head h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}
.dash-modal-close {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}
.dash-modal-body {
    padding: 16px 18px 22px;
}
.dash-modal-confirm-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
.dash-modal-profile-grid {
    display: grid;
    gap: 16px;
}
@media (min-width: 560px) {
    .dash-modal-profile-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}
.dash-profile-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
[data-theme="light"] .dash-profile-card {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.08);
}
.dash-profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin-bottom: 12px;
    border: 2px solid rgba(252, 61, 33, 0.35);
}

.dash-profile-card-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.dash-profile-card-avatar .dash-profile-avatar-caption {
    width: 100%;
    margin-bottom: 10px;
}
.dash-profile-card-avatar .dash-profile-avatar-preview {
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 14px;
}
.dash-profile-card-avatar .dash-profile-avatar-form {
    width: 100%;
    max-width: 300px;
    margin-top: 2px;
}
.dash-profile-card-avatar .dash-profile-avatar-form .form-group label {
    text-align: center;
}

.dash-muted {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0 0 8px;
}
.dash-help {
    margin-top: 6px !important;
}

/* Переключатель темы (сегмент, по центру) */
.dash-theme-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

/* только здесь: иначе .form-group label даёт лишний margin-bottom и «давит» блок вниз */
.form-group.dash-theme-field label.dash-theme-opt {
    margin-bottom: 0;
    display: inline-flex;
    align-items: stretch;
    font-weight: inherit;
    font-size: inherit;
}
.dash-theme-field-label {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-transform: uppercase;
}
.dash-theme-segment {
    display: inline-flex;
    align-items: stretch;
    padding: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    gap: 6px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.18);
}
html[data-theme="light"] .dash-theme-segment {
    background: rgba(15, 23, 42, 0.06);
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.dash-theme-opt {
    cursor: pointer;
    margin: 0;
    position: relative;
}
.dash-theme-opt input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}
.dash-theme-opt-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 22px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--muted);
    transition:
        background 0.22s ease,
        color 0.22s ease,
        box-shadow 0.22s ease,
        transform 0.15s ease;
    white-space: nowrap;
}
.dash-theme-opt-inner i {
    font-size: 1rem;
    opacity: 0.88;
}
.dash-theme-opt:hover .dash-theme-opt-inner {
    color: var(--text);
}
.dash-theme-opt input:checked + .dash-theme-opt-inner {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    box-shadow: 0 6px 20px rgba(252, 61, 33, 0.38);
}
html[data-theme="light"] .dash-theme-opt input:checked + .dash-theme-opt-inner {
    box-shadow: 0 8px 22px rgba(16, 91, 216, 0.35);
}
.dash-theme-opt input:focus-visible + .dash-theme-opt-inner {
    outline: 2px solid var(--accent-from);
    outline-offset: 3px;
}
.dash-theme-opt:active .dash-theme-opt-inner {
    transform: scale(0.98);
}

@media (min-width: 769px) {
    .dash-modal {
        align-items: center;
        padding: 20px;
    }
    .dash-modal-sheet {
        border-radius: 22px;
        border: 1px solid rgba(255, 255, 255, 0.06);
        max-height: 90vh;
    }
}

body.dash-shell-modal-open {
    overflow: hidden;
}

/* ========= PIN-экран разблокировки ========= */
.pin-unlock-page .container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.pin-unlock-root {
    position: relative;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(28px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
    overflow: hidden;
}

.pin-unlock-bg {
    position: absolute;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 20% 25%, rgba(16, 91, 216, 0.45), transparent 52%),
        radial-gradient(ellipse 70% 50% at 85% 15%, rgba(252, 61, 33, 0.5), transparent 48%),
        radial-gradient(ellipse 60% 45% at 50% 95%, rgba(14, 165, 233, 0.35), transparent 45%),
        linear-gradient(165deg, #050a14 0%, #0c1628 38%, #071018 100%);
    animation: pinUnlockBgShift 14s ease-in-out infinite alternate;
}

@keyframes pinUnlockBgShift {
    0% {
        transform: translate(-2%, -1%) rotate(0deg) scale(1);
    }
    100% {
        transform: translate(3%, 2%) rotate(-4deg) scale(1.06);
    }
}

.pin-unlock-noise {
    position: absolute;
    inset: 0;
    opacity: 0.045;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.pin-unlock-main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 400px;
}

.pin-unlock-card {
    background: linear-gradient(
        155deg,
        rgba(255, 255, 255, 0.09) 0%,
        rgba(255, 255, 255, 0.03) 45%,
        rgba(15, 23, 42, 0.45) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 28px 22px 22px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
}

.pin-unlock-card-shake {
    animation: pinUnlockShake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes pinUnlockShake {
    0%,
    100% {
        transform: translateX(0);
    }
    18% {
        transform: translateX(-12px);
    }
    36% {
        transform: translateX(10px);
    }
    54% {
        transform: translateX(-7px);
    }
    72% {
        transform: translateX(5px);
    }
}

.pin-unlock-brand {
    text-align: center;
    margin-bottom: 22px;
}

.pin-unlock-logo-ring {
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    color: #e0f2fe;
    background: linear-gradient(145deg, rgba(252, 61, 33, 0.55), rgba(16, 91, 216, 0.25));
    border: 2px solid rgba(147, 197, 253, 0.45);
    box-shadow:
        0 12px 40px rgba(16, 91, 216, 0.35),
        inset 0 2px 12px rgba(255, 255, 255, 0.15);
    animation: pinUnlockLogoPulse 2.8s ease-in-out infinite;
}

@keyframes pinUnlockLogoPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow:
            0 12px 40px rgba(16, 91, 216, 0.35),
            inset 0 2px 12px rgba(255, 255, 255, 0.15);
    }
    50% {
        transform: scale(1.04);
        box-shadow:
            0 18px 52px rgba(252, 61, 33, 0.45),
            inset 0 2px 14px rgba(255, 255, 255, 0.22);
    }
}

.pin-unlock-title {
    margin: 0 0 6px;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    background: linear-gradient(120deg, #f8fafc, #0B3D91 55%, #FC3D21);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.pin-unlock-sub {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.82);
    line-height: 1.45;
}

.pin-unlock-hidden-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.pin-unlock-dots {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 22px 0 20px;
}

.pin-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(147, 197, 253, 0.35);
    background: transparent;
    transition:
        transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.22s ease,
        border-color 0.22s ease,
        background 0.22s ease;
}

.pin-dot-filled {
    background: linear-gradient(145deg, #FC3D21, #105BD8);
    border-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.15);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.65);
}

.pin-unlock-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.pin-key {
    border: none;
    border-radius: 16px;
    padding: 0;
    height: 54px;
    font-size: 1.35rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition:
        transform 0.12s ease,
        background 0.18s ease,
        box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
    background: rgba(255, 255, 255, 0.11);
}

.pin-key:active {
    transform: scale(0.94);
}

.pin-key-ghost {
    font-size: 1.15rem;
    color: rgba(226, 232, 240, 0.85);
}

.pin-key-go {
    background: linear-gradient(145deg, var(--accent-from), var(--accent-to));
    border: none;
    color: #fff;
    box-shadow: 0 10px 28px rgba(16, 91, 216, 0.35);
}

.pin-key-go:hover {
    filter: brightness(1.06);
}

.pin-unlock-hint {
    margin: 18px 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: rgba(148, 163, 184, 0.95);
    text-align: center;
}

.pin-unlock-reset-block {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pin-unlock-reset-title {
    margin: 0 0 12px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
}

.pin-unlock-reset-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(203, 213, 225, 0.9);
    margin-bottom: 8px;
}

.pin-unlock-reset-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.pin-unlock-reset-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: none;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    background: rgba(251, 113, 133, 0.22);
    border: 1px solid rgba(251, 113, 133, 0.35);
    transition:
        background 0.18s ease,
        transform 0.12s ease;
}

.pin-unlock-reset-btn:hover {
    background: rgba(251, 113, 133, 0.32);
}

.pin-unlock-reset-btn:active {
    transform: scale(0.98);
}

.pin-unlock-footer-actions {
    margin-top: 18px;
    text-align: center;
}

.pin-unlock-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.95);
    text-decoration: none;
}

.pin-unlock-logout:hover {
    color: #fecaca;
}

html[data-theme="light"] .pin-unlock-bg {
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.28), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.22), transparent 48%),
        linear-gradient(165deg, #f1f5f9 0%, #e2e8f0 45%, #f8fafc 100%);
    animation: pinUnlockBgShift 16s ease-in-out infinite alternate;
}

html[data-theme="light"] .pin-unlock-card {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
}

html[data-theme="light"] .pin-unlock-sub {
    color: var(--muted);
}

html[data-theme="light"] .pin-key {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(15, 23, 42, 0.1);
    color: var(--text);
}

html[data-theme="light"] .pin-dot {
    border-color: rgba(16, 91, 216, 0.35);
}

html[data-theme="light"] .pin-unlock-reset-input {
    background: #fff;
    border-color: var(--hairline);
}

@media (prefers-reduced-motion: reduce) {
    .pin-unlock-bg,
    .pin-unlock-logo-ring {
        animation: none !important;
    }
    .pin-unlock-card-shake {
        animation: none !important;
    }
}

/* PIN настройки в модалке профиля */
.dash-profile-card-pin {
    grid-column: 1 / -1;
}

.dash-pin-head {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dash-pin-head i {
    color: var(--accent-from);
}

.dash-pin-lead {
    margin: 0 0 14px !important;
    line-height: 1.45;
    font-size: 0.88rem !important;
}

.dash-pin-form {
    margin-bottom: 14px;
}

.dash-pin-form-danger {
    padding-top: 12px;
    margin-top: 8px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .dash-pin-form-danger {
    border-top-color: rgba(15, 23, 42, 0.12);
}

.dash-pin-full-btn {
    width: 100%;
}

/* Утилиты skeleton / shimmer для будущих списков с подгрузкой (HTMX, API) */
@keyframes privchat-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.privchat-skeleton {
    border-radius: 12px;
    min-height: 12px;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.1) 45%,
        rgba(255, 255, 255, 0.04) 90%
    );
    background-size: 200% 100%;
}

@media (prefers-reduced-motion: no-preference) {
    .privchat-skeleton {
        animation: privchat-shimmer 1.15s ease-in-out infinite;
    }
}

html[data-theme="light"] .privchat-skeleton {
    background: linear-gradient(
        110deg,
        rgba(15, 23, 42, 0.05) 0%,
        rgba(15, 23, 42, 0.11) 45%,
        rgba(15, 23, 42, 0.05) 90%
    );
    background-size: 200% 100%;
}

.privchat-skeleton-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

html[data-theme="light"] .privchat-skeleton-block {
    border-color: rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.9);
}

.privchat-skeleton-line {
    height: 14px;
    border-radius: 8px;
}

.privchat-skeleton-line.short {
    width: 55%;
}

.privchat-skeleton-line.tiny {
    width: 30%;
    height: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .privchat-skeleton {
        animation: none;
        background: rgba(255, 255, 255, 0.06);
    }
    html[data-theme="light"] .privchat-skeleton {
        background: rgba(15, 23, 42, 0.08);
    }
}

/* ── Admin Panel ── */
.admin-container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h1 { font-size: 1.5rem; margin: 0; }
.admin-header-actions { display: flex; gap: 12px; }
.admin-nav { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-nav-item { padding: 10px 16px; border-radius: 8px; background: rgba(255,255,255,0.05); text-decoration: none; color: inherit; }
.admin-nav-item:hover, .admin-nav-item.active { background: var(--primary); color: #fff; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-stat-card { background: rgba(255,255,255,0.05); padding: 20px; border-radius: 12px; text-align: center; }
.admin-stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.admin-stat-label { font-size: 0.9rem; opacity: 0.7; margin-top: 4px; }
.admin-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.admin-table th, .admin-table td { padding: 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
.admin-table th { font-weight: 600; opacity: 0.7; font-size: 0.85rem; }
.admin-table tr:hover { background: rgba(255,255,255,0.03); }
.admin-table tr.banned { opacity: 0.5; }
.badge { padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: var(--primary); color: #fff; }
.badge-banned { background: #ef4444; color: #fff; }
.badge-ok { background: #22c55e; color: #fff; }
.admin-pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; }
.admin-form { max-width: 600px; }
.admin-form .form-group { margin-bottom: 16px; }
.admin-form label { display: block; margin-bottom: 6px; font-weight: 500; }
.admin-form input[type="text"], .admin-form input[type="url"] { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: inherit; }
.admin-form .btn-primary { margin-top: 8px; }
.admin-help { margin-top: 32px; padding: 16px; background: rgba(255,255,255,0.05); border-radius: 8px; }
.admin-help ol { margin: 8px 0 0 20px; padding: 0; }
.admin-help li { margin-bottom: 6px; }
html[data-theme="light"] .admin-nav-item { background: rgba(0,0,0,0.04); }
html[data-theme="light"] .admin-stat-card { background: rgba(0,0,0,0.03); }
html[data-theme="light"] .admin-table th, html[data-theme="light"] .admin-table td { border-color: rgba(0,0,0,0.08); }
html[data-theme="light"] .admin-help { background: rgba(0,0,0,0.03); }


/* ── Кнопка "Анонимно" в панели превью голоса ── */
.voice-preview-actions .btn-robot {
    background: linear-gradient(145deg, #1565c0 0%, #0d47a1 45%, #1976d2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: filter 0.15s, transform 0.12s;
}
.voice-preview-actions .btn-robot:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}
html[data-theme="light"] .voice-preview-actions .btn-robot {
    background: linear-gradient(145deg, #1976d2 0%, #1565c0 45%, #42a5f5 100%);
}

/* ── Кастомный аудиоплеер в сообщении (анонимный голос) ── */
.msg-audio-player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.07);
    width: min(220px, 75vw);
    margin-bottom: 4px;
    border: 1px solid rgba(255,255,255,0.08);
}
.message.me .msg-audio-player {
    background: rgba(0,0,0,0.18);
    border-color: rgba(255,255,255,0.15);
}
.msg-audio-play {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: transform 0.12s, filter 0.12s;
    box-shadow: 0 2px 8px rgba(46,125,50,0.35);
}
.msg-audio-play:hover { transform: scale(1.08); filter: brightness(1.1); }
.msg-audio-track {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.msg-audio-progress {
    height: 3px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.message.me .msg-audio-progress {
    background: rgba(255,255,255,0.25);
}
.msg-audio-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-from), var(--accent-to));
    transition: width 0.1s linear;
}
.msg-audio-time {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.message.me .msg-audio-time { color: rgba(255,255,255,0.7); }
.msg-audio-icon {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.6;
}
.message.me .msg-audio-icon { color: rgba(255,255,255,0.6); }
html[data-theme="light"] .msg-audio-player {
    background: rgba(0,0,0,0.05);
    border-color: rgba(0,0,0,0.1);
}
html[data-theme="light"] .message.me .msg-audio-player {
    background: rgba(0,0,0,0.12);
}
html[data-theme="light"] .msg-audio-progress {
    background: rgba(0,0,0,0.12);
}
html[data-theme="light"] .msg-audio-time { color: #64748b; }
html[data-theme="light"] .message.me .msg-audio-time { color: rgba(255,255,255,0.8); }

/* ========= Landing Page ========= */
.landing-page .container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.landing-root {
    position: relative;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 40px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    overflow-x: hidden;
}

.landing-bg {
    position: fixed;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.18), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.14), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.10), transparent 46%);
    animation: landingBgShift 18s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes landingBgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(3%, 2%) rotate(2deg); }
}

.landing-noise {
    position: fixed;
    inset: 0;
    opacity: 0.035;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.landing-main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.landing-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.landing-brand {
    text-align: center;
    margin-bottom: 24px;
}

.landing-logo-ring {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    display: grid;
    place-items: center;
    box-shadow: 0 12px 40px rgba(16, 91, 216, 0.35);
    animation: landingLogoPulse 3s ease-in-out infinite;
}

@keyframes landingLogoPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(16, 91, 216, 0.35); }
    50% { transform: scale(1.03); box-shadow: 0 16px 50px rgba(16, 91, 216, 0.45); }
}

.landing-logo-ring i {
    font-size: 32px;
    color: #fff;
}

.landing-title {
    margin: 0 0 8px;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.landing-tagline {
    margin: 0;
    font-size: 1rem;
    color: rgba(226, 232, 240, 0.75);
    font-weight: 400;
}

.landing-card {
    width: 100%;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 28px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.landing-card-title {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-card-title i {
    color: var(--accent-from);
}

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

.landing-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.landing-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.landing-label i {
    color: var(--accent-from);
    font-size: 0.75rem;
}

.landing-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.landing-input::placeholder {
    color: rgba(148, 163, 184, 0.55);
}

.landing-input:focus {
    border-color: var(--accent-from);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.18);
}

.landing-captcha .captcha-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.landing-captcha > .landing-label {
    text-align: center;
    justify-content: center;
}

.captcha-img {
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.captcha-img:hover {
    transform: scale(1.02);
    border-color: var(--accent-from);
}

.landing-btn {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.landing-btn:active {
    transform: scale(0.98);
}

.landing-btn-primary {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.35);
}

.landing-btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 30px rgba(16, 91, 216, 0.45);
}

.landing-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: rgba(148, 163, 184, 0.6);
    font-size: 0.85rem;
}

.landing-divider::before,
.landing-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.landing-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.landing-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.landing-features {
    width: 100%;
}

.landing-section-title {
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 20px;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.feature-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 91, 216, 0.25);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.feature-icon i {
    font-size: 18px;
    color: #fff;
}

.feature-card h3 {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.feature-card p {
    margin: 0;
    font-size: 0.88rem;
    color: rgba(226, 232, 240, 0.65);
    line-height: 1.5;
}

.landing-quick {
    width: 100%;
    padding-left: 20px;
    padding-right: 20px;
}

.quick-card {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.15), rgba(14, 165, 233, 0.1));
    border: 1px dashed rgba(16, 91, 216, 0.3);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
}

.quick-card > i {
    font-size: 24px;
    color: var(--accent-from);
}

.quick-card > span {
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.85);
}

.quick-link {
    color: var(--accent-from);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

.quick-link:hover {
    color: #0B3D91;
}

.quick-link i {
    font-size: 0.75rem;
}

.landing-footer {
    width: 100%;
    text-align: center;
    margin-top: 8px;
}

.footer-links {
    margin-bottom: 16px;
}

.footer-links a {
    color: rgba(148, 163, 184, 0.8);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s ease;
}

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

.footer-donate {
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.55);
}

.footer-donate code {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .landing-root {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

html[data-theme="light"] .landing-bg {
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.22), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.18), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.16), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.14), transparent 46%);
}

html[data-theme="light"] .landing-title {
    background: linear-gradient(90deg, #0f172a 0%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

html[data-theme="light"] .landing-tagline {
    color: var(--muted);
}

html[data-theme="light"] .landing-card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .landing-card-title {
    color: #0f172a;
}

html[data-theme="light"] .landing-label {
    color: var(--muted);
}

html[data-theme="light"] .landing-input {
    background: #fff;
    border-color: var(--hairline);
    color: #0f172a;
}

html[data-theme="light"] .landing-input::placeholder {
    color: #94a3b8;
}

html[data-theme="light"] .landing-divider {
    color: var(--muted);
}

html[data-theme="light"] .landing-divider::before,
html[data-theme="light"] .landing-divider::after {
    background: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .landing-btn-secondary {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    border-color: var(--hairline);
}

html[data-theme="light"] .landing-section-title {
    color: #0f172a;
}

html[data-theme="light"] .feature-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .feature-card h3 {
    color: #0f172a;
}

html[data-theme="light"] .feature-card p {
    color: var(--muted);
}

html[data-theme="light"] .quick-card {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.08), rgba(14, 165, 233, 0.06));
    border-color: rgba(16, 91, 216, 0.2);
}

html[data-theme="light"] .quick-card > span {
    color: var(--muted);
}

html[data-theme="light"] .footer-links a {
    color: var(--muted);
}

html[data-theme="light"] .footer-donate code {
    background: rgba(15, 23, 42, 0.05);
    border-color: var(--hairline);
}

@media (min-width: 640px) {
    .landing-main {
        max-width: 520px;
    }
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .landing-title {
        font-size: 2.4rem;
    }
    .landing-card {
        padding: 32px 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .landing-bg,
    .landing-logo-ring {
        animation: none !important;
    }
}

/* ========= Dark Theme Pages (Login, Register, Notes, etc.) ========= */
.dark-page .container {
    max-width: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

.dark-root {
    position: relative;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 16px 40px;
    box-sizing: border-box;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    overflow-x: hidden;
}

.dark-bg {
    position: fixed;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.18), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.14), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.10), transparent 46%);
    animation: landingBgShift 18s ease-in-out infinite alternate;
    z-index: 0;
}

.dark-noise {
    position: fixed;
    inset: 0;
    opacity: 0.035;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.dark-main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.dark-card {
    width: 100%;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 28px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.dark-card-title {
    margin: 0 0 20px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-card-title i {
    color: var(--accent-from);
}

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

.dark-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dark-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dark-label i {
    color: var(--accent-from);
    font-size: 0.8rem;
}

.dark-input,
.dark-textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    font-family: inherit;
}

.dark-textarea {
    min-height: 120px;
    resize: vertical;
}

.dark-input::placeholder,
.dark-textarea::placeholder {
    color: rgba(148, 163, 184, 0.55);
}

.dark-input:focus,
.dark-textarea:focus {
    border-color: var(--accent-from);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.18);
}

.dark-btn {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    text-decoration: none;
}

.dark-btn:active {
    transform: scale(0.98);
}

.dark-btn-primary {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    color: #fff;
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.35);
}

.dark-btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 30px rgba(16, 91, 216, 0.45);
}

.dark-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.dark-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.dark-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    color: rgba(148, 163, 184, 0.6);
    font-size: 0.85rem;
}

.dark-divider::before,
.dark-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.dark-links {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dark-links a {
    color: var(--accent-from);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.dark-links a:hover {
    color: #0B3D91;
}

.dark-header {
    text-align: center;
    margin-bottom: 8px;
}

.dark-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    display: grid;
    place-items: center;
    box-shadow: 0 8px 30px rgba(16, 91, 216, 0.35);
}

.dark-logo i {
    font-size: 26px;
    color: #fff;
}

.dark-title {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.dark-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.75);
    font-weight: 400;
}

.dark-note-display {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.95rem;
    color: #e2e8f0;
    word-break: break-all;
    line-height: 1.6;
}

.dark-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--accent-from);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px;
    background: rgba(16, 91, 216, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(16, 91, 216, 0.2);
}

.dark-footer {
    text-align: center;
    margin-top: 16px;
}

.dark-footer p {
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.55);
    margin: 0 0 8px;
}

.dark-footer code {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.7);
}

.dark-captcha-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 4px;
}

.dark-captcha-label {
    text-align: center;
    justify-content: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.85);
    display: flex;
    align-items: center;
    gap: 6px;
}

.dark-info-box {
    background: linear-gradient(135deg, rgba(16, 91, 216, 0.15), rgba(14, 165, 233, 0.1));
    border: 1px dashed rgba(16, 91, 216, 0.3);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.dark-info-box i {
    font-size: 32px;
    color: var(--accent-from);
    margin-bottom: 12px;
}

.dark-info-box h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: #fff;
}

.dark-info-box p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.75);
    line-height: 1.5;
}

.dark-select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    font-size: 1rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    cursor: pointer;
}

.dark-select:focus {
    border-color: var(--accent-from);
    background: rgba(15, 23, 42, 0.55);
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.18);
}

.dark-select option {
    background: #1e293b;
    color: #fff;
}

@media (min-width: 640px) {
    .dark-main {
        max-width: 520px;
    }
    .dark-title {
        font-size: 2rem;
    }
    .dark-card {
        padding: 32px 28px;
    }
}


/* ========= Dashboard Dark Background ========= */
.dashboard-page .dashboard-container {
    position: relative;
    min-height: 100vh;
}

.dashboard-page .dashboard-container::before {
    content: '';
    position: fixed;
    inset: -40%;
    background:
        radial-gradient(ellipse 80% 55% at 22% 22%, rgba(16, 91, 216, 0.12), transparent 52%),
        radial-gradient(ellipse 70% 50% at 88% 12%, rgba(14, 165, 233, 0.10), transparent 48%),
        radial-gradient(ellipse 90% 60% at 70% 88%, rgba(16, 91, 216, 0.08), transparent 50%),
        radial-gradient(ellipse 60% 40% at 12% 80%, rgba(14, 165, 233, 0.08), transparent 46%);
    animation: landingBgShift 18s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

.dashboard-page .dashboard-container::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.dashboard-page .dash-dashboard-shell {
    position: relative;
    z-index: 2;
}

/* ========= Dashboard Dark Theme Fixes ========= */
.dashboard-page .chat-form-wrapper {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 24px !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35) !important;
}

.dashboard-page .form-group input,
.dashboard-page .form-group select {
    background: rgb(15 23 42 / 14%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px !important;
    color: var(--text) !important;
    padding: 14px 16px !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.dashboard-page .form-group input:focus,
.dashboard-page .form-group select:focus {
    border-color: var(--accent-from) !important;
    background: rgba(15, 23, 42, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(16, 91, 216, 0.18) !important;
}

.dashboard-page .form-group label {
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.82rem;
    font-weight: 600;
}

.dashboard-page .btn-primary {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border-radius: 14px;
    padding: 14px 18px;
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.35);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.dashboard-page .btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 10px 30px rgba(16, 91, 216, 0.45);
}

.dashboard-page .btn-primary:active {
    transform: scale(0.98);
}

.dashboard-page .btn-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: var(--text);
}

.dashboard-page .btn-back:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.dashboard-page .btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 14px;
    color: #fca5a5;
}

.dashboard-page .btn-danger:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #fecaca;
}

.dashboard-page .chat-form-wrapper h2 {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Dashboard toggle switch dark */
.dashboard-page .toggle-text {
    color: rgba(226, 232, 240, 0.85);
    font-weight: 600;
}

.dashboard-page .slider {
    background-color: rgba(255, 255, 255, 0.1);
}

.dashboard-page .toggle-switch input:checked + .slider {
    background-color: var(--accent-from);
}

/* Chat list items in dashboard - already updated above */

.dashboard-page .chat-list li .chat-code {
    color: rgb(69 160 73);
}

.dashboard-page .chat-list li.empty-list {
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
}

.dashboard-page .btn-leave-chat {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.dashboard-page .btn-leave-chat:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
}

/* ========= Chat Page Dark Theme - Header & Input Only ========= */
/* Header */
.chat-page .chat-header {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.chat-page .chat-header h1 {
    color: #fff;
}

/* Message input area */
.chat-page .chat-input-area {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.chat-page #message-input {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.chat-page #message-input:focus {
    border-color: rgba(252, 61, 33, 0.5);
    box-shadow: 0 0 0 3px rgba(252, 61, 33, 0.12);
}

/* Chat buttons */
.chat-page .btn-back {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--muted);
}

.chat-page .btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

/* Modal sheets in chat/dashboard */
.dash-modal-body .form-group input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.dash-modal-body .form-group input:focus {
    border-color: rgba(252, 61, 33, 0.5);
    box-shadow: 0 0 0 3px rgba(252, 61, 33, 0.12);
}

.dash-modal-body .btn-primary {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    box-shadow: 0 8px 24px rgba(16, 91, 216, 0.35);
}

.dash-modal-body .form-group label {
    color: var(--muted);
}

.dash-modal-head h2 {
    color: var(--text);
}

.dash-modal-close {
    color: var(--muted);
}

.dash-modal-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
}

/* ========= Additional Dark Theme Fixes ========= */
/* Form group toggle in dark pages */
.dark-page .form-group-toggle,
.dashboard-page .form-group-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dark-page .toggle-text,
.dashboard-page .toggle-text {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.dark-page .slider,
.dashboard-page .slider {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark-page .toggle-switch input:checked + .slider,
.dashboard-page .toggle-switch input:checked + .slider {
    background-color: var(--accent-from);
}

/* Flash messages for dark-page */
.dark-page ~ .flash-messages .flash-message,
body.dark-page .flash-messages .flash-message {
    background: rgba(252, 61, 33, 0.15);
    border: 1px solid rgba(252, 61, 33, 0.25);
    color: #cfe9ff;
}

/* Auth container improvements for dark */
.dark-page .auth-container {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* PIN unlock page consistency */
.pin-unlock-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.pin-unlock-root {
    position: relative;
    z-index: 1;
}

/* ========= Admin Panel Dark Theme Enhancements ========= */
.admin-page .admin-container {
    background: transparent;
}

.admin-page .admin-header h1 {
    color: var(--text);
}

.admin-page .admin-nav-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--muted);
    transition: all 0.2s ease;
}

.admin-page .admin-nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.admin-page .admin-nav-item.active {
    background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(16, 91, 216, 0.35);
}

.admin-page .admin-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.admin-page .admin-stat-value {
    background: linear-gradient(135deg, var(--accent-from), #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.admin-page .admin-table th {
    color: var(--muted);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.admin-page .admin-table td {
    color: var(--text);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.admin-page .admin-table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

.admin-page .admin-form input[type="text"],
.admin-page .admin-form input[type="url"] {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.admin-page .admin-form input[type="text"]:focus,
.admin-page .admin-form input[type="url"]:focus {
    border-color: rgba(252, 61, 33, 0.5);
    box-shadow: 0 0 0 3px rgba(252, 61, 33, 0.12);
}

.admin-page .admin-help {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}
