/**
 * ChatApp - Main Stylesheet
 * Design imported from user templates
 */

/* ===== CSS Variables ===== */
:root {
    /* Primary colors */
    --primary: #8849FE;
    --primary-dark: #7233E8;
    --primary-light: rgba(136, 73, 254, 0.1);
    --accent: #8849FE;
    --accent-color: #8849FE;
    --accent-hover: #7233E8;

    /* Success/Error */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;

    /* Light theme */
    --bg-primary: #E5E7EB;
    /* Тінь картки — одним місцем на весь сайт.

       Два шари, а не один: біля самого краю щільний контакт, під ним широка
       м'яка пляма. На сірому тлі сторінки одношарова тінь у 8% чорного
       розчиняється — картка від землі не відривається, а просто лежить на
       ній наклейкою. */
    --card-shadow: 0 4px 14px rgba(16, 24, 40, .10);
    --card-shadow-lg: 0 8px 26px rgba(16, 24, 40, .14);
    --bg-secondary: #F3F4F6;
    --bg-tertiary: #F9FAFB;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;

    /* Text colors */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-muted: #9CA3AF;
}

body.dark {
    --bg-primary: #0f0f0f;
    /* У темряві тінь працює інакше: тло вже майже чорне, тож пляма мусить
       бути щільнішою, інакше її не видно взагалі. */
    --card-shadow: 0 4px 14px rgba(0, 0, 0, .38);
    --card-shadow-lg: 0 8px 26px rgba(0, 0, 0, .5);
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --card-bg: #1a1a1a;
    --border-color: #2d2d2d;

    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #6b7280;
    --text-muted: #6b7280;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Місце під смугу прокрутки — завжди, і саме на корені (власник, 20.10.2026:
   «з ПК сторіз скакає»). Раніше body мав overflow-y: scroll. Щойно переглядач
   сторіз, фото чи аркуш ховав прокрутку (overflow: hidden на html), body сам
   ставав прокручуваною коробкою: з'являлась його власна смуга, сторінка
   зсувалась, а липка шапка відскакувала на сотні пікселів угору. Резерв на
   корені тримає ширину і з прихованою прокруткою, і body лишається звичайним.
   Тому й модалкам (body.modal-open, аркуш дій) свій відступ праворуч не
   потрібен — він лише звужував би сторінку. */
html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'ReeUI', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    transition: background 0.3s, color 0.3s;
}

body.modal-open {
    overflow: hidden;
}

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

button {
    font-family: inherit;
    cursor: pointer;
}

input,
textarea,
select {
    font-family: inherit;
}

/* ===== Container ===== */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-secondary);
    /* Висота найменшого екрана (з панелями браузера), а не 100vh: у Chrome на iPhone 100vh — екран БЕЗ панелей, і
       коротка сторінка виходила на ~108 px вищою за видиме. Під час переходу (тап «Групи» на /groups) вона на мить
       стояла прокрученою до низу разом із нижнім меню — «скакає» (власник, 22.10.2026, відео). */
    min-height: 100vh;
    min-height: 100svh;
    /* Just clears the 54px bottom nav — was 70px, which left a visible band of
       empty space between the content and the bar. */
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
}

body.dark .container {
    background: #0f0f0f;
}

/* ===== Main Wrapper with Sidebars ===== */
.main-wrapper {
    display: flex;
    /* Not centred. The three columns add up to exactly the wrapper's content
       box, so centring them changes nothing once the page is whole — but while
       it arrives the right sidebar is not there yet, and centring the two that
       are shifts them into the middle and then slides everything left when the
       third lands. Starting from the left edge, each column is drawn where it
       will stay. The wrapper itself is still centred, by margin: 0 auto. */
    justify-content: flex-start;
    gap: 3px;
    max-width: 1274px;
    /* 280 + 3 + 680 + 3 + 280 + 28 padding */
    margin: 0 auto;
    padding: 16px 14px 0;
}

.main-wrapper .content {
    /* A basis of 680px rather than "whatever the content needs". With flex: 1
       the column is sized from what is inside it, so before the page arrives it
       is empty, measures zero, and the two sidebars sit touching — then the
       content lands and shoves everything apart. A fixed basis reserves the
       middle from the first paint, so nothing moves when it fills. */
    flex: 1 1 680px;
    max-width: 680px;
    min-width: 0;
    order: 2;
}

/* Sidebar order for correct layout */
.sidebar-left {
    order: 1;
}

.sidebar-right {
    order: 3;
}

/* ===== Sidebars ===== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: calc(72px + var(--crumbs-h, 0px));
    /* header 56px + 16px gap (+ рядок хлібних крихт, includes/components/breadcrumbs.php) */
    height: fit-content;
    max-height: calc(100vh - 88px - var(--crumbs-h, 0px));
    overflow-y: auto;
}

/* Смуга прокрутки на боковій панелі — невидима.
   Прокрутка лишається: ховаємо саме смугу, а не overflow. Той самий клас
   несуть і панель адмінки, і висувна панель на телефоні, тож правило одне
   на всі три. */
.sidebar {
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* старий Edge */
}

.sidebar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Left Sidebar */
.sidebar-left {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--card-shadow);
}

body.dark .sidebar-left {
    box-shadow: var(--card-shadow);
}

/* Sidebar Profile Card */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 8px;
    /* The card itself is the link to the profile. */
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-profile:hover {
    background: var(--bg-tertiary);
}

.sidebar-profile:hover .sidebar-profile-name {
    color: var(--accent-color);
}

.sidebar-profile-avatar {
    position: relative;
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tertiary);
}

.sidebar-online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.sidebar-profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-name {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Той самий кегль, що в шапці профілю й у налаштуваннях: це три місця, де
       нік стоїть сам, а не рядком у списку. */
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-profile-name {
    transition: color 0.15s;
}

.sidebar-verify-icon {
    width: 16px;
    height: 16px;
    color: var(--accent-color);
}

.sidebar-profile-username {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Sidebar Navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-nav-item:hover {
    background: var(--bg-secondary);
}

.sidebar-nav-item.active {
    background: rgba(136, 73, 254, 0.1);
    color: var(--accent-color);
}

.sidebar-nav-item svg,
.sidebar-nav-item i[data-lucide] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #EF4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav-badge.online {
    background: #10B981;
}

/* Баланс у рядку «Гаманець». */
.sidebar-nav-coins {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.sidebar-nav-coins b {
    font-weight: 600;
}

.sidebar-nav-item .sidebar-nav-coins .star-ico {
    width: 14px;
    height: 14px;
}

.sidebar-nav-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

/* ─── VIP-картка в боковій панелі ────────────────────────────────────────
   Замінила вузьку смужку Premium (.sidebar-premium): та була рядком меню з
   короною й нічим не відрізнялася від сусідніх пунктів.

   Один блок, два стани: .is-on — статус уже є. Розмітка спільна, різняться
   лише кольори й слова, бо клік в обох випадках веде на /premium.

   Панель усередині лише 248 px завширшки, тому все тут менше за звичайне:
   значок 52 px, назва може перенестися на два рядки — це передбачено. */
.vip-card {
    position: relative;

    /* Проміння більше за картку. Обрізає його саме ця властивість —
       без неї воно вилазить на меню поруч. */
    overflow: hidden;

    /* І одразу плата за цей overflow: панель — це колонка flex на всю висоту
       екрана, а елемент колонки, в якого overflow не visible, втрачає свій
       автоматичний найменший розмір і стискається до нуля. На телефоні, де
       вміст не влазить, картка від 93 px сплющувалася до 24. Решта пунктів
       цілі саме тому, що в них overflow звичайний.
       Панель від цього почне гортатися — вона до того й готова (overflow-y). */
    flex-shrink: 0;

    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    color: #fff;
    text-decoration: none;
    background: linear-gradient(120deg, #8849FE 0%, #A855F7 46%, #EC4899 100%);
    box-shadow: 0 6px 18px rgba(136, 73, 254, 0.32);
    transition: transform 0.15s, box-shadow 0.15s;
}

/* Стан «статус є» — не просто рожевий, а перехід від малинового до
   фіолетового, з м'яким світлом у правому верхньому куті, там, де медаль.

   Раніше тут був рожевий одного тону: на 82 px висоти градієнт із двох
   сусідніх відтінків не читався взагалі, і банер виглядав залитим кольором.
   Фіолетовий кінець ще й тримає золото медалі — на суцільному рожевому воно
   з ним сперечалося. */
.vip-card.is-on {
    background:
        radial-gradient(110% 150% at 88% 6%, rgba(255, 255, 255, 0.22) 0%, transparent 45%),
        linear-gradient(118deg, #FF4D8D 0%, #E0157A 42%, #8B2BD9 100%);
    box-shadow: 0 6px 18px rgba(190, 40, 160, 0.34);
}

.vip-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(136, 73, 254, 0.4);
}

.vip-card.is-on:hover {
    box-shadow: 0 10px 24px rgba(190, 40, 160, 0.42);
}

/* Відблиск, що раз на кілька секунд проходить картку. */
.vip-card::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 45%;
    background: linear-gradient(105deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0) 100%);
    animation: vipShine 4.6s linear infinite;
    pointer-events: none;
    z-index: 4;
}

.vip-card-txt {
    position: relative;
    z-index: 3;
    flex: 1;
    min-width: 0;
}

.vip-card-title {
    display: block;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.vip-card-sub {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
    opacity: 0.85;
}

.vip-card-art {
    position: relative;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vip-card-rays,
.vip-card-glow {
    position: absolute;
    width: 148px;
    height: 148px;
    pointer-events: none;
}

.vip-card-rays {
    z-index: 1;
    background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.55) 0deg 22deg, transparent 22deg 45deg);

    /* Без маски це суцільна «пилка» на всю картку. Маска лишає від неї кільце
       навколо значка: усередині порожньо, назовні згасає. */
    -webkit-mask: radial-gradient(closest-side, transparent 20%, #000 36%, transparent 78%);
    mask: radial-gradient(closest-side, transparent 20%, #000 36%, transparent 78%);
    opacity: 0.52;
    animation: vipRays 26s linear infinite;
}

.vip-card-glow {
    z-index: 0;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.2) 44%, transparent 72%);
}

.vip-card-art img {
    position: relative;
    z-index: 2;
    display: block;
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.32));
    animation: vipFloat 1.9s ease-in-out infinite;
}

/* Іскри. Чотирипроменеві зірочки, як у телеграмі: спалахнула — згасла, по черзі.
   Форма — clip-path, а не картинка й не шрифт: чотири зайві запити чи цілий
   шрифт заради восьми пікселів не варті того. */
.vip-spark {
    position: absolute;
    z-index: 3;
    width: 8px;
    height: 8px;
    background: #FFE9A8;
    clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%);
    opacity: 0;
    pointer-events: none;
    animation: vipSpark 2.4s ease-in-out infinite;
}

.vip-spark.s1 {
    top: 2px;
    left: 0;
    width: 9px;
    height: 9px;
    animation-delay: 0s;
}

.vip-spark.s2 {
    top: 6px;
    right: 1px;
    width: 7px;
    height: 7px;
    background: #fff;
    animation-delay: 0.6s;
}

.vip-spark.s3 {
    bottom: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    animation-delay: 1.2s;
}

.vip-spark.s4 {
    bottom: 1px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #FFD23D;
    animation-delay: 1.8s;
}

@keyframes vipRays {
    to { transform: rotate(360deg); }
}

@keyframes vipFloat {
    0%, 100% { transform: translateY(2px); }
    50%      { transform: translateY(-4px); }
}

@keyframes vipSpark {
    0%, 100% { opacity: 0; transform: scale(0.25) rotate(0deg); }
    12%      { opacity: 1; transform: scale(1) rotate(25deg); }
    30%      { opacity: 0; transform: scale(0.25) rotate(50deg); }
}

@keyframes vipShine {
    0%        { transform: translateX(-120%); }
    55%, 100% { transform: translateX(330%); }
}

/* Кому рух заважає — тому картка просто стоїть. Іскри тоді видно постійно,
   інакше від них лишилася б порожнеча. */
@media (prefers-reduced-motion: reduce) {
    .vip-card::after,
    .vip-card-rays,
    .vip-card-art img,
    .vip-spark {
        animation: none;
    }

    .vip-spark {
        opacity: 0.85;
    }
}

/* Right Sidebar */
.sidebar-right {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--card-shadow);
    overflow-y: visible;
    max-height: none;
}

body.dark .sidebar-right {
    box-shadow: var(--card-shadow);
}

.sidebar-right-section {
    margin-bottom: 20px;
}

.sidebar-right-section:last-of-type {
    margin-bottom: 0;
}

.sidebar-right-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.sidebar-online-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.sidebar-online-indicator {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.sidebar-quick-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.sidebar-quick-link:hover {
    background: var(--bg-secondary);
}

.sidebar-quick-link svg,
.sidebar-quick-link i[data-lucide] {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.sidebar-right-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.sidebar-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 12px;
}

.sidebar-footer-links a {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: none;
}

.sidebar-footer-links a:hover {
    color: var(--text-secondary);
}

.sidebar-footer-copy {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* -----------------------------------------------------------------------------
   Права панель — стопка карток (includes/components/sidebar_right.php,
   у панелі керування — control-panel-9dq2/includes/sidebar_right.php)
   -----------------------------------------------------------------------------
   Не одна біла плита з розділами, а окремі картки з проміжком — кожна про своє
   й кожна корисна сама по собі. Висота розрахована на екран ноутбука. */
.sidebar-right.rs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
}

body.dark .sidebar-right.rs {
    background: none;
    box-shadow: none;
}

.rs-card {
    padding: 14px;
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
}

.rs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 20px;
    margin-bottom: 12px;
}

.rs-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.rs-note {
    overflow: hidden;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rs-more,
.rs-link {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-color, #8849FE);
    text-decoration: none;
}

.rs-more svg,
.rs-link svg {
    width: 14px;
    height: 14px;
}

.rs-link {
    margin-top: 8px;
    font-size: 13px;
}

.rs-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    background: rgba(16, 185, 129, .12);
    color: #059669;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rs-pill i,
.rs-live-dot,
.rs-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10B981;
}

body.dark .rs-pill {
    background: rgba(16, 185, 129, .18);
    color: #34D399;
}

.rs-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
}

.rs-empty svg {
    flex: none;
    width: 16px;
    height: 16px;
}

.rs-empty.is-ok svg {
    color: #10B981;
}

.rs-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ---- Мій рейтинг: число, медаль, скільки до наступної */
.rs-rate-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: inherit;
    text-decoration: none;
}

.rs-rate-medal {
    flex: none;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.rs-rate .rs-head .rs-delta {
    margin-left: 0;
}

.rs-rate-next {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.rs-rate-next img,
.rs-rate-next svg,
.rs-rate-next i[data-lucide] {
    flex: none;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.rs-rate-next.is-top svg,
.rs-rate-next.is-top i[data-lucide] {
    color: #F59E0B;
}

.rs-day-num {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}

.rs-day-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.rs-delta {
    margin-left: auto;
    padding: 2px 7px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rs-delta.is-up {
    background: rgba(16, 185, 129, .12);
    color: #059669;
}

.rs-delta.is-down {
    background: rgba(239, 68, 68, .1);
    color: #DC2626;
}

.rs-bar {
    overflow: hidden;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary, #F3F4F6);
}

body.dark .rs-bar {
    background: #262626;
}

.rs-bar i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8849FE, #6C5CFF);
    transition: width .4s ease;
}

/* ---- Обличчя онлайн */
.rs-faces {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px 6px;
}

.rs-face {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: var(--text-primary);
    text-decoration: none;
}

.rs-face .rs-avatar {
    width: 44px;
    height: 44px;
}

.rs-face .rs-dot {
    position: absolute;
    top: 33px;
    left: calc(50% + 12px);
    width: 11px;
    height: 11px;
    border: 2px solid var(--card-bg);
}

.rs-face-name {
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rs-face-more {
    align-self: start;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0 auto;
    border-radius: 14px;
    background: var(--bg-tertiary, #F3F4F6);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

body.dark .rs-face-more {
    background: #262626;
}

/* ---- Рядки: непрочитані, кімнати */
.rs-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 -8px;
}

.rs-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background .15s;
}

.rs-row:hover {
    background: var(--bg-secondary);
}

.rs-row .rs-avatar {
    width: 36px;
    height: 36px;
}

.rs-avatar {
    flex: none;
    display: block;
    object-fit: cover;
}

.rs-row-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.rs-row-name {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    font-size: 13.5px;
    font-weight: 600;
}

.rs-row-name > span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rs-row-name svg {
    flex: none;
    width: 13px;
    height: 13px;
    color: var(--text-tertiary);
}

.rs-row-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.rs-row-sub.is-live {
    color: #059669;
}

body.dark .rs-row-sub.is-live {
    color: #34D399;
}

.rs-count {
    flex: none;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent-color, #8849FE);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rs-chev {
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

/* ---- Панель керування: черга, пульс, ключ-значення */
.rs-pill.is-warn {
    background: rgba(239, 68, 68, .12);
    color: #DC2626;
}

.rs-pill.is-off {
    background: var(--bg-tertiary, #F3F4F6);
    color: var(--text-secondary);
}

body.dark .rs-pill.is-warn {
    background: rgba(239, 68, 68, .2);
    color: #F87171;
}

body.dark .rs-pill.is-off {
    background: #262626;
}

.rs-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 11px;
}

.rs-ico svg {
    width: 17px;
    height: 17px;
}

.rs-ico.is-red {
    background: rgba(239, 68, 68, .1);
    color: #EF4444;
}

.rs-ico.is-blue {
    background: rgba(59, 130, 246, .1);
    color: #3B82F6;
}

.rs-ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rs-row-sub .rs-ellipsis {
    min-width: 0;
}

.rs-pulse-main {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.rs-pulse-main b {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}

.rs-pulse-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.rs-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.rs-stats > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 8px;
    border-radius: 11px;
    background: var(--bg-secondary, #F3F4F6);
    min-width: 0;
}

body.dark .rs-stats > div {
    background: #222;
}

.rs-stats b {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.rs-stats span {
    overflow: hidden;
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.rs-kv {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rs-kv > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.rs-kv b {
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rs-kv b.is-bad {
    color: #EF4444;
}

/* ---- Підвал */
.rs-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 2px 6px 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

.rs-foot a {
    color: var(--text-tertiary);
    text-decoration: none;
}

.rs-foot a:hover {
    color: var(--text-secondary);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* Burger button - hidden on desktop */
.burger-btn {
    display: none;
}

/* Desktop: show sidebars */
@media (min-width: 1024px) {
    .sidebar {
        display: flex;
        flex-direction: column;
    }

    .burger-btn {
        display: none !important;
    }

    .bottom-nav {
        display: none !important;
    }

    /* The footer is the last thing inside a container that is at least a screen
       tall, and it was in ordinary flow — so a page whose content did not fill
       the screen left it stranded partway down with dead space underneath. The
       profile started doing exactly that once its redesign made it shorter.
       A column flexbox hands the slack to the wrapper instead: on a short page
       the footer lands on the bottom edge, on a long one it stays at the end of
       the content. Desktop only — on a phone the bar at the bottom is fixed and
       this footer is not drawn at all. */
    .container {
        display: flex;
        flex-direction: column;
        padding-bottom: 20px;
    }

    .main-wrapper {
        /* Takes the spare height; never squeezed below its own content. */
        flex: 1 0 auto;
    }

    .header,
    .desktop-footer {
        flex: 0 0 auto;
    }

    /* All three of these centre themselves with `margin: 0 auto` under a
       `max-width`. In block layout that fills the line and caps it. As flex
       items it is the opposite: an item with auto margins on the cross axis
       is NOT stretched — it is sized to its contents and then centred, so the
       header collapsed to the width of its own icons the moment the container
       became a column. width: 100% gives them back the line to be capped. */
    .header,
    .main-wrapper,
    .desktop-footer {
        width: 100%;
    }

    /* Desktop Footer */
    .desktop-footer {
        display: block !important;
    }
}

/* Desktop Footer */
.desktop-footer {
    display: none;
    max-width: 1274px;
    margin: 40px auto 0;
    padding: 24px 14px;
    border-top: 1px solid var(--border-color);
}

.desktop-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.desktop-footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.desktop-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

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

.desktop-footer-copy {
    color: var(--text-muted);
    font-size: 12px;
}

.desktop-footer-copy a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Tablet/Mobile: hide sidebars, show burger */
@media (max-width: 1023px) {
    .main-wrapper {
        padding: 0;
    }

    .main-wrapper .content {
        max-width: 100%;
        /* The 680px basis is there to hold the middle column open between two
           sidebars. There are no sidebars here, so it has nothing to reserve
           and would only be one more thing for the phone to shrink back down. */
        flex-basis: auto;
    }

    /* .rs — стопка карток: її display:flex важчий за голий .sidebar-right,
       тож ховати треба й під цим ім'ям, інакше панель вилазить на телефоні. */
    .sidebar-right,
    .sidebar-right.rs {
        display: none;
    }

    .sidebar-left {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 300px;
        max-width: 85vw;
        border-radius: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        /* Спільне .sidebar дає height: fit-content і max-height від 100vh —
           висувна панель тоді закінчувалася там, де вміст, і внизу екрана
           просвічувала сторінка (власник, скрін з iPhone 20.10.2026). Висоту
           тут задають top: 0 і bottom: 0. */
        height: auto;
        max-height: none;
        padding-top: 20px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .sidebar-left.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        pointer-events: auto;
    }

    .burger-btn {
        display: flex !important;
    }

    body.sidebar-open {
        overflow: hidden;
    }
}

/* Nav avatar in footer */
.nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tertiary);
    border: 2px solid transparent;
}

.nav-avatar-item.active .nav-avatar {
    border-color: var(--accent-color);
}

/* ===== Header ===== */
.header {
    height: 56px;
    background: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

@media (min-width: 1024px) {
    .header {
        max-width: 1274px;
        margin: 0 auto;
        padding: 0 14px;
        border-radius: 0 0 16px 16px;
    }
}

body.dark .header {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #F3F4F6;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: #E5E7EB;
}

body.dark .back-btn {
    background: #262626;
}

body.dark .back-btn:hover {
    background: #333333;
}

.back-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
    cursor: pointer;
    transition: color 0.2s;
}

.back-icon:hover {
    color: #111827;
}

body.dark .back-icon {
    color: #9ca3af;
}

body.dark .back-icon:hover {
    color: #e5e7eb;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    padding-right: 20px;
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 30px), transparent 100%);
    mask-image: linear-gradient(to right, black calc(100% - 30px), transparent 100%);
}

body.dark .header-title {
    color: #e5e7eb;
}

.logo-icon {
    width: 22px;
    height: 22px;
    color: #3B82F6;
}

/* Header Logo Image */
.header-logo {
    height: 28px;
    width: auto;
    max-width: 120px;
    aspect-ratio: 323 / 84;
    object-fit: contain;
    display: block;
    /* Скелетон рівно в розмір лого: ширину дає співвідношення сторін (width і
       height у розмітці), тож рамка стоїть ще до того, як приїде картинка, а
       на ній — той самий відблиск, що й у фото. Картинка прозора, тож тло
       знімаємо, щойно вона завантажилась. */
    border-radius: 7px;
    background-color: #E5E7EB;
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, .65) 50%, rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

body.dark .header-logo {
    background-color: #262626;
    background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, 0) 80%);
}

.header-logo.is-loaded,
body.dark .header-logo.is-loaded {
    background: none;
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .header-logo {
        animation: none;
    }
}

@media (max-width: 480px) {
    .header-logo {
        height: 24px;
        max-width: 100px;
    }
}

.status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #10B981;
    font-weight: 500;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
}

.header-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon:hover {
    color: #111827;
}

body.dark .header-icon {
    color: #9ca3af;
}

body.dark .header-icon:hover {
    color: #e5e7eb;
}

.header-icon svg,
.header-icon i[data-lucide] {
    width: 20px;
    height: 20px;
}

/* A 20px icon is a 20px target, and on a phone that is a miss as often as a
   hit. The button is the full height of the bar and wide enough for a thumb;
   the icon inside is unchanged, so nothing looks different — there is simply
   something to press above and below it. The row's gap is dropped to 2px
   because the padding now provides the spacing, and without that the controls
   would drift apart by the width of two fingers. */
.header-icon-btn {
    background: none;
    border: none;
    padding: 0 7px;
    align-self: stretch;
    min-width: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.header-icon-btn:hover .header-icon {
    color: #111827;
}

body.dark .header-icon-btn:hover .header-icon {
    color: #e5e7eb;
}

/* The logo is a link the height of the bar, not a 28px picture floating in it. */
.logo-link {
    align-self: stretch;
    padding-right: 10px;
}

/* Same treatment for the back arrow, but its grey pill is part of the design,
   so the pill is drawn as a layer at its old size while the link itself spans
   the bar. Pressing beside the pill goes back; the pill is just what you see. */
.back-btn {
    position: relative;
    align-self: stretch;
    height: auto;
    width: auto;
    min-width: 44px;
    padding: 0 12px;
    background: none;
    border-radius: 0;
}

/* Anchored at 16px, not centred on the button. What you see on the left is a
   36px pill and what you see on the right is a 30px avatar; putting 16px in
   front of the 20px *icon* left the pill sticking out to 8px, which is why the
   two ends of the bar did not look symmetrical. The padding below then centres
   the icon on the pill: 24 + half of 20 = 34 = 16 + half of 36. */
.back-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 16px;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    border-radius: 10px;
    background: #F3F4F6;
    transition: background 0.2s;
}

.back-btn:hover::before {
    background: #E5E7EB;
}

body.dark .back-btn::before {
    background: #262626;
}

body.dark .back-btn:hover::before {
    background: #333333;
}

.back-btn:hover,
body.dark .back-btn,
body.dark .back-btn:hover {
    background: none;
}

/* Above the pill, or the arrow is painted under it. */
.back-btn .back-icon {
    position: relative;
}

/* The bar keeps its 16px of breathing room, but as padding on the outermost
   control rather than on the bar itself: the logo and the last icon then reach
   the screen edge as targets while looking exactly where they always did. The
   gaps drop to nearly nothing because the controls now carry their own. */
/* Both rows stretch to the bar's full height first — the bar centres its two
   halves, so without this a control that stretches only reaches the height of
   its own text and the extra target area never appears. */
.header-left {
    gap: 4px;
    margin-left: -16px;
    align-self: stretch;
}

.header-right {
    gap: 2px;
    margin-right: -16px;
    align-self: stretch;
}

.header-left > *:first-child {
    padding-left: 16px;
}

.header-right > *:last-child {
    padding-right: 16px;
}

/* The back arrow is the exception to the rule above, because its visible box is
   the pill rather than the icon. Written after it, and equally specific, so it
   wins on order. */
.header-left > .back-btn {
    padding-left: 24px;
    padding-right: 12px;
}

@media (min-width: 1024px) {

    /* The bar's own padding is 14px up here, so the pull-out has to match it
       or the logo shifts two pixels sideways on a wide screen. */
    .header-left {
        margin-left: -14px;
    }

    .header-right {
        margin-right: -14px;
    }

    .header-left > *:first-child {
        padding-left: 14px;
    }

    .header-right > *:last-child {
        padding-right: 14px;
    }

    .header-left > .back-btn {
        padding-left: 22px;
    }

    .back-btn::before {
        left: 14px;
    }
}

/* Your face at the end of the bar. The shape comes from the site-wide avatar
   rule at the foot of this file. */
.header-avatar img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    display: block;
    background: var(--bg-tertiary, #F3F4F6);
}

/* Notification badge in header */
.header-notif-btn {
    position: relative;
}

/* What the badge is measured against. The button around it is a wide strip, so
   without this box the number would be pinned to the strip's corner instead of
   to the bell. */
.header-icon-slot {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* A little tag hanging BELOW the icon and pointing up at it, rather than a
   disc pinned to a corner. Centred and clear of the glyph entirely, so it needs
   no ring to stay legible — the ring existed only to hold the red apart from
   the strokes it was sitting on.

   Below rather than above because above it still clipped the top of the bell:
   the bar is 56px and the icon 20, which leaves 18px of air on each side, and a
   badge that starts 2px INTO the icon to buy itself room is a badge sitting on
   the thing it is about. Down here the whole 18px is free, so the numbers below
   are chosen to fit inside it — 3px of tail plus a 14px tag — and nothing hangs
   out of the bar.

   Squarer than it was: 8px on a 16px-tall pill was a full capsule, which reads
   as a chip rather than as a count. */
.header-notif-badge {
    position: absolute;
    left: 50%;
    top: calc(100% + 3px);
    transform: translateX(-50%);
    min-width: 15px;
    height: 14px;
    padding: 0 4px;
    background: #EF4444;
    color: white;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    pointer-events: none;

    /* Silent unless this load has something to announce. The number is not
       painted at all by default, so a refresh goes straight to the dot with no
       flash of a count on the way — which is why the decision is made in the
       head and not after the bar exists. */
    opacity: 0;
    visibility: hidden;
}

/* Three seconds is about two glances. Then it goes and the dot takes over.
   `forwards` so the end state sticks rather than snapping back the moment the
   animation finishes. */
[data-announce-notif] .header-notif-badge.is-notif,
[data-announce-chats] .header-notif-badge.is-chats,
[data-announce-reports] .header-notif-badge.is-reports {
    opacity: 1;
    visibility: visible;
    animation: notif-count-out .45s ease 3s forwards;
}

/* What is left afterwards: no number, just the fact that there is something.
   In the corner of the glyph rather than under it, because down there it would
   be a full-width tag's worth of empty air holding one dot. */
.header-notif-dot {
    position: absolute;
    top: -1px;
    right: -2px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #EF4444;
    pointer-events: none;

    /* The other way round: the dot is what you get unless the number is
       speaking, in which case it waits its three seconds. */
    opacity: 1;
}

[data-announce-notif] .header-notif-dot.is-notif,
[data-announce-chats] .header-notif-dot.is-chats,
[data-announce-reports] .header-notif-dot.is-reports {
    opacity: 0;
    animation: notif-dot-in .45s ease 3s forwards;
}

/* A plain fade, with no movement in it. A keyframe that also moved the badge
   would have to restate translateX(-50%) or the thing would jump out of its own
   centring on the first frame — and the fade is what was asked for anyway. */
@keyframes notif-count-out {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes notif-dot-in {
    to {
        opacity: 1;
    }
}

/* Still a swap, just not a gradual one: which of the two is showing is
   information, not decoration, so it happens either way. */
@media (prefers-reduced-motion: reduce) {
    [data-announce-notif] .header-notif-badge.is-notif,
    [data-announce-chats] .header-notif-badge.is-chats,
    [data-announce-reports] .header-notif-badge.is-reports,
    [data-announce-notif] .header-notif-dot.is-notif,
    [data-announce-chats] .header-notif-dot.is-chats,
    [data-announce-reports] .header-notif-dot.is-reports {
        animation-duration: .01s;
    }
}

/* The tail, now on top and pointing up at the icon. Drawn with borders rather
   than a rotated square: a rotated square leaves a hairline of background
   showing along the join wherever the device pixel ratio is not a whole
   number. */
.header-notif-badge::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-bottom: 3px solid #EF4444;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: center/cover;
    cursor: pointer;
    border: 2px solid #e5e7eb;
}

body.dark .avatar {
    border-color: #374151;
}

/* Theme Icons */
.theme-icon-moon {
    display: block;
}

.theme-icon-sun {
    display: none;
}

body.dark .theme-icon-moon {
    display: none;
}

body.dark .theme-icon-sun {
    display: block;
}

/* ===== Welcome Block ===== */
.welcome {
    padding: 20px 16px 12px;
}

.welcome h1 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

body.dark .welcome h1 {
    color: #e5e7eb;
}

.welcome p {
    font-size: 13px;
    color: #6B7280;
}

body.dark .welcome p {
    color: #9ca3af;
}

/* ===== Dashboard Cards ===== */
.dashboard {
    padding: 8px 16px 16px;
}

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

.card {
    position: relative;
    background: #A7DFFF;
    border-radius: 16px;
    padding: 16px 14px;
    height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    text-decoration: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-icon {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.95);
}

.card-text {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
}

.card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
}

.card-1 {
    background: #8849FE;
}

.card-2 {
    background: #EC4899;
}

.card-3 {
    background: #F59E0B;
}

.card-4 {
    background: #10B981;
}

.card-5 {
    background: #EF4444;
}

.card-6 {
    background: #3B82F6;
}

/* ===== Quick Topics ===== */
.topics {
    padding: 16px 0 16px 16px;
}

.topics-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}

body.dark .topics-title {
    color: #d1d5db;
}

.topics-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.topics-scroll::-webkit-scrollbar {
    display: none;
}

.topic-pill {
    background: #FFFFFF;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}

.topic-pill:hover {
    background: #F9FAFB;
}

body.dark .topic-pill {
    background: #262626;
    color: #d1d5db;
}

body.dark .topic-pill:hover {
    background: #333333;
}

/* ===== Section ===== */
/* Підпис над карткою — однаковий проміжок над ним і під ним (правило власника,
   20.10.2026): 14 від попередньої картки = 14 до своєї. */
.section {
    margin-bottom: 14px;
}

.section-title {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-header .section-title {
    margin-bottom: 0;
}

.section-action {
    font-size: 13px;
    color: #8849FE;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.section-action-icon {
    width: 14px;
    height: 14px;
}

.view-all {
    font-size: 13px;
    color: #8849FE;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-all-icon {
    width: 14px;
    height: 14px;
}

/* ===== Chat List ===== */
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    background: #FFFFFF;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--card-shadow);
}

.chat-item:hover {
    background: #F9FAFB;
}

body.dark .chat-item {
    background: #262626;
    box-shadow: var(--card-shadow);
}

body.dark .chat-item:hover {
    background: #333333;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: center/cover;
    flex-shrink: 0;
}

.chat-info {
    flex: 1;
    min-width: 0;
}

.chat-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

body.dark .chat-name {
    color: #e5e7eb;
}

.chat-message {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .chat-message {
    color: #9ca3af;
}

.chat-arrow {
    width: 16px;
    height: 16px;
    color: #9CA3AF;
    flex-shrink: 0;
}

/* ===== Rooms List ===== */
.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.room-item {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.room-item:hover {
    background: #F9FAFB;
}

body.dark .room-item {
    background: #262626;
}

body.dark .room-item:hover {
    background: #333333;
}

.room-icon {
    width: 18px;
    height: 18px;
    color: #3B82F6;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

body.dark .room-name {
    color: #e5e7eb;
}

.room-count {
    font-size: 11px;
    color: #10B981;
    margin-top: 2px;
}

.room-action {
    font-size: 12px;
    font-weight: 500;
    color: #3B82F6;
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-action-icon {
    width: 14px;
    height: 14px;
}

/* ===== AI Features ===== */
.ai-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #FFFFFF;
    border-radius: 12px;
}

body.dark .ai-item {
    background: #262626;
}

.ai-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-icon {
    width: 18px;
    height: 18px;
    color: #8849FE;
}

.ai-text {
    font-size: 13px;
    font-weight: 500;
    color: #111827;
}

body.dark .ai-text {
    color: #e5e7eb;
}

/* ===== Toggle Switch ===== */
.toggle {
    width: 38px;
    height: 20px;
    background: #D1D5DB;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle.active {
    background: #10B981;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle.active::after {
    transform: translateX(18px);
}

.toggle-switch {
    width: 48px;
    height: 28px;
    background: #D1D5DB;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: #10B981;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* ===== Premium Item ===== */
.premium-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px;
    background: linear-gradient(135deg, #8849FE 0%, #EC4899 100%);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(136, 73, 254, 0.25);
    text-decoration: none;
}

.premium-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(136, 73, 254, 0.35);
}

body.dark .premium-item {
    box-shadow: 0 2px 8px rgba(136, 73, 254, 0.3);
}

body.dark .premium-item:hover {
    box-shadow: 0 4px 12px rgba(136, 73, 254, 0.4);
}

.premium-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-icon {
    width: 20px;
    height: 20px;
    color: rgba(255, 255, 255, 0.95);
}

.premium-text-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.premium-text {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.98);
}

.premium-subtext {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

.premium-badge {
    background: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.95);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.premium-badge-icon {
    width: 12px;
    height: 12px;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 650px;
    /* Single source of truth: the centre block derives its square size from
       these two, so the bar height and the block can never drift apart. */
    --nav-h: 54px;
    --nav-inset: 5px;
    /* box-sizing is border-box globally, so the safe-area inset has to be added
       to the height as well or it would eat into the icons on notched phones. */
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    background: #FFFFFF;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    /* Five equal columns rather than flex + space-around. With flex the four
       labelled items shared the leftover width while the centre block kept a
       fixed one, so the gap next to the heart came out smaller than the gaps
       between the others. A grid gives every slot the same width, centre
       included, and the geometry stays even. */
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    justify-items: center;
    /* Was `0 20px`: the outer items sat too far from the screen edges. */
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    /* 101, не 100: рядок тепер іде в документі перед вмістом (bottom_nav.php), і рівні йому за z-index опинились би
       над ним; раніше він стояв останнім і перекривав їх порядком. */
    z-index: 101;
}

body.dark .bottom-nav {
    background: #1a1a1a;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    /* The menu entry is a <button>; strip the UA styling so it matches the links. */
    background: none;
    border: none;
    font: inherit;
    /* Fills its grid column, so every slot is the same width. */
    width: 100%;
    min-width: 0;
    padding: 0 2px;
}

.nav-icon {
    width: 21px;
    height: 21px;
    color: #9CA3AF;
    transition: color 0.2s;
}

.nav-item:hover .nav-icon {
    color: #6B7280;
}

.nav-item.active .nav-icon {
    color: #8849FE;
}

.nav-text {
    font-size: 10px;
    color: #9CA3AF;
    font-weight: 500;
}

.nav-item.active .nav-text {
    color: #8849FE;
}

/* Centre action (dating): a saturated raspberry block, no label.
   `align-self: stretch` opts out of the bar's vertical centring so the block
   spans the full height, and the 5px margin then insets it top and bottom —
   the same 5px rhythm used everywhere else. */
.nav-item.center {
    align-self: stretch;
    /* Square: stretch makes the height (bar − both insets), so the width is set
       to the same figure. It sits centred in its own grid column, so the space
       either side of it matches the space between the other items. */
    justify-self: center;
    width: calc(var(--nav-h, 54px) - var(--nav-inset, 5px) * 2);
    padding: 0;
    margin: var(--nav-inset, 5px) 0;
    gap: 0;
    justify-content: center;
    background: linear-gradient(135deg, #FF2D6E 0%, #E11D48 55%, #BE123C 100%);
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.32);
    transition: filter 0.2s, box-shadow 0.2s;
}

.nav-item.center:hover,
.nav-item.center.active {
    filter: brightness(1.06);
    box-shadow: 0 5px 14px rgba(225, 29, 72, 0.42);
}

.nav-item.center:active {
    filter: brightness(0.95);
}

/* NB: lucide REPLACES <i class="nav-icon"> with <svg class="nav-icon">, so
   .nav-icon is the svg itself — a `.nav-icon svg` selector matches nothing.
   lucide strokes with currentColor and leaves fill empty, so an outline heart
   only needs the colour set and fill kept at none. */
.nav-item.center .nav-icon {
    color: #fff;
    fill: none;
    stroke-width: 2;
}

.nav-item.center:hover .nav-icon,
.nav-item.center.active .nav-icon {
    color: #fff;
}

/* The centre label is the longest in the bar ("Знайомства"), so keep every
   label on one line and let it shrink rather than wrap the row. */
.nav-text {
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

@media (max-width: 360px) {
    .nav-text { font-size: 9px; }
}


/* Nav badge for notifications */
.nav-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-badge {
    position: absolute;
    top: -8px;
    left: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #EF4444;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}



/* ===== Profile Hero ===== */
.profile-hero {
    background: #FFFFFF;
    padding: 24px 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

body.dark .profile-hero {
    background: #1a1a1a;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: center/cover;
    border: 4px solid #8849FE;
    position: relative;
    margin-bottom: 16px;
    cursor: pointer;
}

.avatar-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    background: #10B981;
    border: 3px solid #FFFFFF;
    border-radius: 50%;
}

body.dark .avatar-badge {
    border-color: #1a1a1a;
}

.profile-name-main {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

body.dark .profile-name-main {
    color: #e5e7eb;
}

.verify-icon-main {
    width: 20px;
    height: 20px;
    color: #3B82F6;
}

.profile-username {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 12px;
}

body.dark .profile-username {
    color: #9ca3af;
}

.profile-stats-mini {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.stat-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #6B7280;
}

body.dark .stat-mini {
    color: #9ca3af;
}

.stat-icon-mini {
    width: 16px;
    height: 16px;
}

.profile-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}

.action-btn {
    flex: 1;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn-primary {
    background: #8849FE;
    color: white;
}

.action-btn-primary:hover {
    background: #7233E8;
}

.action-btn-secondary {
    background: #F3F4F6;
    color: #374151;
}

.action-btn-secondary:hover {
    background: #E5E7EB;
}

body.dark .action-btn-secondary {
    background: #262626;
    color: #9ca3af;
}

body.dark .action-btn-secondary:hover {
    background: #333333;
}

.action-btn-tertiary {
    background: transparent;
    color: #6B7280;
    border: 1px solid #E5E7EB;
    padding: 10px 12px;
    min-width: auto;
}

.action-btn-tertiary:hover {
    background: #F3F4F6;
}

body.dark .action-btn-tertiary {
    color: #9CA3AF;
    border-color: #374151;
}

body.dark .action-btn-tertiary:hover {
    background: #262626;
}

.action-btn-tertiary.friend-accept {
    color: #10B981;
    border-color: #10B981;
}

.action-icon {
    width: 16px;
    height: 16px;
}

/* ===== Content Area ===== */
/* Бічне поле центральної колонки — одна змінна (власник, 19.10.2026: «трохи
   менше відступи по боках», було 16px). Смуги на всю ширину колонки (меню,
   шапка каналу) виходять за поле саме на --content-x. */
.content {
    --content-x: 10px;
    padding: 0 var(--content-x) 16px;
}

@media (max-width: 1023px) {
    .content {
        padding: 16px var(--content-x);
    }
}

/* ===== Stats Row (Profile) ===== */
.stats-row {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px 16px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    box-shadow: var(--card-shadow);
}

.stat-box {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== Info Grid ===== */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.info-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    box-shadow: var(--card-shadow);
}

body.dark .info-card {
    box-shadow: var(--card-shadow);
}

.info-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-icon-wrapper.purple {
    background: rgba(136, 73, 254, 0.1);
}

.info-icon-wrapper.blue {
    background: rgba(59, 130, 246, 0.1);
}

.info-icon-wrapper.green {
    background: rgba(16, 185, 129, 0.1);
}

.info-icon-wrapper.orange {
    background: rgba(245, 158, 11, 0.1);
}

.info-icon {
    width: 20px;
    height: 20px;
}

.info-icon-wrapper.purple .info-icon {
    color: #8849FE;
}

.info-icon-wrapper.blue .info-icon {
    color: #3B82F6;
}

.info-icon-wrapper.green .info-icon {
    color: #10B981;
}

.info-icon-wrapper.orange .info-icon {
    color: #F59E0B;
}

.info-content {
    flex: 1;
    min-width: 0;
}

.info-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Section Card ===== */
.section-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow);
}

body.dark .section-card {
    box-shadow: var(--card-shadow);
}

/* ===== Bio ===== */
.bio-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Interests Tags ===== */
.interests-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.interest-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
}

/* ===== Badges Horizontal ===== */
.badges-horizontal {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.badges-horizontal::-webkit-scrollbar {
    display: none;
}

.badge-item {
    background: linear-gradient(135deg, #8849FE, #EC4899);
    border-radius: 12px;
    padding: 12px 16px;
    min-width: 120px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.badge-item:hover {
    transform: translateY(-2px);
}

.badge-item.locked {
    background: #E5E7EB;
}

body.dark .badge-item.locked {
    background: #262626;
}

.badge-icon-circle {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge-item.locked .badge-icon-circle {
    background: #D1D5DB;
}

body.dark .badge-item.locked .badge-icon-circle {
    background: #374151;
}

.badge-icon-small {
    width: 18px;
    height: 18px;
    color: white;
}

.badge-item.locked .badge-icon-small {
    color: #9CA3AF;
}

.badge-info {
    flex: 1;
    min-width: 0;
}

.badge-name-small {
    font-size: 13px;
    font-weight: 600;
    color: white;
    margin-bottom: 2px;
}

.badge-item.locked .badge-name-small {
    color: #6B7280;
}

body.dark .badge-item.locked .badge-name-small {
    color: #9ca3af;
}

.badge-desc-small {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.badge-item.locked .badge-desc-small {
    color: #9CA3AF;
}

/* ===== Gallery Grid ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gallery-photo {
    aspect-ratio: 1;
    border-radius: 12px;
    background: #F3F4F6;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-photo:hover {
    transform: scale(1.03);
}

.gallery-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-add {
    aspect-ratio: 1;
    border-radius: 12px;
    background: #F3F4F6;
    border: 2px dashed #D1D5DB;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.gallery-add:hover {
    background: #E5E7EB;
    border-color: #8849FE;
}

body.dark .gallery-add {
    background: #262626;
    border-color: #374151;
}

body.dark .gallery-add:hover {
    background: #333333;
    border-color: #8849FE;
}

.gallery-add-icon {
    width: 24px;
    height: 24px;
    color: #9CA3AF;
}

.gallery-add-text {
    font-size: 11px;
    color: #9CA3AF;
    font-weight: 500;
}

/* ===== Settings List ===== */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.setting-item {
    padding: 14px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity 0.2s;
    border-bottom: 1px solid #F3F4F6;
}

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

.setting-item:hover {
    opacity: 0.7;
}

body.dark .setting-item {
    border-bottom-color: #262626;
}

.setting-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.setting-icon-wrap.purple {
    background: rgba(136, 73, 254, 0.1);
}

.setting-icon-wrap.blue {
    background: rgba(59, 130, 246, 0.1);
}

.setting-icon-wrap.red {
    background: rgba(239, 68, 68, 0.1);
}

.setting-icon-wrap.green {
    background: rgba(16, 185, 129, 0.1);
}

.setting-icon-item {
    width: 18px;
    height: 18px;
}

.setting-icon-wrap.purple .setting-icon-item {
    color: #8849FE;
}

.setting-icon-wrap.blue .setting-icon-item {
    color: #3B82F6;
}

.setting-icon-wrap.red .setting-icon-item {
    color: #EF4444;
}

.setting-icon-wrap.green .setting-icon-item {
    color: #10B981;
}

.setting-text-wrap {
    flex: 1;
}

.setting-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

body.dark .setting-title {
    color: #e5e7eb;
}

.setting-desc {
    font-size: 12px;
    color: #6B7280;
}

body.dark .setting-desc {
    color: #9ca3af;
}

.setting-arrow {
    width: 16px;
    height: 16px;
    color: #9CA3AF;
}

.setting-item.logout .setting-title {
    color: #EF4444;
}

body.dark .setting-item.logout .setting-title {
    color: #FCA5A5;
}

/* ===== Settings Page ===== */
.settings-card {
    background: #FFFFFF;
    border-radius: 16px;
    overflow: hidden;
    /* Тінь — та сама, що в усіх блоків сайту (власник, 22.10.2026: «система тіней повинна бути всюди одна»). */
    box-shadow: var(--card-shadow);
}

body.dark .settings-card {
    background: #1a1a1a;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #F3F4F6;
}

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

.settings-item:hover {
    background: #F9FAFB;
}

body.dark .settings-item {
    border-bottom-color: #262626;
}

body.dark .settings-item:hover {
    background: #262626;
}

.settings-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Значок розділу — «склом», як у VIP і в «Інформації» (власник, 21.10.2026: «в налаштуваннях і всюди, де є
   розділи, стиль іконок — як тут»): суцільний колір, світлий відблиск згори, білий значок. Лише з кольором —
   .is-media (обличчя, картинка) лишається як є. */
.settings-icon-wrap:is(.purple, .blue, .green, .orange, .red, .gray, .pink) {
    color: #fff;
    background-color: var(--sw-c);
    background-image: linear-gradient(160deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, 0) 62%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.settings-icon-wrap.purple { --sw-c: #8849FE; }
.settings-icon-wrap.blue { --sw-c: #3B82F6; }
.settings-icon-wrap.green { --sw-c: #10B981; }
.settings-icon-wrap.orange { --sw-c: #FF9500; }
.settings-icon-wrap.red { --sw-c: #F5433F; }
.settings-icon-wrap.gray { --sw-c: #8E8E93; }
.settings-icon-wrap.pink { --sw-c: #EC4899; }

.settings-icon {
    width: 20px;
    height: 20px;
}

.settings-icon-wrap:is(.purple, .blue, .green, .orange, .red, .gray, .pink) .settings-icon {
    color: #fff;
}

.settings-content {
    flex: 1;
    min-width: 0;
}

.settings-label {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

body.dark .settings-label {
    color: #e5e7eb;
}

.settings-desc {
    font-size: 12px;
    color: #6B7280;
}

body.dark .settings-desc {
    color: #9ca3af;
}

.settings-value {
    font-size: 14px;
    color: #6B7280;
    flex-shrink: 0;
}

body.dark .settings-value {
    color: #9ca3af;
}

.settings-arrow {
    width: 18px;
    height: 18px;
    color: #9CA3AF;
    flex-shrink: 0;
}

/* The profile page builds its rows out of anchors, the settings page out of
   divs — strip the link styling so the two read identically. */
a.settings-item {
    text-decoration: none;
    color: inherit;
}

.settings-item.logout .settings-label {
    color: #EF4444;
}

body.dark .settings-item.logout .settings-label {
    color: #FCA5A5;
}

/* Badge */
.badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.badge.premium {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
}

.badge.new {
    background: #10B981;
    color: white;
}

/* Profile Card (Settings) */
.profile-card {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

body.dark .profile-card {
    background: #1a1a1a;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: center/cover;
    border: 3px solid #8849FE;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

body.dark .profile-name {
    color: #e5e7eb;
}

.verify-icon {
    width: 16px;
    height: 16px;
    color: #3B82F6;
}

.profile-email {
    font-size: 13px;
    color: #6B7280;
}

body.dark .profile-email {
    color: #9ca3af;
}

.profile-edit {
    width: 40px;
    height: 40px;
    background: rgba(136, 73, 254, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.profile-edit:hover {
    background: rgba(136, 73, 254, 0.2);
    transform: scale(1.05);
}

.profile-edit-icon {
    width: 18px;
    height: 18px;
    color: #8849FE;
}

/* ===== Rooms Page ===== */
.search-container {
    padding: 12px 16px 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 8px 14px;
    transition: all 0.2s;
}

.search-bar:focus-within {
    border-color: #3B82F6;
    background: white;
}

body.dark .search-bar {
    background: #262626;
    border-color: #333333;
}

body.dark .search-bar:focus-within {
    border-color: #3B82F6;
    background: #262626;
}

.search-icon {
    width: 18px;
    height: 18px;
    color: #9CA3AF;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #111827;
}

.search-bar input::placeholder {
    color: #9CA3AF;
}

body.dark .search-bar input {
    color: #e5e7eb;
}

body.dark .search-bar input::placeholder {
    color: #6b7280;
}

.create-btn {
    width: 40px;
    height: 40px;
    background: #8849FE;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    border: none;
}

.create-btn:hover {
    background: #7233E8;
    transform: translateY(-1px);
}

.create-icon {
    width: 20px;
    height: 20px;
    color: white;
}

/* Stats Section */
.stats-section {
    padding: 8px 16px 12px;
}

.stats-mini {
    display: flex;
    gap: 8px;
}

.stat-mini-card {
    flex: 1;
    background: #FFFFFF;
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark .stat-mini-card {
    background: #262626;
}

.stat-mini-icon {
    width: 18px;
    height: 18px;
    color: #8849FE;
}

.stat-mini-text {
    font-size: 12px;
    font-weight: 600;
    color: #111827;
}

body.dark .stat-mini-text {
    color: #e5e7eb;
}

/* Filters live further down — this used to be a second copy of the same
   selectors, whose body.dark rules outweighed anything the later block
   said about them. */

/* Popular Rooms */
.popular-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.popular-room {
    position: relative;
    background: #FFFFFF;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    gap: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.popular-room:hover {
    background: #F9FAFB;
    transform: translateY(-1px);
}

body.dark .popular-room {
    background: #262626;
}

body.dark .popular-room:hover {
    background: #2d2d2d;
}

.popular-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 8px;
}

.popular-icon-wrapper {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #8849FE, #EC4899);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.popular-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.popular-content {
    flex: 1;
}

.popular-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

body.dark .popular-name {
    color: #e5e7eb;
}

.popular-desc {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
}

body.dark .popular-desc {
    color: #9ca3af;
}

.popular-stats {
    display: flex;
    gap: 12px;
}

.popular-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6B7280;
}

.popular-stat.users {
    color: #8849FE;
    font-weight: 600;
}

body.dark .popular-stat.users {
    color: #A97AFF;
}

.popular-stat.active {
    color: #10B981;
    font-weight: 600;
}

body.dark .popular-stat.active {
    color: #34D399;
}

body.dark .popular-stat {
    color: #9ca3af;
}

.popular-stat-icon {
    width: 14px;
    height: 14px;
}

/* Room Cards */
.rooms-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-card {
    /* Картка — посилання цілком: без підкреслення й синього кольору,
       текст успадковує колір картки. */
    text-decoration: none;
    color: inherit;
    background: #FFFFFF;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 12px;
    box-shadow: var(--card-shadow);
}

.room-card:hover {
    background: #F9FAFB;
}

body.dark .room-card {
    background: #262626;
    box-shadow: var(--card-shadow);
}

body.dark .room-card:hover {
    background: #2d2d2d;
}

.room-icon-wrapper {
    width: 48px;
    height: 48px;
    background: #EDE9FE;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.dark .room-icon-wrapper {
    background: #3B2763;
}

.room-card-icon {
    width: 24px;
    height: 24px;
    color: #8849FE;
}

.room-card-info {
    flex: 1;
    min-width: 0;
}

.room-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.room-card-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

body.dark .room-card-name {
    color: #e5e7eb;
}

.room-badge {
    background: #10B981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.room-badge.new {
    background: #3B82F6;
}

.room-badge.vip {
    background: #F59E0B;
}

.room-desc {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .room-desc {
    color: #9ca3af;
}

.room-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-stats-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6B7280;
}

.room-stats-item.users {
    color: #8849FE;
    font-weight: 600;
}

body.dark .room-stats-item.users {
    color: #A97AFF;
}

.room-stats-item.active {
    color: #10B981;
    font-weight: 600;
}

body.dark .room-stats-item.active {
    color: #34D399;
}

body.dark .room-stats-item {
    color: #9CA3AF;
}

.room-stats-icon {
    width: 14px;
    height: 14px;
}

.room-enter {
    align-self: center;
    flex-shrink: 0;
}

.enter-btn {
    background: #8849FE;
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.enter-btn:hover {
    background: #7233E8;
}

.enter-icon {
    width: 14px;
    height: 14px;
}

/* ===== Modal =====
   Кістяк модалки живе в includes/components/action_sheet.php — там же, де
   її вигляд. Тут його немає навмисно: main.css не читають ні кімната, ні
   особистий діалог, і однакові з вигляду модалки поводилися в них
   по-різному. Компонент є на кожній сторінці — його підключає шапка. */

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

body.dark .form-label {
    color: #d1d5db;
}

.form-input,
.form-textarea,
.modal-input,
.modal-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    color: #111827;
    background: #FFFFFF;
    transition: border-color 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

body.dark .form-input,
body.dark .form-textarea,
body.dark .modal-input,
body.dark .modal-textarea {
    background: #262626;
    border-color: #374151;
    color: #e5e7eb;
}

.form-input:focus,
.form-textarea:focus,
.modal-input:focus,
.modal-textarea:focus {
    outline: none;
    border-color: #8849FE;
}

.form-textarea,
.modal-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: #9CA3AF;
}

.form-hint::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #D1D5DB;
    border-radius: 50%;
    flex-shrink: 0;
}

body.dark .form-hint {
    color: #6B7280;
}

body.dark .form-hint::before {
    background: #4B5563;
}

.form-error {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: #EF4444;
}

.form-error::before {
    content: '!';
    width: 16px;
    height: 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
}

.form-input.error,
.form-textarea.error {
    border-color: #F87171;
    background: rgba(254, 202, 202, 0.1);
}

.form-input.error:focus,
.form-textarea.error:focus {
    border-color: #EF4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

body.dark .form-input.error,
body.dark .form-textarea.error {
    border-color: #F87171;
    background: rgba(239, 68, 68, 0.1);
}

/* Password toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #9CA3AF;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #6B7280;
}

.password-toggle svg,
.password-toggle i[data-lucide] {
    width: 20px;
    height: 20px;
}

body.dark .password-toggle {
    color: #6B7280;
}

body.dark .password-toggle:hover {
    color: #9CA3AF;
}

/* Chips */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: #F3F4F6;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.chip:hover {
    background: #E5E7EB;
}

body.dark .chip {
    background: #374151;
    color: #d1d5db;
}

body.dark .chip:hover {
    background: #4B5563;
}

.chip.selected {
    background: #8849FE;
    color: white;
    border-color: #8849FE;
}

.chip.selected:hover {
    background: #7233E8;
    border-color: #7233E8;
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    outline: none;
    -webkit-appearance: none;
}

body.dark .slider {
    background: #374151;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8849FE;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8849FE;
    cursor: pointer;
    border: none;
}

body.dark .slider::-webkit-slider-thumb {
    background: #8849FE;
}

.slider-value {
    font-size: 14px;
    font-weight: 600;
    color: #8849FE;
    min-width: 40px;
    text-align: right;
}

/* Switch */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #D1D5DB;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.switch.active {
    background: #10B981;
}

.switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.switch.active::after {
    transform: translateX(20px);
}

/* Interests Selection */
.interests-selection {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.interest-selectable {
    background: #F3F4F6;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

body.dark .interest-selectable {
    background: #262626;
    color: #d1d5db;
}

.interest-selectable:hover {
    background: #E5E7EB;
}

body.dark .interest-selectable:hover {
    background: #333333;
}

.interest-selectable.selected {
    background: #8849FE;
    color: white;
    border-color: #8849FE;
}

.interest-selectable.selected:hover {
    background: #7233E8;
    border-color: #7233E8;
}

/* Avatar Options - Clean List Style */
.avatar-options {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-secondary, #F5F5F5);
    border-radius: 12px;
    overflow: hidden;
}

body.dark .avatar-options {
    background: #2a2a2a;
}

.avatar-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: background 0.15s;
}

.avatar-option:last-child {
    border-bottom: none;
}

body.dark .avatar-option {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.avatar-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.dark .avatar-option:hover {
    background: rgba(255, 255, 255, 0.06);
}

.avatar-option:active {
    background: rgba(0, 0, 0, 0.08);
}

.avatar-option-icon {
    width: 22px;
    height: 22px;
    color: var(--accent-color, #8849FE);
    flex-shrink: 0;
}

.avatar-option.danger .avatar-option-icon {
    color: #EF4444;
}

.avatar-option-title {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary, #1a1a1a);
}

body.dark .avatar-option-title {
    color: #f0f0f0;
}

.avatar-option.danger .avatar-option-title {
    color: #EF4444;
}

body.dark .avatar-option.danger .avatar-option-title {
    color: #F87171;
}

.avatar-option-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-tertiary, #999);
    flex-shrink: 0;
}

/* Legacy support - hide unused elements */
.avatar-option-icon-wrap,
.avatar-option-text,
.avatar-option-desc {
    display: none;
}

/* Logout/Delete Modal Content */
.logout-modal-content,
.delete-modal-content {
    text-align: center;
    padding: 20px 0;
}

.logout-icon-wrapper,
.delete-icon-wrapper {
    width: 80px;
    height: 80px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.logout-icon-big,
.delete-icon-big {
    width: 40px;
    height: 40px;
    color: #EF4444;
}

.logout-modal-title,
.delete-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

body.dark .logout-modal-title,
body.dark .delete-modal-title {
    color: #e5e7eb;
}

.logout-modal-desc,
.delete-modal-desc {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
}

body.dark .logout-modal-desc,
body.dark .delete-modal-desc {
    color: #9ca3af;
}

/* Language Options */
.language-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.language-option {
    padding: 16px 0;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    opacity: 0.7;
}

body.dark .language-option {
    border-bottom-color: #262626;
}

.language-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

body.dark .language-name {
    color: #e5e7eb;
}

.language-check {
    width: 20px;
    height: 20px;
    color: #8849FE;
}

/* ===== Auth Pages ===== */
.auth-container {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px 16px;
    max-width: 400px;
    margin: 0 auto;
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 40px;
    margin-bottom: 32px;
}

@media (min-height: 800px) {
    .auth-logo {
        margin-top: 60px;
    }
}

.logo-text {
    font-size: 2.25rem;
    font-weight: 700;
    color: #1F2937;
    font-family: 'Inter', 'ReeUI', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -1px;
}

.logo-text-accent {
    font-size: 2.25rem;
    font-weight: 700;
    color: #8849FE;
    font-family: 'Inter', 'ReeUI', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    letter-spacing: -1px;
}

body.dark .logo-text {
    color: #F9FAFB;
}

body.dark .logo-text-accent {
    color: #A97AFF;
}

.auth-card {
    background: #FFFFFF;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark .auth-card {
    background: #1a1a1a;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
    color: #111827;
}

body.dark .auth-title {
    color: #e5e7eb;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: #6B7280;
}

body.dark .auth-footer {
    color: #9ca3af;
}

.auth-footer a {
    color: #8849FE;
    font-weight: 500;
}

/* Language Switcher */
.lang-switcher {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #FFFFFF;
    border-radius: 12px;
    text-decoration: none;
    color: #6B7280;
    font-size: 13px;
    transition: all 0.2s;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.lang-btn:hover {
    background: #F9FAFB;
    border-color: #8849FE;
    color: #8849FE;
}

.lang-btn.active {
    background: rgba(136, 73, 254, 0.1);
    color: #8849FE;
    border-color: #8849FE;
}

.lang-flag {
    display: flex;
    align-items: center;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.lang-flag svg {
    display: block;
}

.lang-name {
    font-weight: 500;
}

/* Mobile: hide text, show only flags */
@media (max-width: 400px) {
    .lang-switcher {
        flex-wrap: nowrap;
    }

    .lang-btn {
        padding: 10px 12px;
        gap: 0;
    }

    .lang-name {
        display: none;
    }
}

body.dark .lang-btn {
    background: #262626;
    border-color: #3d3d3d;
    color: #9CA3AF;
}

body.dark .lang-btn:hover {
    background: #333333;
    border-color: #8849FE;
    color: #A97AFF;
}

body.dark .lang-btn.active {
    background: rgba(136, 73, 254, 0.15);
    color: #A97AFF;
    border-color: #8849FE;
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-checkbox .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.custom-checkbox:hover .checkmark {
    border-color: #8849FE;
}

.custom-checkbox input:checked~.checkmark {
    background: #8849FE;
    border-color: #8849FE;
}

.custom-checkbox input:checked~.checkmark::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.custom-checkbox .checkbox-label {
    font-size: 14px;
    color: #6B7280;
}

body.dark .custom-checkbox .checkmark {
    border-color: #4B5563;
    background: transparent;
}

body.dark .custom-checkbox:hover .checkmark {
    border-color: #8849FE;
}

body.dark .custom-checkbox input:checked~.checkmark {
    background: #8849FE;
    border-color: #8849FE;
}

body.dark .custom-checkbox .checkbox-label {
    color: #9CA3AF;
}

/* Form Row Between */
.form-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.forgot-link {
    font-size: 14px;
    color: #8849FE;
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* Social Proof Block */
.auth-social-proof {
    margin-top: 32px;
    padding: 24px 20px;
    background: #FFFFFF;
    border-radius: 16px;
    text-align: center;
    border: 1px solid #E5E7EB;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark .auth-social-proof {
    background: #1a1a1a;
    border-color: #2d2d2d;
}

.social-proof-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px 0;
    line-height: 1.4;
}

body.dark .social-proof-title {
    color: #F3F4F6;
}

.social-proof-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    padding-bottom: 16px;
    border-bottom: 1px solid #E5E7EB;
}

body.dark .social-proof-subtitle {
    color: #9CA3AF;
    border-bottom-color: #3d3d3d;
}

.social-proof-avatars {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    margin-top: 16px;
}

.social-proof-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid #FFFFFF;
    margin-left: -12px;
    object-fit: cover;
    background: #E5E7EB;
}

.social-proof-avatar:first-child {
    margin-left: 0;
}

body.dark .social-proof-avatar {
    border-color: #1a1a1a;
    background: #262626;
}

.social-proof-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3B82F6, #8849FE);
    color: white;
    font-size: 12px;
    font-weight: 700;
    margin-left: -12px;
    border: 3px solid #FFFFFF;
}

body.dark .social-proof-more {
    border-color: #1a1a1a;
}

.social-proof-text {
    color: #3B82F6;
    font-size: 14px;
    margin: 0;
    font-weight: 600;
}

body.dark .social-proof-text {
    color: #60A5FA;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    text-decoration: none;
    font-size: 14px;
}

.btn-primary {
    background: #8849FE;
    color: white;
}

.btn-primary:hover {
    background: #7233E8;
}

.btn-block {
    width: 100%;
}

.btn svg,
.btn i[data-lucide] {
    width: 20px;
    height: 20px;
    /* Значок у кнопці не стискається: у «Ви підписані» з довгим текстом
       галочка мала 7 px завширшки (власник, 19.10.2026). */
    flex-shrink: 0;
}

/* ===== Messages ===== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.message.own {
    align-self: flex-end;
}

.message.other {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.own .message-bubble {
    background: #8849FE;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.other .message-bubble {
    background: #FFFFFF;
    color: #111827;
    border-bottom-left-radius: 4px;
}

body.dark .message.other .message-bubble {
    background: #262626;
    color: #e5e7eb;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 4px;
    padding: 0 4px;
}

.message.own .message-meta {
    justify-content: flex-end;
}

/* Chat Input */
.chat-input-container {
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
    padding: 12px 16px;
}

body.dark .chat-input-container {
    background: #1a1a1a;
    border-top-color: #262626;
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.chat-input {
    flex: 1;
    max-height: 120px;
    padding: 10px 14px;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    resize: none;
    overflow-y: auto;
    font-size: 14px;
    color: #111827;
}

body.dark .chat-input {
    background: #262626;
    border-color: #374151;
    color: #e5e7eb;
}

.chat-input:focus {
    outline: none;
    border-color: #8849FE;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: #8849FE;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
}

.chat-send-btn:hover {
    background: #7233E8;
}

.chat-send-btn svg,
.chat-send-btn i[data-lucide] {
    width: 20px;
    height: 20px;
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ===== Dialog Page Layout (Chat/Room) ===== */
body.dialog-page {
    height: 100vh;
    overflow: hidden;
}

body.dialog-page .container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 0;
    background: #FFFFFF;
}

body.dark.dialog-page .container {
    background: #1a1a1a;
}

/* Dialog Header */
.dialog-header {
    height: 64px;
    background: #FFFFFF;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-shrink: 0;
    z-index: 100;
    gap: 10px;
}

body.dark .dialog-header {
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dialog-header .back-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #F3F4F6;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    text-decoration: none;
}

.dialog-header .back-btn:hover {
    background: #E5E7EB;
}

body.dark .dialog-header .back-btn {
    background: #262626;
}

body.dark .dialog-header .back-btn:hover {
    background: #333333;
}

/* User info in dialog header */
.user-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.user-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.online-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background: #10B981;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
}

body.dark .online-badge {
    border-color: #1a1a1a;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .user-name {
    color: #e5e7eb;
}

.user-status {
    font-size: 12px;
    color: #6B7280;
}

body.dark .user-status {
    color: #9ca3af;
}

.user-status.online {
    color: #10B981;
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #F3F4F6;
}

body.dark .header-btn:hover {
    background: #262626;
}

.header-btn-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
}

body.dark .header-btn-icon {
    color: #9ca3af;
}

/* Messages container */
.dialog-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #F9FAFB;
}

body.dark .dialog-messages {
    background: #0f0f0f;
}

/* Message styles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.message.own {
    align-self: flex-end;
}

.message.other,
.message.them {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
}

.message.other .message-bubble,
.message.them .message-bubble {
    background: #FFFFFF;
    color: #111827;
    border-bottom-left-radius: 4px;
}

body.dark .message.other .message-bubble,
body.dark .message.them .message-bubble {
    background: #262626;
    color: #e5e7eb;
}

.message.own .message-bubble {
    background: #8849FE;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 0 4px;
}

.message.own .message-meta {
    justify-content: flex-end;
}

.message-time {
    font-size: 10px;
    color: #9CA3AF;
}

.message-status {
    display: flex;
    align-items: center;
}

.message-status svg,
.message-status i[data-lucide] {
    width: 14px;
    height: 14px;
    color: #9CA3AF;
}

.message-status.read svg {
    color: #3B82F6;
}

/* Room message username */
.message-username {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #8849FE;
}

.message-username.color-1 {
    color: #8849FE;
}

.message-username.color-2 {
    color: #EC4899;
}

.message-username.color-3 {
    color: #3B82F6;
}

.message-username.color-4 {
    color: #10B981;
}

.message-username.color-5 {
    color: #F59E0B;
}

.message-username.color-6 {
    color: #EF4444;
}

/* Date Separator */
.date-separator {
    text-align: center;
    padding: 12px 0;
}

.date-separator-text {
    font-size: 12px;
    color: #9CA3AF;
    background: #F9FAFB;
    padding: 4px 12px;
    border-radius: 12px;
}

body.dark .date-separator-text {
    background: #1a1a1a;
    color: #6B7280;
}

/* System message */
.system-message {
    text-align: center;
    font-size: 12px;
    color: #9CA3AF;
    padding: 8px 0;
}

/* Empty messages state */
.empty-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.empty-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin-bottom: 16px;
    border: 3px solid #8849FE;
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

body.dark .empty-title {
    color: #e5e7eb;
}

.empty-text {
    font-size: 13px;
    color: #6B7280;
}

body.dark .empty-text {
    color: #9ca3af;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.typing-indicator.active {
    display: flex;
}

.typing-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.typing-bubble {
    background: #FFFFFF;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

body.dark .typing-bubble {
    background: #262626;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #8849FE;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Input Container */
.input-container {
    padding: 12px 16px;
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
    flex-shrink: 0;
}

body.dark .input-container {
    background: #1a1a1a;
    border-top-color: #262626;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: #F3F4F6;
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
}

body.dark .input-wrapper {
    background: #262626;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #111827;
    resize: none;
    max-height: 120px;
    min-height: 24px;
    line-height: 1.4;
    font-family: inherit;
}

body.dark .message-input {
    color: #e5e7eb;
}

.message-input::placeholder {
    color: #9CA3AF;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #8849FE;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #7233E8;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
    transform: none;
}

body.dark .send-btn:disabled {
    background: #374151;
}

.send-icon {
    width: 20px;
    height: 20px;
    color: white;
}

/* Input action buttons */
.input-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.input-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark .input-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.input-action-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
}

body.dark .input-action-icon {
    color: #9ca3af;
}

/* ===== Room Dialog Specific ===== */
.room-header-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    cursor: pointer;
}

.room-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.room-avatar-icon {
    width: 16px;
    height: 16px;
    color: white;
}

.room-header-text {
    flex: 1;
    min-width: 0;
}

.room-header-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .room-header-name {
    color: #e5e7eb;
}

.room-header-status {
    font-size: 11px;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot-small {
    width: 5px;
    height: 5px;
    background: #10B981;
    border-radius: 50%;
}

/* Dropdown Menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 160px;
    z-index: 200;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

body.dark .dropdown-menu {
    background: #262626;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #374151;
}

.dropdown-item:hover {
    background: #F3F4F6;
}

body.dark .dropdown-item {
    color: #d1d5db;
}

body.dark .dropdown-item:hover {
    background: #333333;
}

.dropdown-item.danger {
    color: #EF4444;
}

.dropdown-icon {
    width: 16px;
    height: 16px;
}

/* Action Menu in Modal */
.action-menu {
    padding: 8px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.action-item:hover {
    background: #F3F4F6;
}

body.dark .action-item:hover {
    background: #262626;
}

.action-item.danger {
    color: #EF4444;
}

.action-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark .action-icon-wrapper {
    background: #262626;
}

.action-item.danger .action-icon-wrapper {
    background: rgba(239, 68, 68, 0.1);
}

.action-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
}

body.dark .action-icon {
    color: #9ca3af;
}

.action-item.danger .action-icon {
    color: #EF4444;
}

.action-text {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

body.dark .action-text {
    color: #e5e7eb;
}

.action-item.danger .action-text {
    color: #EF4444;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===== Attach Menu (Room) ===== */
.attach-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-end;
    z-index: 300;
    animation: fadeIn 0.2s ease-out;
}

.attach-menu-overlay.active {
    display: flex;
}

.attach-menu {
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 4px;
    animation: slideUp 0.3s ease-out;
}

body.dark .attach-menu {
    background: #1f1f1f;
}

.attach-menu-header {
    padding: 0 0 16px 0;
    text-align: center;
}

.attach-menu-handle {
    width: 36px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    margin: 0 auto 12px;
}

body.dark .attach-menu-handle {
    background: #374151;
}

.attach-menu-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

body.dark .attach-menu-title {
    color: #e5e7eb;
}

.attach-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.attach-menu-item:hover {
    background: #F3F4F6;
}

body.dark .attach-menu-item:hover {
    background: #333333;
}

.attach-menu-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attach-menu-icon-wrapper.file {
    background: rgba(59, 130, 246, 0.1);
}

.attach-menu-icon-wrapper.poll {
    background: rgba(136, 73, 254, 0.1);
}

.attach-menu-icon-wrapper.location {
    background: rgba(16, 185, 129, 0.1);
}

.attach-menu-icon {
    width: 20px;
    height: 20px;
}

.attach-menu-icon-wrapper.file .attach-menu-icon {
    color: #3B82F6;
}

.attach-menu-icon-wrapper.poll .attach-menu-icon {
    color: #8849FE;
}

.attach-menu-icon-wrapper.location .attach-menu-icon {
    color: #10B981;
}

.attach-menu-text {
    flex: 1;
}

.attach-menu-item-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2px;
}

body.dark .attach-menu-item-title {
    color: #e5e7eb;
}

.attach-menu-desc {
    font-size: 11px;
    color: #6B7280;
}

body.dark .attach-menu-desc {
    color: #9ca3af;
}

/* ===== Reply Preview ===== */
.reply-preview {
    display: none;
    background: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
    padding: 10px 14px;
    border-left: 3px solid var(--primary);
}

.reply-preview.active {
    display: block;
}

body.dark .reply-preview {
    background: #262626;
}

.reply-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.reply-preview-name {
    font-size: 12px;
    font-weight: 600;
    color: #8849FE;
}

.reply-preview-close {
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    color: #6B7280;
}

.reply-preview-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark .reply-preview-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.reply-preview-text {
    font-size: 13px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .reply-preview-text {
    color: #9ca3af;
}

/* ===== Message Reactions ===== */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(136, 73, 254, 0.1);
    border-radius: 12px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.reaction:hover {
    background: rgba(136, 73, 254, 0.2);
}

.reaction.active {
    background: #8849FE;
    color: white;
}

body.dark .reaction {
    background: rgba(255, 255, 255, 0.1);
}

body.dark .reaction:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Voice Recording Overlay ===== */
.voice-recording-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 400;
}

.voice-recording-overlay.active {
    display: flex;
}

.voice-recording-animation {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8849FE, #EC4899);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    animation: voicePulse 1.5s ease-in-out infinite;
}

@keyframes voicePulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.voice-recording-icon {
    width: 48px;
    height: 48px;
    color: white;
}

.voice-recording-timer {
    font-size: 32px;
    font-weight: 600;
    color: white;
    margin-bottom: 12px;
}

.voice-recording-hint {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 32px;
}

.voice-recording-actions {
    display: flex;
    gap: 20px;
}

.voice-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.voice-action-btn:hover {
    transform: scale(1.1);
}

.voice-action-btn.cancel {
    background: rgba(239, 68, 68, 0.2);
}

.voice-action-btn.send {
    background: #10B981;
}

.voice-action-icon {
    width: 24px;
    height: 24px;
}

.voice-action-btn.cancel .voice-action-icon {
    color: #EF4444;
}

.voice-action-btn.send .voice-action-icon {
    color: white;
}

/* ===== Poll Modal ===== */
.poll-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.poll-modal.active {
    display: flex;
}

.poll-modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

body.dark .poll-modal-content {
    background: #1f1f1f;
}

.poll-modal-header {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

body.dark .poll-modal-header {
    border-bottom-color: #374151;
}

.poll-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

body.dark .poll-modal-title {
    color: #e5e7eb;
}

.poll-modal-body {
    padding: 20px;
}

.poll-input-group {
    margin-bottom: 20px;
}

.poll-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

body.dark .poll-label {
    color: #9ca3af;
}

.poll-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    color: #111827;
    background: white;
    transition: border-color 0.2s;
}

.poll-input:focus {
    outline: none;
    border-color: #8849FE;
}

body.dark .poll-input {
    background: #262626;
    border-color: #374151;
    color: #e5e7eb;
}

.poll-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.poll-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.poll-option-input {
    flex: 1;
}

.poll-remove-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #FEE2E2;
    color: #EF4444;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.poll-remove-btn:hover {
    background: #FECACA;
}

body.dark .poll-remove-btn {
    background: rgba(239, 68, 68, 0.2);
}

.poll-add-btn {
    width: 100%;
    padding: 12px;
    border: 2px dashed #E5E7EB;
    background: transparent;
    color: #8849FE;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    margin-top: 12px;
}

.poll-add-btn:hover {
    border-color: #8849FE;
    background: rgba(136, 73, 254, 0.05);
}

body.dark .poll-add-btn {
    border-color: #374151;
    color: #A97AFF;
}

.poll-settings {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
}

body.dark .poll-settings {
    border-top-color: #374151;
}

.poll-checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.poll-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.poll-checkbox-label {
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

body.dark .poll-checkbox-label {
    color: #9ca3af;
}

.poll-modal-footer {
    padding: 20px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
}

body.dark .poll-modal-footer {
    border-top-color: #374151;
}

.poll-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.poll-btn-cancel {
    background: #F3F4F6;
    color: #374151;
}

.poll-btn-cancel:hover {
    background: #E5E7EB;
}

body.dark .poll-btn-cancel {
    background: #262626;
    color: #9ca3af;
}

.poll-btn-send {
    background: #8849FE;
    color: white;
}

.poll-btn-send:hover {
    background: #7233E8;
}

/* ===== Reaction Picker ===== */
.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border-radius: 20px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 8px;
    animation: popIn 0.2s;
    z-index: 10;
}

.message.own .reaction-picker,
.message.me .reaction-picker {
    left: auto;
    right: 0;
}

.reaction-picker.active {
    display: flex;
}

body.dark .reaction-picker {
    background: #262626;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.reaction-option {
    font-size: 20px;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 4px;
}

.reaction-option:hover {
    transform: scale(1.3);
}

.reply-option {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(136, 73, 254, 0.1);
    border-radius: 50%;
}

.reply-option:hover {
    background: rgba(136, 73, 254, 0.2);
}

/* ===== Reply Bar ===== */
.reply-bar {
    background: #F3F4F6;
    border-top: 1px solid #E5E7EB;
    padding: 8px 16px;
    display: none;
    align-items: center;
    gap: 12px;
}

body.dark .reply-bar {
    background: #262626;
    border-top-color: #374151;
}

.reply-bar.active {
    display: flex;
}

.reply-bar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.reply-bar-author {
    font-size: 12px;
    font-weight: 600;
    color: #8849FE;
}

body.dark .reply-bar-author {
    color: #A97AFF;
}

.reply-bar-text {
    font-size: 12px;
    color: #6B7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .reply-bar-text {
    color: #9ca3af;
}

.reply-bar-close {
    width: 20px;
    height: 20px;
    color: #6B7280;
    cursor: pointer;
    transition: color 0.2s;
    flex-shrink: 0;
}

.reply-bar-close:hover {
    color: #111827;
}

body.dark .reply-bar-close:hover {
    color: #e5e7eb;
}

/* ===== Reply Block in Message ===== */
.reply-block {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #8849FE;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.reply-block:hover {
    background: rgba(0, 0, 0, 0.08);
}

body.dark .reply-block {
    background: rgba(255, 255, 255, 0.05);
}

.message.own .reply-block,
.message.me .reply-block {
    background: rgba(255, 255, 255, 0.2);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.reply-author {
    font-size: 12px;
    font-weight: 600;
    color: #8849FE;
    margin-bottom: 2px;
}

.message.own .reply-author,
.message.me .reply-author {
    color: rgba(255, 255, 255, 0.9);
}

.reply-text {
    font-size: 12px;
    color: #6B7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

body.dark .reply-text {
    color: #9ca3af;
}

.message.own .reply-text,
.message.me .reply-text {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== Room Chat Header ===== */
.chat-header {
    height: 56px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    flex-shrink: 0;
}

body.dark .chat-header {
    background: #1a1a1a;
    border-bottom-color: #262626;
}

.chat-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

body.dark .room-name {
    color: #e5e7eb;
}

.room-status {
    font-size: 11px;
    color: #10B981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ===== Search Modal ===== */
.search-modal {
    background: white;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 650px;
    padding: 0;
    animation: slideUp 0.3s ease-out;
    max-height: 70vh;
    overflow-y: auto;
}

body.dark .search-modal {
    background: #262626;
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

body.dark .search-modal-header {
    background: #262626;
    border-bottom-color: #374151;
}

.search-modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

body.dark .search-modal-title {
    color: #e5e7eb;
}

.close-icon {
    width: 20px;
    height: 20px;
    color: #6B7280;
}

.close-icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.close-icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark .close-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.search-input-wrapper {
    position: relative;
    padding: 16px 20px;
    background: white;
}

body.dark .search-input-wrapper {
    background: #262626;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    color: #111827;
    background: white;
}

body.dark .search-input {
    background: #1a1a1a;
    border-color: #374151;
    color: #e5e7eb;
}

.search-input:focus {
    border-color: #8849FE;
}

.search-icon {
    position: absolute;
    right: 32px;
    top: 28px;
    width: 18px;
    height: 18px;
    color: #9CA3AF;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    padding: 0 20px 20px;
}

.search-result-item {
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #374151;
}

.search-result-item:hover {
    background: #F9FAFB;
}

body.dark .search-result-item {
    color: #d1d5db;
}

body.dark .search-result-item:hover {
    background: #1a1a1a;
}

/* ===== Message Username Colors (Room) ===== */
.message-username[data-user="1"] {
    color: #EF4444;
}

.message-username[data-user="2"] {
    color: #F59E0B;
}

.message-username[data-user="3"] {
    color: #10B981;
}

.message-username[data-user="4"] {
    color: #3B82F6;
}

.message-username[data-user="5"] {
    color: #8849FE;
}

.message-username[data-user="6"] {
    color: #EC4899;
}

/* ===== Voice Recording Modal (Room Style) ===== */
.voice-recording-modal {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    animation: popIn 0.3s;
}

body.dark .voice-recording-modal {
    background: #262626;
}

.voice-recording-modal .voice-recording-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #8849FE;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(136, 73, 254, 0.7);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(136, 73, 254, 0);
    }
}

.voice-recording-modal .voice-recording-icon svg,
.voice-recording-modal .voice-recording-icon i[data-lucide] {
    width: 40px;
    height: 40px;
    color: white;
}

.voice-recording-time {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 10px;
}

body.dark .voice-recording-time {
    color: #e5e7eb;
}

.voice-recording-text {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 20px;
}

body.dark .voice-recording-text {
    color: #9ca3af;
}

.voice-recording-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.voice-recording-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.voice-recording-btn:hover {
    transform: scale(1.1);
}

.voice-cancel-btn {
    background: #EF4444;
}

.voice-send-btn {
    background: #10B981;
}

.voice-recording-btn svg,
.voice-recording-btn i[data-lucide] {
    width: 24px;
    height: 24px;
    color: white;
}

/* ===== Room Message Specific ===== */
.message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
    margin-bottom: 4px;
}

.message-avatar-small {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    cursor: pointer;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}

.message.own .message-footer,
.message.me .message-footer {
    justify-content: flex-end;
}

/* ===== Home Page ===== */
.welcome {
    padding: 20px 16px 12px;
}

.welcome h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.welcome p {
    font-size: 13px;
    color: var(--text-secondary);
}

.dashboard {
    padding: 8px 16px 16px;
}

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

.card {
    background: #A7DFFF;
    border-radius: 16px;
    padding: 16px 14px;
    height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    position: relative;
    text-decoration: none;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-1 {
    background: #A7DFFF;
}

.card-2 {
    background: #FFD6E0;
}

.card-3 {
    background: #C8B6FF;
}

.card-4 {
    background: #B8F2E6;
}

.card-5 {
    background: #FFF3B0;
}

.card-6 {
    background: #FFB5A7;
}

.card-icon {
    width: 24px;
    height: 24px;
    color: #111827;
}

.card-text {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #10B981;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

/* Topics */
.topics {
    padding: 0 16px 16px;
}

.topics-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.topics-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.topics-scroll::-webkit-scrollbar {
    display: none;
}

.topic-pill {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.topic-pill:hover {
    background: var(--primary);
    color: white;
}

/* AI Features */
.ai-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--card-bg);
    border-radius: 12px;
}

.ai-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-icon {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.ai-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle {
    width: 44px;
    height: 24px;
    background: #D1D5DB;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

body.dark .toggle {
    background: #374151;
}

.toggle.active {
    background: #10B981;
}

.toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle.active::after {
    transform: translateX(20px);
}

/* ===== Chats Page ===== */
.search-container {
    padding: 0 16px 12px;
}

.chats-list {
    display: flex;
    flex-direction: column;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    transition: background 0.2s;
}

.chat-item:hover {
    background: var(--bg-tertiary);
}

.chat-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar-wrapper .chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: #10B981;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
}

.chat-content {
    flex: 1;
    min-width: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-time {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-message.unread {
    font-weight: 600;
    color: var(--text-primary);
}

.you-prefix {
    color: var(--text-muted);
}

.unread-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Filters */
/* One control, not a row of loose chips.

   The tabs share a single recessed bed and the active one is a raised pill
   inside it, which is what makes the group read as a switch rather than as
   several buttons that happen to be adjacent.

   Two or three tabs stretch to fill the bed; when there are more labels than
   fit they scroll sideways. That is one declaration: grow to share the slack,
   never shrink below the label. Shrinking is what would squash five tabs into
   an unreadable row, and wrapping is what the horizontal scroll replaces.

   The bed and the pill need their own colours because in dark mode
   --bg-secondary and --card-bg are the same #1a1a1a, so a "grey bed, white
   pill" written in those variables would be one flat invisible block. */
.filters {
    /* A recessed grey strip with the active tab raised out of it in white.
       The bed has to be darker than the page around it (#F3F4F6) or it reads
       as a pale smear rather than a recess. */
    --seg-bed: #E4E7EC;
    --seg-idle: transparent;
    --seg-pill: #FFFFFF;
    --seg-pill-shadow: 0 1px 3px rgba(17, 24, 39, .10), 0 1px 1px rgba(17, 24, 39, .04);

    margin-bottom: 8px;
    padding: 0;
    background: var(--seg-bed);
    border-radius: 16px;
}

body.dark .filters {
    --seg-bed: #141414;
    --seg-idle: transparent;
    --seg-pill: #2e2e2e;
    --seg-pill-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}

.filters-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    /* overflow-x: auto makes overflow-y compute to auto too, so this box
       clips its children — including the raised pill's shadow, which was
       being sliced off flat top and bottom. The padding is the room the
       shadow needs inside the clip; the bed gave up its own 4px for it, so
       nothing moved. */
    padding: 4px;
}

.filters-scroll::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    /* Equal widths, not widths proportional to the label: a basis of zero
       means the free space is shared out evenly, so "Всі" and "Непрочитані"
       come out the same size. min-width holds each one at its label, which
       is what makes the row overflow — and therefore scroll — instead of
       squashing when there are more tabs than fit. */
    /* 0% rather than a bare 0: a unitless basis in the flex shorthand is
       not parsed everywhere, and where it is dropped the whole declaration
       goes with it — the tabs quietly went back to content widths. */
    flex: 1 1 0%;
    min-width: max-content;
    padding: 9px 16px;
    background: var(--seg-idle);
    border-radius: 12px;
    font-size: 13.5px;
    /* Weight is what marks the active one, so nothing else may carry it. */
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    border: none;
}

.filter-pill:hover:not(.active) {
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--seg-pill);
    color: var(--text-primary);
    /* The white pill and the darker text are the whole mark of the active
       tab. Bold on top of that made the label jump a hair wider as it moved
       between tabs, which is the sort of thing you feel before you see. */
    box-shadow: var(--seg-pill-shadow);
}

.filter-count {
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(17, 24, 39, .07);
    color: var(--text-secondary);
}

body.dark .filter-count {
    background: rgba(255, 255, 255, .10);
}

.filter-pill.active .filter-count {
    background: var(--accent-color);
    color: #fff;
}

/* The raised pill that slides. tabs.js puts one .tab-glider into every
   .filters-scroll, lays it over the active pill's box and only then adds
   .has-glider, which moves the white from the pill onto the glider — the
   same colour, shadow and radius in the same place, so the hand-over paints
   nothing new. Until then (no JavaScript yet, or a strip still hidden) the
   pill above keeps its own background and the glider is not drawn.

   The label's colour and the counter's fill change over the same 250 ms as
   the slide, so the dark text arrives with the pill rather than ahead of it.
   Weight never changes (see .filter-pill.active), so the glider never has to
   chase a label that grows.

   The glider goes under the pills with z-index: -1 inside the strip's own
   stacking context. That context is there from the first paint, not added
   with .has-glider: turning the strip into one re-rounds where its labels
   are drawn, and at the fractional heights these pills have (36.89px) the
   letters moved by a hair at the moment of hand-over. */
.filters-scroll {
    position: relative;
    isolation: isolate;
}

.tab-glider {
    display: none;
}

.filters-scroll.has-glider > .tab-glider {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    border-radius: 12px;
    background: var(--seg-pill);
    box-shadow: var(--seg-pill-shadow);
    pointer-events: none;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1), width .25s cubic-bezier(.4, 0, .2, 1);
}

.filters-scroll.has-glider > .filter-pill {
    transition: color .25s cubic-bezier(.4, 0, .2, 1);
    /* The phone's own tap flash is a square block over the pill, painted on
       top of the slide; the glider already answers the tap. */
    -webkit-tap-highlight-color: transparent;
}

.filters-scroll.has-glider > .filter-pill.active {
    background: transparent;
    box-shadow: none;
}

.filters-scroll.has-glider .filter-count {
    transition: background-color .25s cubic-bezier(.4, 0, .2, 1), color .25s cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-reduced-motion: reduce) {
    .filters-scroll.has-glider > .tab-glider,
    .filters-scroll.has-glider > .filter-pill,
    .filters-scroll.has-glider .filter-count {
        transition: none;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.empty-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.empty-button:hover {
    background: var(--primary-dark);
}

.empty-button svg,
.empty-button i[data-lucide] {
    width: 18px;
    height: 18px;
}

/* ===== Rooms Page ===== */
.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.add-btn {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
}

.add-btn svg,
.add-btn i[data-lucide] {
    width: 20px;
    height: 20px;
    color: white;
}

.add-btn:hover {
    background: var(--primary-dark);
}

.rooms-stats-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.rooms-stats-row::-webkit-scrollbar {
    display: none;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card-bg);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.stat-item svg,
.stat-item i[data-lucide] {
    width: 14px;
    height: 14px;
    color: var(--primary);
}

/* Popular Rooms */
.popular-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.popular-scroll::-webkit-scrollbar {
    display: none;
}

.popular-card {
    flex-shrink: 0;
    width: 200px;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    position: relative;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: var(--card-shadow);
}

.popular-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.popular-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

.popular-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.popular-icon-wrap svg,
.popular-icon-wrap i[data-lucide] {
    width: 24px;
    height: 24px;
    color: white;
}

.popular-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.popular-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-stats {
    display: flex;
    gap: 12px;
}

.popular-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.popular-stat svg,
.popular-stat i[data-lucide] {
    width: 12px;
    height: 12px;
}

.popular-stat.active {
    color: var(--success);
}

/* Rooms Grid */
.rooms-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.room-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: var(--card-shadow);
}

body.dark .room-card {
    box-shadow: var(--card-shadow);
}

.room-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.room-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.room-icon-wrap svg,
.room-icon-wrap i[data-lucide] {
    width: 20px;
    height: 20px;
    color: white;
}

.room-info {
    flex: 1;
    min-width: 0;
}

.room-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.room-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.room-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--success);
    color: white;
}

.room-badge.vip {
    background: #F59E0B;
}

.room-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-stats {
    display: flex;
    gap: 12px;
}

.room-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.room-stat svg,
.room-stat i[data-lucide] {
    width: 12px;
    height: 12px;
}

.room-stat.active {
    color: var(--success);
}

.room-action {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: rgba(136, 73, 254, 0.1);
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
}

.room-action:hover {
    background: rgba(136, 73, 254, 0.2);
}

.room-action svg,
.room-action i[data-lucide] {
    width: 14px;
    height: 14px;
}

/* ===== Profile Page - New Design ===== */
.profile-header-block {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--card-shadow);
}

body.dark .profile-header-block {
    box-shadow: var(--card-shadow);
}

.profile-cover {
    height: 100px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-cover.no-cover {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
}

.profile-cover-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

.cover-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cover-action-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.cover-action-btn svg,
.cover-action-btn i[data-lucide] {
    width: 18px;
    height: 18px;
}

.profile-info-section {
    padding: 0 16px 16px;
    position: relative;
}

.profile-avatar-wrap {
    display: flex;
    justify-content: center;
    margin-top: -45px;
    position: relative;
}

.profile-avatar-container {
    position: relative;
}

.profile-avatar-img {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 4px solid var(--card-bg);
    cursor: pointer;
    position: relative;
}

.profile-online-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border: 3px solid var(--card-bg);
    border-radius: 50%;
}

.profile-rating-badge {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    border: 2px solid var(--card-bg);
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.profile-rating-badge svg,
.profile-rating-badge i[data-lucide] {
    width: 11px;
    height: 11px;
}

.profile-name-block {
    text-align: center;
    margin-top: 16px;
}

.profile-display-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-verify-icon {
    width: 16px;
    height: 16px;
    color: #3B82F6;
    flex-shrink: 0;
}

.profile-premium-icon {
    width: 14px;
    height: 14px;
    color: #F59E0B;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
    flex-shrink: 0;
}

.profile-username-text {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-mini-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.mini-stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.mini-stat svg,
.mini-stat i[data-lucide] {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.profile-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.profile-btn svg,
.profile-btn i[data-lucide] {
    width: 18px;
    height: 18px;
}

.profile-btn-primary {
    flex: 1;
    background: var(--primary);
    color: white;
}

.profile-btn-primary:hover {
    background: var(--primary-dark);
}

.profile-btn-secondary {
    width: 44px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.profile-btn-secondary:hover {
    background: var(--border-color);
}

.profile-btn-gift {
    width: 44px;
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: white;
}

.profile-btn-gift:hover {
    opacity: 0.9;
}

.profile-btn-friend {
    width: 44px;
    background: #10B981;
    color: white;
}

.profile-btn-friend:hover {
    background: #059669;
}

.profile-btn-pending {
    width: 44px;
    background: #f59e0b;
    color: white;
}

.profile-btn-pending:hover {
    background: #d97706;
}

.profile-btn-accept {
    width: 44px;
    background: #10B981;
    color: white;
}

.profile-btn-accept:hover {
    background: #059669;
}

.profile-btn-friends {
    width: 44px;
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    cursor: default;
}

/* Profile Gifts */
.profile-gifts {
    margin-top: 16px;
}

.profile-gifts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.profile-gifts-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.gifts-count {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    text-transform: none;
    letter-spacing: normal;
}

.profile-gifts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
}

.profile-gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.profile-gift-item:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.profile-gift-emoji {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 4px;
}

.profile-gift-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 4px;
}

.profile-gift-from {
    font-size: 10px;
    color: var(--text-tertiary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.gifts-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: var(--text-tertiary);
}

/* A drawn icon rather than an emoji, so it follows the theme. */
.gifts-empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(136, 73, 254, 0.1);
}

.gifts-empty-icon i,
.gifts-empty-icon svg,
.gifts-empty-icon i[data-lucide] {
    width: 22px;
    height: 22px;
    color: var(--accent-color);
}

.gifts-empty-text {
    font-size: 13px;
}

/* Legacy profile styles - keep for compatibility */
.profile-hero {
    display: none;
}

.action-icon {
    width: 16px;
    height: 16px;
}

/* ===== Search Page ===== */
.title-section {
    margin-bottom: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.quick-action {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.quick-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.quick-action-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-icon.purple {
    background: rgba(136, 73, 254, 0.1);
}

.quick-action-icon.pink {
    background: rgba(236, 72, 153, 0.1);
}

.quick-action-icon svg,
.quick-action-icon i[data-lucide] {
    width: 22px;
    height: 22px;
}

.quick-action-icon.purple svg {
    color: #8849FE;
}

.quick-action-icon.pink svg {
    color: #EC4899;
}

.quick-action-text {
    flex: 1;
}

.quick-action-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.quick-action-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Stats Card */
.stats-card {
    background: linear-gradient(135deg, #8849FE 0%, #EC4899 100%);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    color: white;
}

.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stats-title {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
}

.stats-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.stats-value {
    font-size: 32px;
    font-weight: 700;
}

.stats-label {
    font-size: 13px;
    opacity: 0.8;
}

/* User Results */
.user-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-item {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: all 0.2s;
}

.user-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-info-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    position: relative;
}

/* The wrapper, not the picture, is what the dot is positioned against — the
   avatar itself is masked into a squircle and a mask clips its descendants. */
.user-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.user-avatar-wrap .online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-name .verify-icon {
    width: 14px;
    height: 14px;
    color: #3B82F6;
}

.user-name .premium-icon {
    width: 14px;
    height: 14px;
    color: #F59E0B;
}

.user-details {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.user-action {
    width: 40px;
    height: 40px;
    background: rgba(136, 73, 254, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-action svg,
.user-action i[data-lucide] {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* Start Button */
.start-btn {
    width: 100%;
    margin-bottom: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #8849FE 0%, #7233E8 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(136, 73, 254, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(136, 73, 254, 0.4);
}

.start-btn svg,
.start-btn i[data-lucide] {
    width: 20px;
    height: 20px;
}

/* Search Loading */
.search-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.search-loading.active {
    display: flex;
}

.search-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.search-loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== Settings Page ===== */
.profile-settings-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--card-shadow);
}

.profile-avatar-settings-wrapper {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

/* Без обводки. Обличчя тут обрізане маскою-скругленим квадратом, і рамка
   під нею лишалася видимою кільцем — фіолетовою підкладкою навколо знімка,
   якої ніхто не просив. Виділяти аватарку в налаштуваннях нема від чого:
   вона там сама по собі. */
.profile-avatar-settings {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.avatar-overlay {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

.avatar-overlay svg,
.avatar-overlay i,
.avatar-overlay i[data-lucide] {
    width: 14px;
    height: 14px;
    color: white !important;
}

/* Avatar Options moved to earlier in file - see line ~3418 */

.profile-info-settings {
    flex: 1;
    min-width: 0;
}

.profile-name-settings {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-email-settings {
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-edit-btn {
    width: 40px;
    height: 40px;
    background: rgba(136, 73, 254, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.profile-edit-btn:hover {
    background: rgba(136, 73, 254, 0.2);
}

.profile-edit-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

/* Badge */
.badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.badge.premium {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
}

.badge.new {
    background: var(--success);
    color: white;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

body.dark ::-webkit-scrollbar-thumb {
    background: #374151;
}

body.dark ::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 70px;
    /* Below header (56px + 14px margin) */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100% - 40px);
    width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon svg,
.toast-icon i[data-lucide] {
    width: 22px;
    height: 22px;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toast-close svg,
.toast-close i[data-lucide] {
    width: 16px;
    height: 16px;
}

/* Toast Types */
.toast-success {
    border-left-color: #10B981;
}

.toast-success .toast-icon {
    color: #10B981;
}

.toast-error {
    border-left-color: #EF4444;
}

.toast-error .toast-icon {
    color: #EF4444;
}

.toast-warning {
    border-left-color: #F59E0B;
}

.toast-warning .toast-icon {
    color: #F59E0B;
}

.toast-info {
    border-left-color: #3B82F6;
}

.toast-info .toast-icon {
    color: #3B82F6;
}

/* ===== Gift Store ===== */
.modal.modal-large {
    max-height: 85vh;
}

.gift-categories {
    display: flex;
    gap: 8px;
    padding: 16px;
    overflow-x: auto;
    border-bottom: 1px solid #E5E7EB;
}

body.dark .gift-categories {
    border-bottom-color: #333;
}

.gift-category {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #E5E7EB;
    background: transparent;
    font-size: 13px;
    color: #6B7280;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

body.dark .gift-category {
    border-color: #444;
    color: #9CA3AF;
}

.gift-category:hover {
    background: #F3F4F6;
}

body.dark .gift-category:hover {
    background: #333;
}

.gift-category.active {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    border-color: transparent;
    color: white;
}

.gift-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #F9FAFB;
    font-size: 14px;
    color: #6B7280;
}

body.dark .gift-balance {
    background: #1a1a1a;
    color: #9CA3AF;
}

.balance-icon {
    width: 18px;
    height: 18px;
    color: #F59E0B;
}

.gift-balance strong {
    color: #111827;
    font-weight: 600;
}

body.dark .gift-balance strong {
    color: #e5e7eb;
}

.buy-coins-link {
    margin-left: auto;
    color: #3B82F6;
    text-decoration: none;
    font-weight: 500;
}

.buy-coins-link:hover {
    text-decoration: underline;
}

.gifts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

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

.gift-item {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

body.dark .gift-item {
    background: #262626;
    border-color: #333;
}

.gift-item:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #3B82F6;
}

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

.gift-image {
    width: 60px;
    height: 60px;
    margin: 0 auto 8px;
}

.gift-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gift-emoji {
    font-size: 48px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.gift-preview-image .gift-emoji {
    font-size: 64px;
}

.gift-name {
    font-size: 12px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.dark .gift-name {
    color: #e5e7eb;
}

.gift-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #F59E0B;
}

.gift-coin-icon {
    width: 14px;
    height: 14px;
}

.gifts-loading,
.gifts-empty,
.gifts-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
}

body.dark .gifts-loading,
body.dark .gifts-empty,
body.dark .gifts-error {
    color: #9CA3AF;
}

.gifts-error {
    color: #EF4444;
}

/* Gift Preview */
.gift-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #F9FAFB;
    border-radius: 12px;
    margin-bottom: 16px;
}

body.dark .gift-preview {
    background: #1a1a1a;
}

.gift-preview-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.gift-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gift-preview-info {
    flex: 1;
}

.gift-preview-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

body.dark .gift-preview-name {
    color: #e5e7eb;
}

.gift-preview-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #F59E0B;
    font-weight: 600;
}

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

.input-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

body.dark .input-label {
    color: #d1d5db;
}

.input-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

body.dark .input-textarea {
    background: #1a1a1a;
    border-color: #333;
    color: #e5e7eb;
}

.input-textarea:focus {
    outline: none;
    border-color: #3B82F6;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
}

body.dark .checkbox-label {
    color: #d1d5db;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3B82F6;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1F2937;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== PWA Install Banner ===== */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 20px 20px 0 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.pwa-install-banner.show {
    transform: translateY(0);
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366F1 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-install-icon svg,
.pwa-install-icon i,
.pwa-install-icon i[data-lucide] {
    width: 24px;
    height: 24px;
    color: white;
}

.pwa-install-text {
    flex: 1;
}

.pwa-install-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.pwa-install-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.pwa-install-actions {
    display: flex;
    gap: 10px;
}

.pwa-install-btn {
    flex: 1;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.pwa-install-later {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.pwa-install-later:hover {
    background: var(--bg-tertiary);
}

.pwa-install-now {
    background: var(--primary);
    color: white;
}

.pwa-install-now:hover {
    background: var(--primary-dark);
}

/* PWA Update Banner */
.pwa-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1001;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

.pwa-update-banner button {
    background: white;
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pwa-update-banner button:hover {
    opacity: 0.9;
}

/* PWA Mode Adjustments */
body.pwa-mode {
    /* Hide browser UI hints in PWA mode */
}

/* The safe-area inset is handled in the base .bottom-nav rule now; this used to
   add padding on top of a fixed height and squashed the icons. */

/* ===== Unified Post Card Styles ===== */
.post-card {
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

body.dark .post-card {
    box-shadow: var(--card-shadow);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 10px;
}

.post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-user-info {
    flex: 1;
    min-width: 0;
}

.post-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-author .verified-badge {
    width: 14px;
    height: 14px;
    color: #3B82F6;
}

.post-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.post-more-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-tertiary);
    cursor: pointer;
    flex-shrink: 0;
}

.post-more-btn:hover {
    background: var(--bg-secondary);
}

.post-more-btn svg,
.post-more-btn i[data-lucide] {
    width: 18px;
    height: 18px;
}

/* Post Media */
.post-media {
    margin-bottom: 0;
    padding: 0;
}

.post-media img {
    width: 100%;
    display: block;
    border-radius: 6px;
}

.post-media-grid {
    display: grid;
    gap: 2px;
    border-radius: 6px;
    overflow: hidden;
}

.post-media-grid.grid-2 {
    grid-template-columns: 1fr 1fr;
}

.post-media-grid.grid-3 {
    grid-template-columns: 2fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.post-media-grid.grid-3 > :first-child {
    grid-row: span 2;
}

.post-media-grid.grid-4 {
    grid-template-columns: 1fr 1fr;
}

.post-media-grid > * {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    min-height: 120px;
    border-radius: 0;
}

/* Border radius for grid corners */
.post-media-grid.grid-2 > :first-child {
    border-radius: 6px 0 0 6px;
}

.post-media-grid.grid-2 > :last-child {
    border-radius: 0 6px 6px 0;
}

.post-media-grid.grid-3 > :first-child {
    border-radius: 6px 0 0 6px;
}

.post-media-grid.grid-3 > :nth-child(2) {
    border-radius: 0 6px 0 0;
}

.post-media-grid.grid-3 > :nth-child(3) {
    border-radius: 0 0 6px 0;
}

.post-media-grid.grid-4 > :nth-child(1) {
    border-radius: 6px 0 0 0;
}

.post-media-grid.grid-4 > :nth-child(2) {
    border-radius: 0 6px 0 0;
}

.post-media-grid.grid-4 > :nth-child(3) {
    border-radius: 0 0 0 6px;
}

.post-media-grid.grid-4 > :nth-child(4) {
    border-radius: 0 0 6px 0;
}

.post-media-grid.grid-5 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
}

.post-media-grid.grid-5 > :nth-child(1) {
    border-radius: 6px 0 0 0;
}

.post-media-grid.grid-5 > :nth-child(3) {
    border-radius: 0 6px 0 0;
}

.post-media-grid.grid-5 > :nth-child(4) {
    border-radius: 0 0 0 6px;
}

.post-media-grid.grid-5 > :nth-child(5) {
    border-radius: 0 0 6px 0;
    grid-column: span 2;
}

.post-media-grid.grid-6 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
}

.post-media-grid.grid-6 > :nth-child(1) {
    border-radius: 6px 0 0 0;
}

.post-media-grid.grid-6 > :nth-child(3) {
    border-radius: 0 6px 0 0;
}

.post-media-grid.grid-6 > :nth-child(4) {
    border-radius: 0 0 0 6px;
}

.post-media-grid.grid-6 > :nth-child(6) {
    border-radius: 0 0 6px 0;
}

/* Post Media Slider - Instagram style */
.post-media-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--bg-tertiary);
    touch-action: pan-y pinch-zoom;
    border-radius: 6px;
}

.post-media-slider.swiping {
    touch-action: none;
}

.slider-track {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.slider-slide {
    flex-shrink: 0;
    width: 100%;
}

.slider-slide img {
    width: 100%;
    display: block;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
}

.slider-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    background: var(--card-bg);
}

.slider-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.slider-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

.slider-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 10;
}

/* Post Content */
.post-content {
    padding: 12px;
    cursor: pointer;
}

/* Текст після фото - більший відступ зверху */
.post-media+.post-content,
.post-media-slider+.post-content {
    padding-top: 12px;
}

/* Текст без фото (одразу після header) - менший відступ */
.post-header+.post-content {
    padding-top: 0;
}

.post-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    word-wrap: break-word;
}

/* Post text truncation - 3 lines max */
.post-text.truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.post-show-more {
    display: inline-block;
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 4px;
    background: none;
    border: none;
    padding: 0;
}

.post-show-more:hover {
    text-decoration: underline;
}

/* Post Actions */
.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
}

/* Фото чи відео без тексту — межу з лайками вже дає саме медіа, лінія зайва. */
.post-media + .post-actions,
.post-media-grid + .post-actions,
.post-media-slider + .post-actions {
    border-top: 0;
}

.post-actions-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.15s;
}

.post-action-btn:hover {
    color: var(--text-primary);
}

.post-action-btn svg,
.post-action-btn i[data-lucide] {
    width: 22px;
    height: 22px;
}

.post-action-btn .count {
    font-weight: 600;
    font-size: 14px;
}

/* Перегляди. Не кнопка — тиснути на них нема для чого, тому без наведення й
   без курсора-пальця. Але виглядають вони як решта лічильників у тому самому
   рядку: той самий колір, той самий розмір іконки й цифри. Сірішими й дрібнішими
   за сусідів вони читалися як щось вимкнене. */
.post-views {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 14px;
}

.post-views svg,
.post-views i[data-lucide] {
    width: 22px;
    height: 22px;
}

.post-views .count {
    font-weight: 600;
    font-size: 14px;
}

.post-action-btn.liked {
    color: #EF4444;
}

.post-action-btn.liked svg {
    fill: #EF4444;
}

.post-action-btn.bookmarked {
    color: var(--accent-color);
}

.post-action-btn.bookmarked svg {
    fill: var(--accent-color);
}

/* Pinned indicator - іконка біля 3 точок */
.post-pinned-icon {
    color: #F59E0B;
    margin-right: 4px;
}

.post-pinned-icon svg,
.post-pinned-icon i[data-lucide] {
    width: 16px;
    height: 16px;
}

/* Confirmation Modal */
.confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-modal {
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.confirm-modal-overlay.active .confirm-modal {
    transform: translateY(0);
}

.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-modal-icon svg,
.confirm-modal-icon i[data-lucide] {
    width: 28px;
    height: 28px;
    color: #EF4444;
}

.confirm-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.confirm-modal-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.confirm-modal-buttons {
    display: flex;
    gap: 12px;
}

.confirm-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.confirm-btn.cancel {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.confirm-btn.cancel:hover {
    background: var(--bg-tertiary);
}

.confirm-btn.danger {
    background: #EF4444;
    color: white;
}

.confirm-btn.danger:hover {
    background: #DC2626;
}

.comment-item {
    display: flex;
    gap: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.comment-item:hover {
    background: var(--bg-tertiary);
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.comment-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-verified {
    width: 14px;
    height: 14px;
    color: #3B82F6;
}

.comment-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    word-wrap: break-word;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.comment-action-btn {
    font-size: 12px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.comment-action-btn:hover {
    color: var(--text-primary);
}

.comment-replies-toggle {
    font-size: 12px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-replies-toggle:hover {
    color: var(--text-primary);
}

.comment-replies {
    margin-left: 48px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.comments-empty svg,
.comments-empty i[data-lucide] {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.comments-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
}

.comments-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.comments-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
    resize: none;
    outline: none;
}

.comments-input::placeholder {
    color: var(--text-tertiary);
}

.comments-send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

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

.comments-send-btn svg,
.comments-send-btn i[data-lucide] {
    width: 18px;
    height: 18px;
}
/* =============================================================================
   Comments — redesign
   -----------------------------------------------------------------------------
   The comment is a bubble next to the avatar, with the author's name inside it
   and the actions as a quiet row underneath. Replies hang off a hairline so a
   thread is readable at a glance. Nothing here is an emoji.
   ========================================================================== */

/* Фон тут більше не задається. Оболонку аркуша — фон, шапку, назву, висоту —
   тримає includes/components/comments_sheet.php, і поки цей файл малював під
   списком --bg-secondary, аркуш виходив сірим, хоч сам аркуш білий. */
.comments-body {
    padding: 12px 14px 4px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* The card is gone — the bubble carries the shape now. */
.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
}

.comment-item:hover { background: none; }

.comment-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.comment-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

/* Author line and text share the column width. */
.comment-item > .comment-body > .comment-author,
.comment-item > .comment-body > .comment-text {
    max-width: 100%;
}

.comment-body > .comment-author {
    order: 1;
}

.comment-body > .comment-text {
    order: 2;
}

.comment-body > .comment-actions,
.comment-body > .comment-replies-toggle {
    order: 3;
}

.comment-body > .comment-replies {
    order: 4;
}

/* Name, badge and time on one quiet line above the bubble. */
.comment-author {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 0;
    padding-left: 2px;
}

.comment-name {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-verified {
    width: 13px;
    height: 13px;
    color: #3B82F6;
    flex-shrink: 0;
}

.comment-time {
    font-size: 11.5px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* A comment is plain text under the author line — not a chat bubble. */
.comment-text {
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-primary);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 1px;
    padding-left: 2px;
}

.comment-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
    transition: color .15s;
}

.comment-action-btn:hover { color: var(--accent-color); }
.comment-action-btn.danger:hover { color: #EF4444; }

.comment-action-btn i,
.comment-action-btn svg,
.comment-action-btn i[data-lucide] {
    width: 13px;
    height: 13px;
}

.comment-replies-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--accent-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 0;
    margin-top: 2px;
}

/* Підкреслювання під курсором тут не було: це перемикач гілки, а не
   посилання. Малює його includes/components/comments_sheet.php. */

.comment-replies-toggle i,
.comment-replies-toggle svg,
.comment-replies-toggle i[data-lucide] { width: 13px; height: 13px; }

/* Replies hang off a hairline rather than floating in space. */
.comment-replies {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-replies .comment-avatar { width: 28px; height: 28px; }
.comment-replies .comment-text { font-size: 13.5px; }

.comments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 44px 20px;
    color: var(--text-tertiary);
}

.comments-empty i,
.comments-empty svg,
.comments-empty i[data-lucide] {
    width: 26px;
    height: 26px;
    margin: 0 0 10px;
    opacity: 1;
    color: var(--accent-color);
    padding: 11px;
    box-sizing: content-box;
    border-radius: 16px;
    background: rgba(136, 73, 254, .1);
}

/* Composer: pinned to the bottom edge, clear of a notched phone. */
.comments-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.comments-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: border-color .15s, background .15s;
}

.comments-input:focus {
    border-color: var(--accent-color);
    background: var(--card-bg);
}

body.dark .comments-input { background: #1e1e1e; }

.comments-send-btn {
    width: 40px;
    height: 40px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .2s, transform .1s;
}

.comments-send-btn:active { transform: scale(.94); }

/* The banner that appears while replying to someone. */
.comment-reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 14px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.comment-reply-banner strong { color: var(--accent-color); }

.comment-reply-banner button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    display: flex;
    padding: 2px;
}

.comment-reply-banner button svg,
.comment-reply-banner button i[data-lucide] { width: 16px; height: 16px; }

/* Bottom sheets — висота й прокрутка аркуша живуть разом із кістяком
   модалки, в includes/components/action_sheet.php. */

/* =============================================================================
   Image frames and skeletons
   -----------------------------------------------------------------------------
   Every stored photo carries its pixel size, so the frame can be given the
   picture's own aspect ratio and reserve exactly the space the image will take.
   The shimmer therefore sits in the right-shaped box, and nothing on the page
   moves when the bytes finally arrive.

   `is-sized` is set only when a size is known. Without one there is nothing
   honest to reserve, so the frame stays out of the way rather than guessing a
   shape and causing the jump it exists to prevent.
   ========================================================================== */

.img-frame {
    display: block;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.img-frame.is-sized {
    width: 100%;
    background: #E5E7EB;
    border-radius: inherit;
}

.img-frame.is-sized::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .65) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

/* Once the picture is there the shimmer has nothing left to stand in for. */
.img-frame.is-loaded {
    background: transparent;
}

.img-frame.is-loaded::after {
    display: none;
}

.img-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .2s ease;
}

.img-frame.is-loaded img {
    opacity: 1;
}

/* A cached image can be complete before the load handler is attached, which
   would leave it shimmering forever. */
.img-frame img[data-instant] {
    opacity: 1;
}

@keyframes img-shimmer {
    from { background-position: 140% 0; }
    to   { background-position: -40% 0; }
}

body.dark .img-frame.is-sized {
    background: #262626;
}

body.dark .img-frame.is-sized::after {
    background: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .09) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
}

@media (prefers-reduced-motion: reduce) {
    .img-frame.is-sized::after {
        animation: none;
    }
}

/* -----------------------------------------------------------------------------
   Grid tiles need a shape of their own
   -----------------------------------------------------------------------------
   The grid's rows are `1fr`, so their height comes from the pictures in them —
   which means before the pictures arrive the grid has no height at all, and the
   page grows under the reader as they load. Anything above the viewport doing
   that is what loses the scroll position. A square is the shape the tiles crop
   to anyway, so giving it up front costs nothing and holds the space.
   -------------------------------------------------------------------------- */

.post-media-grid > * {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* This one spans both rows, so its height is the two of them, not a square. */
.post-media-grid.grid-3 > :first-child {
    aspect-ratio: auto;
    height: 100%;
}

/* -----------------------------------------------------------------------------
   Skeleton for grid tiles
   -----------------------------------------------------------------------------
   A tile is a grid item, and its placement rules address it directly, so it
   cannot be wrapped the way a single photo is without breaking the layout. The
   skeleton therefore lives on the <img> itself: an image paints its own
   background until the picture arrives, and the picture then covers it.
   -------------------------------------------------------------------------- */

.post-media-grid img {
    background-color: #E5E7EB;
    background-image: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .65) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

/* Nothing left to stand in for, and no reason to keep animating under it. */
.post-media-grid img.is-loaded {
    background-image: none;
    background-color: transparent;
    animation: none;
}

body.dark .post-media-grid img {
    background-color: #262626;
    background-image: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .09) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
}

@media (prefers-reduced-motion: reduce) {
    .post-media-grid img {
        animation: none;
    }
}

/* -----------------------------------------------------------------------------
   Video in a post
   -----------------------------------------------------------------------------
   The tile is the poster: an ordinary lazy picture with the usual skeleton.
   photo_viewer.php puts a muted <video> over it only while the tile is on
   screen, and the video fades in once it actually plays — until then the poster
   is what you see, so nothing flashes black.
   -------------------------------------------------------------------------- */

.post-video {
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.post-video > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-media-grid > .post-video > img {
    aspect-ratio: auto;
    min-height: 0;
}

.post-video > video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .25s ease;
    background: transparent;
}

.post-video.is-playing > video {
    opacity: 1;
}

/* Таймер — у правому нижньому куті, ледь помітний; поки ролик грає, рахує
   назад, скільки лишилось (FeedVideo у photo_viewer.php). */
.post-video-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px 2px 4px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .32);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    pointer-events: none;
}

.post-video-badge svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

/* Грає — трикутник уже нічого не каже, лишається відлік. */
.post-video.is-playing .post-video-badge svg {
    display: none;
}

.post-video.is-playing .post-video-badge {
    padding-left: 6px;
}

/* -----------------------------------------------------------------------------
   Article card in the feed
   -----------------------------------------------------------------------------
   An article shows its cover, title and a short description, and the button
   opens the reader (includes/components/article_reader.php). The links point
   at the post page, so without the reader the card still goes somewhere useful.
   -------------------------------------------------------------------------- */

/* Кути обкладинки — як у фото чи відео звичайного допису: рамка img-frame бере
   їх у батька, тож обгортка передає кути картки далі. */
.art-card {
    border-radius: inherit;
}

.art-card-cover {
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: inherit;
    overflow: hidden;
}

.art-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Під кнопкою — той самий відступ, що над нею (14px). */
.art-card-body {
    padding: 14px 12px;
}

.art-card-kicker {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--accent-color, #8849FE);
}

.art-card-kicker svg {
    width: 15px;
    height: 15px;
}

.art-card-kicker i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.art-card-kicker span + i + span {
    font-weight: 500;
    letter-spacing: 0;
    color: var(--text-tertiary);
}

.art-card-title {
    display: -webkit-box;
    margin-top: 7px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.26;
    letter-spacing: -.005em;
    color: var(--text-primary);
    text-decoration: none;
}

.art-card-desc {
    display: -webkit-box;
    margin: 7px 0 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.art-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
    margin-top: 14px;
    border-radius: 12px;
    /* Градієнт — як був; тіні й світіння немає (власник, 18.10). */
    background: linear-gradient(135deg, #8849FE 0%, #6C5CFF 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: transform .15s ease, filter .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.art-card-btn svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.art-card-btn .art-card-arrow {
    width: 17px;
    height: 17px;
    margin-left: -2px;
    transition: transform .2s ease;
}

.art-card-btn:hover {
    filter: brightness(1.06);
}

.art-card-btn:hover .art-card-arrow {
    transform: translateX(3px);
}

.art-card-btn:active {
    transform: scale(.985);
}

/* -----------------------------------------------------------------------------
   Avatars carry their own skeleton
   -----------------------------------------------------------------------------
   Avatars are rendered in dozens of templates, some as <img>, some as a div with
   an inline background-image. Threading a wrapper through all of them would be a
   long edit with a lot of ways to go wrong, so the skeleton is attached by what
   the element already is.

   Any <img> whose class mentions an avatar shimmers until it loads — the element
   paints its own background, and the picture then covers it. This deliberately
   matches only images: a div with an inline background-image would have that
   image stretched by the shimmer's background-size, so those get a plain tone
   underneath instead.
   -------------------------------------------------------------------------- */

img[class*="avatar"],
img[class*="Avatar"] {
    background-color: #E5E7EB;
    background-image: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .65) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
    animation: img-shimmer 1.3s ease-in-out infinite;
}

img[class*="avatar"].is-loaded,
img[class*="Avatar"].is-loaded {
    background-image: none;
    background-color: transparent;
    animation: none;
}

/* Background-image avatars: a tone to sit on, no shimmer — the shimmer's
   background-size would distort the picture they carry inline.

   Matched by the inline background-image, not by class name. Half those names
   belong to WRAPPERS around the picture — .dialog-avatar is a bare positioning
   box with no size and no radius — so tinting by class painted a grey square
   behind a round avatar, with nothing that could ever clear it. An element
   carrying its own background-image is, by definition, the picture itself. */
[class*="avatar"][style*="background-image"] {
    background-color: #E5E7EB;
}

[class*="avatar"][style*="background-image"].is-loaded {
    background-color: transparent;
}

body.dark img[class*="avatar"],
body.dark [class*="avatar"][style*="background-image"] {
    background-color: #262626;
}

body.dark [class*="avatar"][style*="background-image"].is-loaded {
    background-color: transparent;
}

body.dark img[class*="avatar"] {
    background-image: linear-gradient(100deg,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, .09) 50%,
            rgba(255, 255, 255, 0) 80%);
    background-size: 220% 100%;
}

@media (prefers-reduced-motion: reduce) {
    img[class*="avatar"] {
        animation: none;
    }
}

/* -----------------------------------------------------------------------------
   Icons hold their place before the library runs
   -----------------------------------------------------------------------------
   Lucide REPLACES each <i data-lucide> with an <svg>. Until that happens the <i>
   is an empty inline element with no size, so every icon on the page is a hole
   that suddenly becomes 24px — and everything around it jumps. Giving the
   placeholder the same box the icon will take means the swap changes what is
   drawn, not where anything sits.

   Rules elsewhere that size a specific icon's svg keep working; this only sets
   the default box, which is the one lucide itself uses.

   :where() is what makes that last sentence true. Written as a bare
   `i[data-lucide]`, this selector carries a type and an attribute — more weight
   than a plain class — so it beat .header-icon (20px) and .nav-icon (21px) and
   reserved 24px for icons that were about to be smaller. The swap then shrank
   them and the row closed up: the header still twitched on every load, by three
   or four pixels instead of twenty. Inside :where() the selector weighs nothing,
   so each icon's own class decides its size and the box that is reserved is the
   box that gets used.
   -------------------------------------------------------------------------- */

:where(i[data-lucide]) {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
    flex: none;
}


/* ---------------------------------------------------------------------------
   One shape for every avatar on the site.

   The profile settled on a squircle — corners that round hard while the sides
   stay almost straight and bow out a touch at their middles. border-radius
   cannot draw that: every value it takes is an ellipse. So the shape is a
   superellipse cut out with a mask, and the radius underneath is the fallback
   for anything that cannot mask — it leaves a plain rounded square rather than
   a broken box.

   Collected here rather than edited into forty rules across nine files. That
   is also why the radius is !important: page CSS is hoisted into the head
   *after* this file (see hoistPageStyles), so a page's own `border-radius: 50%`
   would otherwise win on source order alone. Only the radius needs it — nothing
   else on the site sets a mask.

   What is deliberately NOT in the list: the marks that sit ON an avatar rather
   than being one — online dots, verification ticks, the "+N" of a stack's
   overflow is in, but the badges are not. A mask clips its own descendants, so
   anything hanging off an edge would be cut in half by it.
   -------------------------------------------------------------------------- */

:root {
    --avatar-squircle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M50,0 C13.5,0 0,13.5 0,50 C0,86.5 13.5,100 50,100 C86.5,100 100,86.5 100,50 C100,13.5 86.5,0 50,0 Z' fill='%23000'/%3E%3C/svg%3E");
}

.avatar,
.sidebar-avatar,
.nav-avatar,
.chat-avatar,
.chat-avatar-wrapper .chat-avatar,
.room-avatar,
.room-avatar img,
.user-avatar,
.post-avatar,
.comment-avatar,
.comments-me-avatar,
.message-avatar,
.message-avatar-small,
.typing-avatar,
.empty-avatar,
.profile-avatar,
.profile-avatar-img,
.profile-avatar-large,
.profile-avatar-settings,
.social-proof-avatar,
.social-proof-more,
.info-avatar,
.info-participant-avatar,
.forward-chat-avatar,
.mention-avatar,
.read-receipt-avatar,
.rs-avatar,
.lc-ava,
.dialog-avatar-img,
.dialog-avatar-room,
.member-avatar,
.member-avatar-img,
.friend-avatar,
.selected-member-avatar,
.group-avatar,
.community-avatar,
.community-avatar img,
.profile-hero-img,
.room-icon-wrap,
.room-icon-wrap img,
.popular-icon-wrap,
.popular-icon-wrap img,
.channel-avatar img,
.channel-avatar-large,
.discover-avatar img,
.author-avatar,
.avatar-preview,
.gift-user-avatar,
.status-avatar,
.viewer-avatar,
.np-face,
.np-portrait,
.np-icon,
.user-row-face img,
.avatar-overlay,
.pf-pin img,
.pf-gcard-link img,
.pf-pick img,
.a-user-avatar,
.people-card-face img,
.header-avatar img {
    border-radius: 28% !important;
    -webkit-mask-image: var(--avatar-squircle);
    mask-image: var(--avatar-squircle);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* A layer that sits inside a masked avatar and fills it. The parent's mask
   already cuts it to the right outline; it only has to stop being a circle, or
   a round shadow shows through the corners of a square one. */
.avatar-preview::after {
    border-radius: 28% !important;
}

/* The marks that hang off an avatar's edge stay round: the online dot, the
   little ringed face in the corner of a notification, the type badge that goes
   with it. They are of the same family as the VIP pill — something laid ON an
   avatar, not something standing in for one — and at 16 to 20 pixels a
   squircle is a shape nobody reads as deliberate. */
.np-figure.has-face .np-icon,
.np-figure:not(.has-face) .np-face {
    border-radius: 50% !important;
    -webkit-mask-image: none;
    mask-image: none;
}

/* The rims: the gradient ring drawn behind a picture, which also carries the
   plus and the tick that hang off its edge. Rounded to match the picture inside
   but never masked — a mask here would cut off the very badges it exists to
   hold. */
.status-avatar-wrap.has-status,
.status-avatar-wrap.has-unviewed,
.status-avatar-wrap.has-viewed {
    position: relative;
    border-radius: 30% !important;
}


/* ---------------------------------------------------------------------------
   The person list.

   One card per person in a single rounded block with hairlines between the
   rows — the friends page, and now the people page, which was built with a
   second set of nearly-identical classes before this was pulled out of
   pages/friends.php. Two lists of people on one site should not be able to
   drift apart by a pixel.

   What stays on a page is what only that page has: the buttons in
   .friend-actions differ per list, and the pages keep their own rules for
   those.

   Every box here states its own `display`. The friends page builds a row out of
   <div>s and the people page out of <span>s inside one <a>, and width, height
   and text-overflow do not apply to an inline box at all — so a shared rule
   that leaves display to the tag draws a 50px avatar on one page and nothing
   whatsoever on the other.
   -------------------------------------------------------------------------- */

.friends-list {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.friend-card:last-child {
    border-bottom: none;
}

.friend-card:active {
    background: var(--bg-secondary);
}

.friend-avatar-link {
    position: relative;
    flex-shrink: 0;
    display: block;
}

.friend-avatar {
    display: block;
    width: 50px;
    height: 50px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
}

/* The picture is masked into a squircle and a mask clips its own descendants,
   so the dot is a sibling — see the avatar block at the foot of this file. */
.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.friend-info {
    display: block;
    flex: 1;
    min-width: 0;
}

.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.friend-name > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-status {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* emerald-600 on a light page: the lighter green washes out on white. */
.friend-status.online {
    color: #059669;
}

body.dark .friend-status.online {
    color: #34D399;
}

/* The same line under a member of a community. One word, one green — see
   presencePhrase(), which is what writes it. */
.member-presence.is-online {
    color: #059669;
}

body.dark .member-presence.is-online {
    color: #34D399;
}

.friend-bio {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* The three friends' faces on the profile's friend row stay circles. They are
   a stack of overlapping discs, not portraits you are meant to look at — the
   squircle's flatter sides make the overlap read as a mistake at 28 pixels. */
.pf-faces img {
    border-radius: 50% !important;
}

/* =====================================================
   БЕЙДЖ РІВНЯ ПОДАРУНКА
   =====================================================
   Малює його giftTierBadge() у functions.php, а потрібен він уже трьом
   сторінкам: каталогу (/gift-send), самому подарунку (/gift) і полиці
   подарунків людини (/gifts). Доти опис лежав у стилях сторінки й був
   переписаний двічі — тобто новий рівень довелося б додавати в три місця,
   і перше ж розходження було б помітне лише на одній із них.

   Кольори свої на кожен рівень: рідкість має читатися з погляду, а не з
   напису. У звичайного подарунка бейджа немає взагалі — мітка, яку носять
   усі, нічого не означає, і саме тому тут немає правила .is-regular. */
.gift-tier {
    display: inline-flex;
    align-items: center;
    gap: .36em;
    /* Відступи й проміжок — у em, тобто часткою власного кегля. Бейдж
       показується трьома різними розмірами, і доки кожне місце дописувало
       собі свої пікселі, вони розходилися: на сторінці подарунка коробка
       виходила 2.08 висоти кегля, у панелі 1.58, у базовому правилі 1.82 —
       три різні пропорції в тієї самої речі. Тепер розмір задає лише
       font-size, а пропорція тримається сама. */
    padding: .27em .72em;
    /* Квадрат із заокругленням, а не пігулка: поруч із квадратною карткою
       й квадратною картинкою кругла форма була єдиною круглою річчю на
       екрані й тягла на себе більше уваги, ніж заслуговує. */
    border-radius: 7px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.27;
    letter-spacing: .2px;
    color: #fff;
    white-space: nowrap;
}

.gift-tier svg {
    /* Значок теж часткою кегля: інакше при більшому написі він лишався б
       дрібним і з'їжджав у кут. */
    width: 1.1em;
    height: 1.1em;
    flex: 0 0 auto;
}

/* Преміум — фіолетовий, як усе платне на сайті.

   Три зупинки, а не дві: двоколірний перехід між сусідніми відтінками на
   смузі завтовшки 12 px читався як суцільна заливка — градієнта не було видно
   взагалі. Світлий початок дає стрічці блиск уздовж усієї довжини. */
.gift-tier.is-premium {
    background: linear-gradient(135deg, #C084FC, #7C3AED 52%, #4C1D95);
}

/* Ексклюзив — холодний бірюзовий: помітно інший, ніж преміум. Іде в синій,
   а не в темнішу бірюзу: із поворотом відтінку смуга виглядає глибшою, ніж
   із самим затемненням. */
.gift-tier.is-exclusive {
    background: linear-gradient(135deg, #5EEAD4, #06B6D4 50%, #1D4ED8);
}

/* Колекційний — насичений малиново-бордовий. Золото читалося блідо: на
   світлій картці воно зливалося з жовтими монетами під ціною, а темний
   напис на ньому був єдиним темним написом серед трьох бейджів. */
.gift-tier.is-collector {
    background: linear-gradient(135deg, #FF8AB0, #E31164 50%, #7A0033);
    color: #fff;
}

/* =====================================================
   ІСКРИ НАВКОЛО ПОДАРУНКА
   =====================================================
   Розмітку віддає giftSparks() у functions.php; потрібні вони екрану
   «подарунок надіслано» і сторінці самого подарунка. Доти опис лежав у
   стилях однієї сторінки — і другій довелося б повторити шістдесят рядків
   разом із дванадцятьма окремими правилами розльоту.

   Сцена задає --k: усі відстані множаться на нього, тож більша сцена не
   вимагає переписувати дванадцять рядків, а лише поставити інше число. */
.gift-sparks {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
    --k: 1;
}

.gift-spark {
    position: absolute;
    display: block;
    opacity: 0;
    transform: scale(0);
    /* Куди саме летить ця зірочка — задає кожна окремо нижче. */
    --dx: 0px;
    --dy: 0px;
    animation: giftSpark 2.1s ease-out infinite;
}

.gift-spark svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Спалахує, відлітає від подарунка й гасне — і одразу наступна, з іншою
   затримкою. Розліт важливіший, ніж здається: зірочки, що просто блимають
   на місці, читаються як несправна гірлянда, а не як щось, що бризнуло. */
@keyframes giftSpark {
    0%, 66%, 100% {
        opacity: 0;
        transform: translate(0, 0) scale(0) rotate(0deg);
    }

    9% {
        opacity: 1;
        transform: translate(calc(var(--dx) * var(--k) * .25), calc(var(--dy) * var(--k) * .25))
                   scale(1) rotate(30deg);
    }

    30% {
        opacity: .95;
        transform: translate(calc(var(--dx) * var(--k) * .62), calc(var(--dy) * var(--k) * .62))
                   scale(.78) rotate(65deg);
    }

    52% {
        opacity: 0;
        transform: translate(calc(var(--dx) * var(--k)), calc(var(--dy) * var(--k)))
                   scale(.15) rotate(100deg);
    }
}

/* Дванадцять зірочок: різні кольори, різний розмір, різний бік розльоту й
   затримки, не кратні одна одній, — щоб не збиралися в такт.

   Кольори взяті врозсип, а не один золотий: у Телеграмі іскри навколо
   подарунка саме різнобарвні, і одноколірні виглядають як блиск металу. */
.gift-spark:nth-child(1)  { top: 20%; left: 46%; width: 13px; height: 13px; color: #FFD24A; --dx: -4px;  --dy: -46px; animation-delay: 0s; }
.gift-spark:nth-child(2)  { top: 26%; left: 66%; width: 9px;  height: 9px;  color: #FF6BA9; --dx: 34px;  --dy: -34px; animation-delay: .17s; }
.gift-spark:nth-child(3)  { top: 44%; left: 74%; width: 11px; height: 11px; color: #4FB8FF; --dx: 46px;  --dy: -2px;  animation-delay: .34s; }
.gift-spark:nth-child(4)  { top: 62%; left: 68%; width: 8px;  height: 8px;  color: #A96BFF; --dx: 36px;  --dy: 30px;  animation-delay: .51s; }
.gift-spark:nth-child(5)  { top: 72%; left: 50%; width: 12px; height: 12px; color: #4BD97E; --dx: 2px;   --dy: 44px;  animation-delay: .68s; }
.gift-spark:nth-child(6)  { top: 66%; left: 30%; width: 9px;  height: 9px;  color: #FF9F4A; --dx: -32px; --dy: 32px;  animation-delay: .85s; }
.gift-spark:nth-child(7)  { top: 46%; left: 22%; width: 12px; height: 12px; color: #FFD24A; --dx: -46px; --dy: 2px;   animation-delay: 1.02s; }
.gift-spark:nth-child(8)  { top: 28%; left: 28%; width: 9px;  height: 9px;  color: #FF6BA9; --dx: -34px; --dy: -30px; animation-delay: 1.19s; }
.gift-spark:nth-child(9)  { top: 34%; left: 56%; width: 7px;  height: 7px;  color: #4FB8FF; --dx: 22px;  --dy: -52px; animation-delay: .43s; }
.gift-spark:nth-child(10) { top: 58%; left: 40%; width: 7px;  height: 7px;  color: #A96BFF; --dx: -24px; --dy: 50px;  animation-delay: .94s; }
.gift-spark:nth-child(11) { top: 52%; left: 62%; width: 8px;  height: 8px;  color: #4BD97E; --dx: 52px;  --dy: 22px;  animation-delay: 1.36s; }
.gift-spark:nth-child(12) { top: 38%; left: 36%; width: 8px;  height: 8px;  color: #FF9F4A; --dx: -50px; --dy: -24px; animation-delay: 1.53s; }

/* Кому вимкнено рух — тому нерухомі й тихі. */
@media (prefers-reduced-motion: reduce) {
    .gift-spark {
        animation: none;
        opacity: .5;
        transform: scale(1);
    }
}

/* =====================================================
   СТРІЧКА РІВНЯ ЧЕРЕЗ КУТ КАРТКИ
   =====================================================
   Малює її giftTierRibbon() у functions.php; потрібна двом сіткам карток —
   каталогу (/gift-send) і полиці подарунків (/gifts).

   Замінила бейдж у кутку. Картка завширшки 106 px, і бейдж зі словом у неї не
   вміщався — лишався самий значок, тобто мітка, яка нічого не називає.
   Стрічка йде навскіс через кут, і по діагоналі місця вистачає навіть на
   «Колекційний».

   Кут правий: лівий на цих картках зайнятий позначкою вибору. */
.gift-ribbon {
    position: absolute;
    /* Картка малюється з рамкою — 2 px, і саме нею показується вибір у
       каталозі та рівень на полиці. А absolute рахується від ВНУТРІШНЬОГО
       краю, тож стрічка лягала не на кут картки, а за два пікселі від нього:
       над нею й праворуч від неї лишалася смужка, і кут виглядав недоробленим.

       Тому виносимо стрічку рівно на товщину рамки. Картка з іншою рамкою
       перевизначає --ribbon-out, а з іншим заокругленням — --ribbon-round. */
    /* Уся геометрія стрічки — шістьма числами, і жодне з них не повторюється
       в описі двічі. Ширшу стрічку роблять не другим набором правил, а іншими
       значеннями цих самих змінних: співвідношення між ними однакове, і
       порушити його випадково вже не вийде.

       --ribbon-far — відстань смуги від кута. Головне число: біля кута видима
       довжина смуги дорівнює подвоєній відстані до нього, бо дві сторони
       картки зрізають її з обох кінців. */
    --ribbon-out: 2px;      /* на скільки винести за внутрішній край */
    --ribbon-round: 14px;   /* заокруглення кута картки */
    /* Коробка обрізає смугу по кутах картки — і разом із нею все, що смуга
       відкидає. Тому вона помітно більша за саму смугу: інакше тінь упирається
       в її лівий і нижній краї й обривається прямою лінією просто на картці.
       Запас рахується від внутрішнього краю смуги — --ribbon-far плюс півтовщини
       — і має перекривати розмиття тіні. */
    --ribbon-box: 74px;     /* коробка, що обрізає смугу */
    --ribbon-far: 37px;     /* від кута до середини смуги */
    --ribbon-thick: 12px;   /* товщина смуги = висота рядка */
    --ribbon-span: 92px;    /* довжина смуги до обрізання */
    --ribbon-font: 7.5px;

    top: calc(-1 * var(--ribbon-out));
    right: calc(-1 * var(--ribbon-out));
    width: var(--ribbon-box);
    height: var(--ribbon-box);
    /* Коробка обрізає стрічку рівно по кутах картки — саме через це вона
       читається як стрічка, а не як похилий напис поверх усього. */
    overflow: hidden;
    /* Те саме заокруглення, що в картки: інакше кут стрічки зрізається
       по своїй дузі, а не по її, і збіг видно з відстані витягнутої руки. */
    border-top-right-radius: var(--ribbon-round);
    pointer-events: none;
    z-index: 2;
}

.gift-ribbon > span {
    position: absolute;
    /* Товщину смуги задає ТІЛЬКИ рядок. Відступів тут немає навмисно: з ними
       смуга виходила 17 px (3 + 11 + 3) — на картці 106 px це надто важка
       діагональ, вона перетягувала на себе увагу з самого подарунка.

       top і right — не підібрані числа, а те саме --ribbon-far, перекладене з
       діагоналі в осі: точка за --ribbon-far від кута лежить на --ribbon-far
       поділити на корінь із двох по кожній осі. Тому змінити відстань можна
       одним числом, і смуга лишиться під 45° і по центру власної коробки. */
    top: calc(var(--ribbon-far) / 1.41421356 - var(--ribbon-thick) / 2);
    right: calc(var(--ribbon-far) / 1.41421356 - var(--ribbon-span) / 2);
    display: block;
    width: var(--ribbon-span);
    transform: rotate(45deg);
    text-align: center;
    font-size: var(--ribbon-font);
    font-weight: 700;
    line-height: var(--ribbon-thick);
    color: #fff;
    white-space: nowrap;
    /* Тінь, а не рамка: рамка на похилій смузі сходить сходинками. */
    box-shadow: 0 1px 3px rgba(16, 24, 40, .28);
}

/* Кольори ті самі, що в бейджа, — це той самий рівень. Кут повернуто на 45°,
   тож і градієнт іде вздовж стрічки, а не впоперек. */
.gift-ribbon.is-premium > span {
    background: linear-gradient(90deg, #C084FC, #7C3AED 52%, #4C1D95);
}

.gift-ribbon.is-exclusive > span {
    background: linear-gradient(90deg, #5EEAD4, #06B6D4 50%, #1D4ED8);
}

.gift-ribbon.is-collector > span {
    background: linear-gradient(90deg, #FF8AB0, #E31164 50%, #7A0033);
}

/* Широка стрічка — для сторінки самого подарунка. Там і блок більший, і
   рівень уже не мітка в кутку картки, а те, що про річ насамперед кажуть,
   тож напис має читатися, а не вгадуватися.

   Числа ті самі шість, лише інші. Відстань від кута 60 дає 120 px видимої
   смуги — найдовша назва при кеглі 12 займає 97, тобто з запасом. */
.gift-ribbon.is-wide {
    --ribbon-out: 0px;
    --ribbon-round: 20px;
    /* 150, а не 120: тінь тут глибша (розмиття 12), і хвіст її сягає 83 px по
       діагоналі — коробка на 120 обривала його просто на тлі. */
    --ribbon-box: 150px;
    --ribbon-far: 60px;
    /* Смуга завтовшки 26, а не 18: на сторінці подарунка вона єдина мітка
       рівня, і 18 px читалися як обведення кута, а не як стрічка. */
    --ribbon-thick: 26px;
    --ribbon-span: 150px;
    --ribbon-font: 13px;
}

/* Тло під нею — колір самої картинки подарунка, а колір смуги — колір рівня,
   і вони можуть зійтися: у преміумного подарунка з рожевою картинкою
   фіолетова смуга дала до тла 1.21, тобто майже зникла. Відриває її від тла
   тінь — глибша, ніж на білій картці, бо тло тут темне й кольорове. */
.gift-ribbon.is-wide > span {
    letter-spacing: .04em;
    /* Тінь тут була вдвічі темніша за все інше на сторінці (.45 проти .28 у
       назви) і на світлому тлі читалася як чорна смуга під стрічкою. Стрічка
       й так відділена від тла кольором — тіні досить, щоб вона не здавалася
       намальованою просто на градієнті. */
    box-shadow: 0 1px 6px rgba(0, 0, 0, .22);
}

/* =====================================================
   ПОРОЖНІЙ СТАН
   =====================================================
   Розмітку віддає emptyState() у functions.php. Один вигляд на весь сайт:
   до цього кожен розділ мав свій — різні відступи, різні розміри значка,
   де біла картка, де прозорий блок, де просто сірий рядок.

   Форма взята з головної, з блоку «Стрічка порожня»: значок, заголовок,
   пояснення й, коли є що запропонувати, кнопка. */

.es {
    background: var(--card-bg);
    padding: 60px 20px;
    border-radius: 12px;
    text-align: center;
}

.es[hidden] {
    display: none;
}

.es-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-tertiary);
}

/* :where(), щоб правило розміру не перебивало власні класи значків — і svg
   названо теж: createIcons() замінює <i> на <svg>, і без нього значок після
   заміни стрибав би на свої 24 px. */
.es-icon :where(svg, i[data-lucide]) {
    width: 64px;
    height: 64px;
}

.es-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.es-text {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Дій може бути дві — тоді вони стають у ряд і переносяться на вузькому. */
.es-acts {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.es-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--accent-color);
    border: 0;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.es-btn:hover {
    background: var(--accent-hover);
}

.es-btn :where(svg, i[data-lucide]) {
    width: 18px;
    height: 18px;
}

/* Кілька сторінок відсували свій порожній блок від того, що вгорі, — це
   лишається їхньою справою, але тепер не інлайновим стилем. */
.es-top {
    margin-top: 24px;
}

/* Усередині чужої картки: без свого тла й із меншими відступами, інакше
   виходить картка в картці. */
.es.is-compact {
    background: none;
    padding: 36px 16px;
    border-radius: 0;
}

.es.is-compact .es-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
}

.es.is-compact .es-icon :where(svg, i[data-lucide]) {
    width: 40px;
    height: 40px;
}

.es.is-compact .es-title {
    font-size: 15px;
}
