/* ═══════════════════════════════════════
   XSSM
   ═══════════════════════════════════════ */

:root {
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    --accent: #8b7cf6;
    --accent-light: #b4a4fc;
    --accent-dark: #7465d4;
    --accent-soft: rgba(139, 124, 246, 0.06);
    --accent-glow: rgba(139, 124, 246, 0.08);

    --glass-sm: rgba(14, 18, 28, 0.55);
    --glass-md: rgba(14, 18, 28, 0.75);
    --glass-lg: rgba(14, 18, 28, 0.88);
    --glass-xl: rgba(14, 18, 28, 0.95);

    --bg-deep: #070910;
    --bg-base: #0b0e1a;
    --bg-surface: #101422;
    --bg-elevated: #161a2c;
    --bg-hover: #1d2137;
    --bg-input: #0f1322;
    --bg-glass: var(--glass-md);
    --bg-glass-strong: var(--glass-lg);
    --bg-island: rgba(16, 20, 34, 0.65);

    --text-primary: #ebeef5;
    --text-secondary: #959db5;
    --text-muted: #58607a;

    --border-faint: rgba(255, 255, 255, 0.03);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-medium: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.18);

    --green: #34d399;
    --red: #f87171;
    --amber: #fbbf24;
    --blue: #818cf8;
    --success: var(--green);
    --danger: var(--red);
    --warning: var(--amber);
    --info: var(--blue);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-sm:
        0 2px 8px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(139, 124, 246, 0.02);
    --shadow-md:
        0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(139, 124, 246, 0.03);
    --shadow-lg:
        0 16px 48px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(139, 124, 246, 0.04);
    --shadow-xl:
        0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(139, 124, 246, 0.05);
    --shadow-glow: 0 0 20px rgba(139, 124, 246, 0.06);
    --shadow-island:
        0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(139, 124, 246, 0.06);

    --radius-xs: 16px;
    --radius-sm: 22px;
    --radius-md: 28px;
    --radius-lg: 36px;
    --radius-xl: 44px;
    --radius-2xl: 56px;
    --radius-full: 9999px;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --trans: 0.2s var(--ease);
    --trans-slow: 0.3s var(--ease);

    --nav-width: 68px;
    --sidebar-width: 440px;
    --topbar-h: 56px;
    --composer-h: 64px;
}

/* ═══ THEME TRANSITION ═══ */
html.theme-flip,
html.theme-flip body,
html.theme-flip .app-layout,
html.theme-flip .sidebar,
html.theme-flip .chat-view,
html.theme-flip .topbar,
html.theme-flip .composer-panel {
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease !important;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
}

html,
body,
input,
button,
textarea,
select,
optgroup {
    font-family: var(--font-family, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif) !important;
}

.fa, .fas, .far, .fal, .fab, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"], i[class*="fa-"]::before, span[class*="fa-"]::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

body {
    background: var(--bg-deep);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 5px;
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}

/* ═══ AUTH ═══ */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
    background-image:
        radial-gradient(
            ellipse at 20% 50%,
            rgba(139, 124, 246, 0.08) 0%,
            transparent 60%
        ),
        radial-gradient(
            ellipse at 80% 20%,
            rgba(129, 140, 248, 0.06) 0%,
            transparent 55%
        ),
        radial-gradient(
            ellipse at 50% 80%,
            rgba(52, 211, 153, 0.04) 0%,
            transparent 55%
        );
    position: relative;
}
.auth-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 1;
}
.auth-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.1;
    animation: orbFloat 22s var(--ease) infinite;
}
.bg-orb.orb-1 {
    width: 550px;
    height: 550px;
    background: var(--accent);
    top: -15%;
    left: -15%;
}
.bg-orb.orb-2 {
    width: 450px;
    height: 450px;
    background: var(--blue);
    bottom: -15%;
    right: -15%;
    animation-delay: -7s;
}
.bg-orb.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--green);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}
@keyframes orbFloat {
    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(35px, -20px) scale(1.06);
    }
    50% {
        transform: translate(-20px, 30px) scale(0.95);
    }
    75% {
        transform: translate(20px, 15px) scale(1.03);
    }
}

.auth-card {
    display: flex;
    width: 960px;
    max-width: 100%;
    min-height: 600px;
    background: rgba(14, 18, 28, 0.88);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-2xl);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 24px 80px rgba(0, 0, 0, 0.3),
        0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
    animation: cardAppear 0.6s var(--spring);
}
.auth-card > * {
    position: relative;
    z-index: 2;
}
@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-left {
    width: 45%;
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(
        160deg,
        rgba(139, 124, 246, 0.07) 0%,
        rgba(129, 140, 248, 0.04) 50%,
        rgba(52, 211, 153, 0.05) 100%
    );
    border-right: 1px solid var(--border-subtle);
}
.auth-left::after {
    content: "";
    position: absolute;
    top: -40%;
    right: -25%;
    width: 70%;
    height: 180%;
    background: radial-gradient(circle, rgba(139, 124, 246, 0.1), transparent);
    pointer-events: none;
}
.auth-brand {
    text-align: center;
    margin-bottom: 3rem;
}
.auth-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: rgba(139, 124, 246, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: float 4.5s var(--ease) infinite;
}
@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}
.auth-icon-wrapper i {
    font-size: 2.2rem;
    color: var(--accent);
}
.auth-logo-text {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    background: linear-gradient(
        135deg,
        var(--accent) 0%,
        var(--accent-light) 50%,
        var(--green) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}
.auth-brand p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.auth-features {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.auth-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: var(--bg-island);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: var(--trans);
}
.auth-feature:hover {
    background: var(--bg-elevated);
    border-color: var(--border-light);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}
.auth-feature i {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 1rem;
}
.auth-feature span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.auth-right {
    width: 55%;
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-tabs {
    display: flex;
    gap: 0.4rem;
    background: var(--bg-island);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.3rem;
    margin-bottom: 2.5rem;
}
.auth-tab {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans);
}
.auth-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.auth-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.25rem;
}
.auth-form.active {
    display: flex;
    animation: formSlideIn 0.4s var(--spring);
}
@keyframes formSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.input-group {
    position: relative;
}
.input-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    z-index: 1;
    pointer-events: none;
    transition: var(--trans);
}
.input-group input {
    width: 100%;
    padding: 1rem 1.2rem 1rem 3rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--trans);
}
.input-group input:focus {
    border-color: rgba(139, 124, 246, 0.3);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(139, 124, 246, 0.04);
}
.input-group input:focus ~ .input-icon,
.input-group input:focus + .input-icon {
    color: var(--accent);
}
.input-group input::placeholder {
    color: var(--text-muted);
}

.toggle-pass {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    font-size: 0.95rem;
    border-radius: var(--radius-xs);
    transition: var(--trans);
}
.toggle-pass:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trans);
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 16px rgba(139, 124, 246, 0.15);
}
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 8px 24px rgba(139, 124, 246, 0.2);
}
.btn-submit:active {
    transform: translateY(0);
}
.btn-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.password-strength {
    margin-top: -0.25rem;
}
.strength-bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}
.strength-bar span {
    display: block;
    height: 100%;
    width: 0;
    transition:
        width 0.4s var(--ease),
        background 0.4s var(--ease);
    border-radius: 3px;
}
.password-strength small {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}
.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    min-height: 1.2rem;
    font-weight: 500;
}
.auth-version {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.5;
}
/* ═══ MESSENGER LAYOUT ═══ */
.messenger-body {
    height: 100vh;
    background: var(--bg-base);
}
.app-layout {
    display: flex;
    height: 100vh;
}
.sidebar-dsearch {
    padding: 14px 14px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.dsearch-pill {
    flex: 1;
    display: flex;
    align-items: center;
    height: 40px;
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    padding: 0 4px 0 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    gap: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08), inset 0 0.5px 0.5px rgba(255,255,255,0.12);
}
.dsearch-pill:focus-within {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 2px 8px rgba(99, 102, 241, 0.08);
}
.dsearch-icon {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    display: flex;
    opacity: 0.7;
}
.dsearch-pill:focus-within .dsearch-icon {
    color: var(--accent);
    opacity: 1;
}
.dsearch-field {
    flex: 1;
    min-width: 0;
}
.dsearch-field input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 450;
    letter-spacing: -0.01em;
    outline: none;
    padding: 0;
}
.dsearch-field input::placeholder {
    color: var(--text-muted);
    opacity: 0.55;
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}
.dsearch-clear {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    transition: all 0.2s var(--spring);
    flex-shrink: 0;
}
.dsearch-clear.visible {
    display: flex;
}
.dsearch-clear:hover {
    background: var(--text-muted);
    color: var(--bg-base);
    transform: scale(1.12);
}
.dsearch-new {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border: none;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), #6d5ed6);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.35s var(--spring);
    flex-shrink: 0;
    box-shadow:
        0 4px 16px rgba(139, 124, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    position: relative;
    overflow: hidden;
}
.dsearch-new::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at 30% 20%,
        rgba(255, 255, 255, 0.25),
        transparent 60%
    );
    opacity: 0;
    transition: opacity 0.25s;
}
.dsearch-new:hover {
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}
.dsearch-new:hover::after {
    opacity: 1;
}
.dsearch-new:active {
    transform: scale(0.93);
}

/* ===== TABS — Pill Style ===== */
.sidebar-tabs {
    display: flex;
    gap: 3px;
    padding: 0 14px 6px;
    flex-shrink: 0;
}
.sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 8px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    position: relative;
}
.sidebar-tab i {
    font-size: 0.74rem;
    transition: transform 0.25s var(--spring);
    opacity: 0.6;
}
.sidebar-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
}
.sidebar-tab.active {
    color: var(--accent);
    font-weight: 600;
    background: rgba(139, 124, 246, 0.06);
}
.sidebar-tab.active i {
    opacity: 1;
    transform: scale(1.08);
}
.sidebar-tab:active {
    transform: scale(0.95);
}

/* ===== CONTENT — Clean ===== */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) transparent;
}
.sidebar-content::-webkit-scrollbar {
    width: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}
#chats-list,
#contacts-list {
    transition: opacity 0.2s var(--ease);
}

/* ===== ANIMATIONS ===== */
@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PINNED DIVIDER ===== */
.pinned-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 2px;
    animation: fadeSlideIn 0.3s var(--ease) both;
}
.pinned-divider::before,
.pinned-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.04) 30%,
        transparent
    );
}
.pinned-divider span {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    opacity: 0.4;
    display: flex;
    align-items: center;
    gap: 5px;
}
.pinned-divider span i {
    font-size: 0.48rem;
    opacity: 0.3;
}

/* ===== CHAT ITEMS — Premium ===== */
.chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    margin-bottom: 1px;
    cursor: pointer;
    border-radius: 12px;
    transition:
        background 0.2s var(--ease),
        transform 0.25s var(--spring),
        box-shadow 0.2s var(--ease);
}
.chat-item:hover {
    background: rgba(255, 255, 255, 0.025);
    transform: translateX(4px);
}
.chat-item:active {
    transform: translateX(0) scale(0.97);
}
.chat-item.pinned {
    background: linear-gradient(
        135deg,
        rgba(139, 124, 246, 0.015),
        transparent
    );
}
.chat-item.pinned:hover {
    background: rgba(255, 255, 255, 0.025);
}
.chat-item:hover .chat-avatar {
    transform: scale(1.06);
}
.chat-item.active {
    background: rgba(255, 255, 255, 0.025);
    position: relative;
}
.chat-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.chat-item.active .chat-name {
    color: var(--accent-light);
}
.chat-item.active .chat-avatar {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 0 0 2px var(--accent);
}
.chat-item.animate-in {
    animation: chatSlideIn 0.5s var(--spring) both;
    animation-delay: calc(var(--i, 0) * 25ms);
}

/* --- Liquid Glass Avatar (taste-skill 5.A — inner border + inner shadow) --- */
.chat-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 8px rgba(139, 124, 246, 0.15);
    transition:
        transform 0.25s var(--spring),
        box-shadow 0.2s var(--ease);
    overflow: hidden;
}
.chat-avatar::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at 25% 20%,
        rgba(255, 255, 255, 0.15),
        transparent 50%
    );
    pointer-events: none;
}
.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
    position: relative;
    z-index: 1;
}
.chat-avatar.online::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    background: var(--green);
    border: 2px solid rgba(12, 15, 25, 0.85);
    border-radius: 50%;
    z-index: 2;
}
.chat-info {
    flex: 1;
    min-width: 0;
}
.chat-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    letter-spacing: -0.01em;
}
.chat-preview {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.chat-sent-preview .chat-status-icon {
    margin-right: 3px;
    font-size: 0.62rem;
    color: rgba(195, 190, 211, 0.62);
    vertical-align: 1px;
}
.chat-sent-preview .chat-status-icon.is-delivered {
    color: rgba(116, 222, 181, 0.92);
}
.chat-sent-preview .chat-status-icon.is-read {
    color: rgb(191, 164, 255);
}
[data-theme="light"] .chat-sent-preview .chat-status-icon {
    color: rgba(84, 78, 103, 0.72);
}
[data-theme="light"] .chat-sent-preview .chat-status-icon.is-delivered {
    color: rgb(30, 139, 101);
}
[data-theme="light"] .chat-sent-preview .chat-status-icon.is-read {
    color: rgb(103, 75, 201);
}
.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 4px;
}
.chat-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.01em;
}
.unread-badge {
    background: var(--accent);
    color: #fff;
    font-size: 0.58rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
}
.chat-pin-icon {
    font-size: 0.52rem;
    color: var(--accent);
    margin-right: 3px;
    vertical-align: middle;
    opacity: 0.45;
}

/* ===== SEARCH RESULTS ===== */
.sidebar-search-results {
    margin: 0 6px 6px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-lg);
}
.sidebar-search-results::-webkit-scrollbar {
    width: 3px;
}
.sidebar-search-results::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

/* ===== CHANNEL AVATAR ===== */
.channel-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #f59e0b, #d97706);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 8px rgba(245, 158, 11, 0.15);
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   SIDEBAR DOCK — Integrated bottom bar
   Taste-skill: minimal, no card borders
   ═══════════════════════════════════════════ */
.sidebar-dock {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent !important;
    border-radius: 0 0 28px 28px;
}
.dock-profile {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    min-width: 0;
}
.dock-profile:hover {
    background: var(--bg-hover);
}
.dock-profile:active {
    transform: scale(0.97);
}
.dock-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: #fff;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 6px rgba(139, 124, 246, 0.12);
    transition: all 0.25s var(--spring);
}
.dock-avatar::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 0;
    width: 7px;
    height: 7px;
    background: var(--green);
    border: 2px solid rgba(12, 15, 25, 0.85);
    border-radius: 50%;
}
.dock-profile:hover .dock-avatar {
    transform: scale(1.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 0 0 2px rgba(139, 124, 246, 0.12),
        0 4px 12px rgba(139, 124, 246, 0.1);
}
.dock-info {
    flex: 1;
    min-width: 0;
}
.dock-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.dock-status {
    font-size: 0.64rem;
    color: var(--green);
    font-weight: 500;
    line-height: 1.1;
}
.dock-chevron {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.48rem;
    opacity: 0.2;
    transition: all 0.3s var(--spring);
    flex-shrink: 0;
}
.dock-profile:hover .dock-chevron {
    opacity: 0.5;
    transform: translateX(3px);
}
.dock-trailing {
    display: flex;
    align-items: center;
    gap: 1px;
}
.dock-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
    position: relative;
    font-size: 0.82rem;
}
.dock-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.dock-btn:active {
    transform: scale(0.92);
}
.dock-btn i {
    transition: transform 0.2s var(--spring);
}
.dock-btn:hover i {
    transform: scale(1.1);
}
.dock-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.account-switcher {
    position: fixed;
    background: var(--glass-xl);
    backdrop-filter: blur(32px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    padding: 0.4rem;
    opacity: 0;
    transform: translateY(-6px);
    transition: all 0.2s var(--spring);
    min-width: 240px;
}
.account-switcher.ac-flip {
    transform: translateY(6px);
}
.account-switcher.open {
    opacity: 1;
    transform: translateY(0);
}
.ac-current {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.55rem 0.7rem;
}
.ac-current-info {
    flex: 1;
    min-width: 0;
}
.ac-current-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ac-head {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.3rem 0.55rem 0.2rem;
}
.ac-action {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}
.ac-action i {
    width: 20px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.ac-action:hover {
    background: var(--bg-elevated);
}
.ac-action:hover i {
    color: var(--accent);
}
.ac-logout {
    color: var(--danger);
}
.ac-logout i {
    color: var(--danger);
}
.ac-logout:hover {
    background: color-mix(in srgb, var(--danger) 10%, transparent);
}
.ac-logout:hover i {
    color: var(--danger);
}
.ac-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.1s;
}
.ac-row:hover {
    background: var(--bg-elevated);
}
.ac-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.ac-fb {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: #fff;
}
.ac-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.8rem;
}
.ac-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.2rem 0.5rem;
}

/* ===== FOLDER SECTIONS (inline in chat list) ===== */
.folder-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
}
.folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    border-radius: var(--radius-sm);
    margin: 0 4px;
}
.folder-header:hover {
    background: rgba(255, 255, 255, 0.025);
}
.folder-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.folder-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-count {
    font-size: 0.58rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 600;
}
.folder-arrow {
    font-size: 0.5rem;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease);
}
.folder-section.open .folder-arrow {
    transform: rotate(180deg);
}
.folder-chats {
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
    max-height: 2000px;
}
.folder-section:not(.open) .folder-chats {
    max-height: 0;
}
.folders-edit-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin: 4px 10px;
    background: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s;
}
.folders-edit-btn:hover {
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.08);
}

/* ===== CHAT SECTION HEADERS ===== */
.chat-section {
    margin-bottom: 2px;
}
.chat-section-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 3px;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    opacity: 0.45;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--trans);
    border: none;
    outline: none;
}
.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow:
        0 4px 12px rgba(139, 124, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(139, 124, 246, 0.2);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}
.btn-secondary {
    background: var(--bg-island);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-elevated);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-island);
    color: var(--text-primary);
}
.btn-danger {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
}
.btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.45);
}
.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.76rem;
}
.btn-profile {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    border-radius: 12px;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.3rem;
}
.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-island);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--trans);
    font-size: 0.9rem;
}
.btn-icon:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-light);
    transform: scale(1.04);
    box-shadow: var(--shadow-sm);
}
.btn-icon-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}
.btn-icon-xs {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
    border-radius: var(--radius-sm);
}
/* ═══ MAIN AREA ═══ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent !important;
    min-width: 0;
    position: relative;
}

/* Empty state — premium soft-ui */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}
.has-open-chat #empty-state {
    display: none;
}
@keyframes emptyFadeSlide {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes emptyGlowPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50%      { transform: scale(1.08); opacity: 0.7; }
}
.empty-bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 420px;
    height: 420px;
    margin: -210px 0 0 -210px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    animation: emptyGlowPulse 6s var(--ease) infinite;
    pointer-events: none;
}
.empty-avatar {
    position: relative;
    z-index: 1;
    width: 100px;
    height: 100px;
    margin-bottom: 1.25rem;
    animation: emptyFadeSlide 0.5s var(--ease) both;
}
.empty-avatar-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-light) 40%, transparent 70%);
    mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px));
    opacity: 0.5;
}
.empty-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    font-weight: 700;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 6px 24px rgba(139, 124, 246, 0.15);
    background-size: cover;
    background-position: center;
    position: relative;
}
.empty-avatar-inner i {
    font-size: 2rem;
}
.empty-avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #34d399;
    border: 3px solid var(--bg-base);
    box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2);
}
.empty-text {
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
    animation: emptyFadeSlide 0.5s var(--ease) 0.06s both;
}
.empty-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.15rem;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.empty-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}
.empty-cards {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
    animation: emptyFadeSlide 0.5s var(--ease) 0.12s both;
}
.empty-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: color-mix(in srgb, var(--text-primary) 2%, transparent);
    border: 1px solid color-mix(in srgb, var(--text-primary) 4%, transparent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s var(--spring);
    font-family: inherit;
    color: var(--text-secondary);
    text-align: left;
    min-width: 0;
    flex: 1;
    backdrop-filter: blur(4px);
}
.empty-card-ico {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s var(--spring);
}
.empty-card-ico i {
    font-size: 0.82rem;
    color: var(--accent);
    transition: all 0.25s var(--spring);
}
.empty-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.empty-card-lbl {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.empty-card-desc {
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1.2;
}
.empty-card-arr {
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.25s var(--spring);
    flex-shrink: 0;
}
.empty-card:hover {
    background: color-mix(in srgb, var(--text-primary) 4%, transparent);
    border-color: color-mix(in srgb, var(--accent) 15%, transparent);
    transform: translateY(-2px);
    color: var(--text-primary);
}
.empty-card:hover .empty-card-ico {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.empty-card:hover .empty-card-ico i {
    color: var(--accent-light);
}
.empty-card:hover .empty-card-arr {
    opacity: 0.5;
    transform: translateX(0);
    color: var(--accent);
}
.empty-card:active {
    transform: translateY(0) scale(0.97);
}
.empty-footer {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: 0.55rem;
    color: var(--text-muted);
    opacity: 0.18;
    animation: emptyFadeSlide 0.5s var(--ease) 0.18s both;
}
.empty-footer strong {
    color: var(--accent);
    font-weight: 600;
}
.empty-footer-author {
    font-size: 1.5em;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Chat view */
.chat-view {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    animation: fadeUp 0.35s var(--ease);
    z-index: 1;
}
.chat-view .messages-container {
    transition: background 0.3s var(--ease);
}
/* ═══ SINGLE UNIFIED VIEWPORT BACKGROUND ═══ */
#app,
body,
.app-layout {
    background-color: #060812;
    background-image:
        radial-gradient(ellipse at 10% 20%, rgba(99, 102, 241, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 75%, rgba(168, 85, 247, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 10%, rgba(59, 130, 246, 0.12) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 85%, rgba(236, 72, 153, 0.08) 0%, transparent 45%);
    background-attachment: fixed !important;
    background-size: cover !important;
    background-position: center !important;
    position: relative;
}

/* Then apply the actual background on .app-layout */
.app-layout.has-bg {
    background-image: var(--chat-bg) !important;
    background-size: var(--chat-bg-size, cover) !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-repeat: var(--chat-bg-repeat, no-repeat) !important;
}

body.has-bg {
    background-image: var(--chat-bg) !important;
    background-size: var(--chat-bg-size, cover) !important;
    background-position: center !important;
    background-attachment: fixed !important;
    background-repeat: var(--chat-bg-repeat, no-repeat) !important;
}

/* Тёмный градиент поверх фона для глубины */
.app-layout.has-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(
        180deg,
        rgba(6, 8, 18, 0.06) 0%,
        rgba(6, 8, 18, 0) 30%,
        rgba(6, 8, 18, 0) 70%,
        rgba(6, 8, 18, 0.12) 100%
    );
    pointer-events: none;
}

[data-theme="light"] .app-layout.has-bg::after {
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.02) 0%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0) 70%,
        rgba(0, 0, 0, 0.04) 100%
    );
}

/* ALL INTERNAL PANELS ARE 100% TRANSLUCENT GLASS (NO DUPLICATED REPEATING WALLPAPERS) */
.main-area,
.chat-view,
.messages-container,
.chat-topbar,
.composer,
.empty-state {
    background: transparent !important;
    background-image: none !important;
}

.main-area::after,
.chat-view::after {
    display: none !important;
}

/* Слой анимации смены фона — накладывается поверх .app-layout и плавно исчезает */
.bg-fade {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 1;
    transition: opacity 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.bg-fade.fade-out {
    opacity: 0;
}

/* Chat topbar */
.chat-topbar {
    padding: 0.75rem 1.35rem;
    background: rgba(18, 18, 30, 0.78);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.chat-topbar::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(99, 102, 241, 0.35) 25%, 
        rgba(168, 85, 247, 0.35) 75%, 
        transparent 100%
    );
    pointer-events: none;
}
.chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    transition: all 0.2s var(--ease);
}
.chat-back-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #fff;
    transform: translateX(-2px);
}
.chat-partner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 0.35rem 0.75rem;
    margin: 0 -0.5rem;
    transition: all 0.2s var(--ease);
}
.chat-partner:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}
.partner-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: transform 0.2s var(--spring);
}
.chat-partner:hover .partner-avatar {
    transform: scale(1.04);
}
.partner-avatar::after {
    content: none;
}
.partner-avatar.online::after {
    content: "";
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2.5px solid var(--bg-surface, #12121e);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.9);
    animation: statusPulse 2s infinite;
}
@keyframes statusPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8); }
    70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.partner-info h3 {
    font-size: 1.02rem;
    font-weight: 600;
    margin-bottom: 0.08rem;
    letter-spacing: -0.015em;
    color: var(--text-primary, #ffffff);
}
.partner-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}
.partner-status i {
    font-size: 0.45rem;
    color: #10b981;
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.6));
}
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    position: relative;
}
.partner-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.topbar-smart-chips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0.5rem;
}
.topbar-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.75rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.topbar-chip:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}
.topbar-chip i {
    font-size: 0.75rem;
    color: var(--accent);
}
.topbar-action-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}
.topbar-action-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.25);
}
.topbar-action-btn:active {
    transform: scale(0.95);
}
.topbar-action-btn.active {
    background: rgba(99, 102, 241, 0.22);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a855f7;
}

/* Pinned */
.pinned-banner {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 1.35rem;
    background: rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    transition: all 0.25s var(--ease);
}
.pinned-banner::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3.5px;
    background: linear-gradient(180deg, #6366f1, #a855f7);
    border-radius: 0 2px 2px 0;
}
.pinned-banner i {
    color: var(--accent);
    font-size: 0.9rem;
    filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.4));
}
.pinned-content {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    transition: opacity 0.15s;
}
.pinned-content:hover {
    opacity: 0.85;
}
.pinned-label {
    font-size: 0.68rem;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.pinned-label .pinned-counter {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}
.pinned-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Prevent text selection on mobile for proper long-press context menu */
.messages-list,
#chats-list {
    -webkit-user-select: none;
    user-select: none;
}

/* Pinned chats in sidebar */
.chat-item.pinned {
    position: relative;
}
.chat-item.pinned::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 3px;
    background: var(--accent);
    opacity: 0.6;
}
.chat-pin-icon {
    font-size: 0.6rem;
    color: var(--accent);
    margin-right: 0.3rem;
    vertical-align: middle;
    opacity: 0.7;
}

/* Pinned messages list modal */
.pinned-msg-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}
.pinned-msg-item:last-child {
    border-bottom: none;
}
.pinned-msg-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.2rem;
}
.pinned-msg-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
    margin-bottom: 0.2rem;
}
.pinned-msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}
.pinned-msg-actions {
    display: flex;
    gap: 0.5rem;
}

/* Sidebar notification (new device login) */
.sidebar-notif {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0.35rem 0.6rem;
    padding: 0.6rem 0.7rem;
    background: var(--glass-sm);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    box-shadow: var(--shadow-xs);
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.sidebar-notif-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-notif-icon i {
    font-size: 0.75rem;
    color: var(--accent);
}
.sidebar-notif-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}
.sidebar-notif-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
}
.sidebar-notif-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.sidebar-notif-actions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.35rem;
}
.sidebar-notif-btn {
    padding: 0.25rem 0.55rem;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}
.sidebar-notif-confirm {
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
}
.sidebar-notif-confirm:hover {
    background: rgba(52, 211, 153, 0.18);
}
.sidebar-notif-deny {
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
}
.sidebar-notif-deny:hover {
    background: rgba(248, 113, 113, 0.16);
}
.sidebar-notif-close {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
}

/* ═══ MESSAGES ═══ */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    position: relative;
    scroll-behavior: smooth;
}
.messages-container::-webkit-scrollbar {
    width: 6px;
}
.messages-container::-webkit-scrollbar-track {
    background: transparent;
}
.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
    transition: background 0.2s;
}
.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.date-indicator {
    position: sticky;
    top: 8px;
    z-index: 10;
    display: flex;
    justify-content: center;
    pointer-events: none;
    margin-bottom: -2rem;
    opacity: 1;
    transition: opacity 0.35s ease;
}
.date-indicator span {
    background: rgba(22, 22, 36, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.62rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 0.04rem;
    min-height: 100%;
    transition: opacity 0.25s ease-out;
}

.scroll-bottom-hint {
    position: absolute;
    bottom: 72px;
    right: 16px;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: var(--glass-xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.85) translateY(10px);
    transition:
        opacity 0.2s ease,
        transform 0.25s var(--spring);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    color: var(--text-secondary);
    font-size: 1rem;
}
.scroll-bottom-hint.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
@keyframes scrollHintBounce {
    0%,
    100% {
        transform: scale(1) translateY(0);
    }
    50% {
        transform: scale(1) translateY(-3px);
    }
}
.scroll-bottom-hint:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: none;
    transform: scale(1.08);
}
.voice-badge {
    position: absolute;
    bottom: 120px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #34d399, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.85) translateY(10px);
    transition:
        opacity 0.2s ease,
        transform 0.25s var(--spring);
    pointer-events: none;
    z-index: 10;
    box-shadow:
        0 3px 14px rgba(52, 211, 153, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.85rem;
}
.voice-badge.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
@keyframes voiceBadgePulse {
    0%,
    100% {
        box-shadow:
            0 3px 14px rgba(52, 211, 153, 0.35),
            inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
    50% {
        box-shadow:
            0 3px 18px rgba(52, 211, 153, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}
.voice-badge:hover {
    transform: scale(1.12);
    box-shadow:
        0 5px 20px rgba(52, 211, 153, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: none;
}

/* Message wrapper */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    margin-bottom: 0.18rem;
    position: relative;
    transition: transform 0.15s var(--ease);
    content-visibility: auto;
    contain-intrinsic-size: 56px;
    animation: msgFadeIn 0.2s ease-out both;
}
.message-wrapper:nth-last-child(-n+3) {
    animation: msgSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.message-wrapper.new-message {
    animation: msgSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.message-wrapper.swiping {
    transition: none;
}
.message-wrapper.swipe-reply {
    transform: translateX(40px);
}
.message-wrapper.swipe-reply::before {
    content: "\f3e5";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--accent);
    opacity: 0;
    transition: opacity 0.15s;
}
.message-wrapper.swipe-reply::before {
    opacity: 1;
}
.message-wrapper.swipe-confirmed {
    transform: translateX(60px);
}
.message-wrapper.swipe-confirmed::before {
    opacity: 1;
}
.message-wrapper.swipe-back {
    transition: transform 0.3s var(--spring);
    transform: translateX(0);
}
.message-wrapper.sent {
    align-self: flex-end;
    align-items: flex-end;
}
.message-wrapper.received {
    align-self: flex-start;
    align-items: flex-start;
}
/* Grouped messages */
.message-wrapper.grouped {
    margin-top: -0.06rem;
}
.message-wrapper.grouped .message-sender-name {
    display: none;
}
.message-wrapper.grouped .message-bubble {
    border-top-right-radius: 0.3rem;
    border-top-left-radius: 0.3rem;
}
.message-wrapper.group-first .message-bubble {
    border-top-right-radius: 1.2rem;
    border-top-left-radius: 1.2rem;
}
.message-wrapper.group-first.received .message-bubble {
    border-top-left-radius: 1.2rem;
}
.message-wrapper.group-first.sent .message-bubble {
    border-top-right-radius: 1.2rem;
}
.message-wrapper.group-last {
    margin-bottom: 0.35rem;
}

/* Media-only bubble (Telegram-style — no padding/background) */
.message-bubble.media-only {
    padding: 0;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}
.message-bubble.media-only::before,
.message-bubble.media-only::after {
    display: none;
}
.message-bubble.media-only .media-wrap {
    border-radius: var(--bubble-radius, 1.2rem);
}
/* Message bubble */
.message-bubble-wrapper {
    position: relative;
    transition: transform 0.18s var(--ease);
}
.message-bubble {
    padding: 0.7rem 1.15rem;
    border-radius: var(--bubble-radius, 1.25rem);
    font-size: var(--msg-font-size, 0.92rem);
    line-height: 1.52;
    word-wrap: break-word;
    position: relative;
    transition: all 0.22s var(--ease);
}
.message-wrapper.sent .message-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 50%, #4f46e5 100%);
    color: #ffffff;
    border-bottom-right-radius: var(--bubble-tail-sent, 0.35rem);
    box-shadow:
        0 6px 20px rgba(99, 102, 241, 0.38),
        0 2px 6px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.message-wrapper.received .message-bubble {
    background: rgba(26, 26, 42, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: var(--text-primary, #f1f5f9);
    border-bottom-left-radius: var(--bubble-tail-rec, 0.35rem);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 6px 22px rgba(0, 0, 0, 0.25),
        0 1px 4px rgba(0, 0, 0, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.message-text {
    white-space: pre-wrap;
    word-break: break-word;
}
.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.67rem;
    margin-top: 0.15rem;
    padding: 0 0.35rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: -0.01em;
}
.message-wrapper.sent .message-meta {
    color: rgba(255, 255, 255, 0.65);
}
.message-edited-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-style: italic;
}
.message-wrapper.sent .message-edited-label {
    color: rgba(255, 255, 255, 0.5);
}
.message-status {
    font-size: 0.65rem;
    display: inline-flex;
    align-items: center;
}
.message-wrapper.sent .message-status {
    color: rgba(255, 255, 255, 0.9);
}
.message-wrapper.received .message-status {
    color: var(--accent);
}

/* Date divider */
.messages-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.75rem 0 0.3rem;
    gap: 0.85rem;
    pointer-events: none;
}
.messages-date-divider:first-child {
    margin-top: 0.3rem;
}
.messages-date-divider::before,
.messages-date-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.07),
        transparent
    );
}
.messages-date-divider span {
    background: rgba(22, 22, 36, 0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.24rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    color: var(--text-secondary, rgba(255, 255, 255, 0.7));
    font-weight: 600;
    letter-spacing: 0.03em;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
}

/* Deleted */
.message-deleted {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    border: 1px dashed var(--border-light);
    background: color-mix(in srgb, var(--bg-input) 60%, transparent);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Reply preview in bubble */
.message-reply-preview {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px 7px 12px;
    margin-bottom: 7px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.14);
    border-left: 3px solid var(--accent);
    cursor: pointer;
    position: relative;
    transition: background 0.15s, transform 0.15s var(--ease);
}
.message-reply-preview::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--accent);
    border-radius: 1px;
    opacity: 0.6;
}
.message-wrapper.sent .message-reply-preview {
    background: rgba(255, 255, 255, 0.08);
    border-left-color: rgba(255, 255, 255, 0.5);
}
.message-wrapper.sent .message-reply-preview::before {
    background: rgba(255, 255, 255, 0.45);
}
.message-reply-preview:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateX(2px);
}
.message-wrapper.sent .message-reply-preview:hover {
    background: rgba(255, 255, 255, 0.14);
}
.message-reply-preview .reply-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    font-size: 1.1rem;
    color: var(--text-muted);
}
.message-reply-preview .reply-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.message-forwarded-label {
    font-size: 0.68rem;
    color: var(--accent-light);
    padding: 0 0.2rem 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.message-forwarded-label .forward-name {
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.message-forwarded-label .forward-name:hover {
    color: var(--accent);
}
.message-wrapper.sent .message-forwarded-label {
    color: rgba(255, 255, 255, 0.6);
}
.message-wrapper.sent .message-forwarded-label .forward-name {
    color: rgba(255, 255, 255, 0.8);
}
.message-wrapper.sent .message-forwarded-label .forward-name:hover {
    color: #fff;
}

/* Link preview card */
.link-preview-card {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-faint);
    background: var(--bg-glass);
    transition: all 0.15s;
}
.link-preview-card:hover {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
}
.link-preview-image {
    width: 100%;
    max-height: 160px;
    overflow: hidden;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.link-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.link-preview-info {
    padding: 0.5rem 0.65rem 0.55rem;
}
.link-preview-domain {
    font-size: 0.6rem;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 3px;
}
.link-preview-domain i {
    font-size: 0.55rem;
    margin-right: 2px;
}
.link-preview-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.link-preview-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.message-wrapper.sent .link-preview-card {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}
.message-wrapper.sent .link-preview-card:hover {
    background: rgba(255, 255, 255, 0.1);
}
.message-wrapper.sent .link-preview-domain {
    color: rgba(255, 255, 255, 0.45);
}
.message-wrapper.sent .link-preview-title {
    color: #fff;
}
.message-wrapper.sent .link-preview-desc {
    color: rgba(255, 255, 255, 0.5);
}
.message-wrapper.sent .reply-thumb {
    background: rgba(255, 255, 255, 0.1);
}
.reply-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 36px;
}
.reply-body .reply-name {
    font-weight: 700;
    font-size: 0.68rem;
    color: var(--accent);
    margin-bottom: 2px;
    letter-spacing: 0.01em;
}
.message-wrapper.sent .reply-name {
    color: rgba(255, 255, 255, 0.85);
}
.reply-body .reply-text {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-body .reply-text i {
    margin-right: 3px;
}
.message-wrapper.sent .reply-text {
    color: rgba(255, 255, 255, 0.5);
}
@keyframes replyPulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(120, 90, 240, 0);
        background: transparent;
    }
    50% {
        box-shadow: 0 0 0 4px rgba(120, 90, 240, 0.2);
        background: rgba(120, 90, 240, 0.05);
    }
}
.message-wrapper.sent.reply-highlight {
    animation: replyPulseSent 1.5s ease;
}
@keyframes replyPulseSent {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.15);
    }
}

/* Reply bar */
.reply-bar {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.55rem 1rem 0.5rem;
    background: var(--bg-island);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
    position: relative;
}
.reply-bar::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}
.reply-bar .reply-icon {
    width: 22px;
    text-align: center;
    color: var(--accent);
    font-size: 0.75rem;
    padding-top: 1px;
}
.reply-bar .reply-info {
    flex: 1;
    min-width: 0;
}
.reply-bar .reply-header {
    font-size: 0.68rem;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 1px;
    letter-spacing: 0.01em;
}
.reply-bar .reply-text {
    font-size: 0.74rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reply-bar .reply-text i {
    margin-right: 3px;
}
.reply-bar .reply-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05rem;
    margin-top: -1px;
    transition: all 0.15s;
}
.reply-bar .reply-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}
[data-theme="light"] .message-reply-preview {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .message-reply-preview:hover {
    background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .message-reply-preview .reply-thumb {
    background: rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .reply-bar {
    background: #fff;
    border-top-color: var(--border-medium);
}

/* Selection toolbar */
.selection-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.55rem 1.25rem;
    background: rgba(255, 255, 255, 0.015);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.selection-count {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.85rem;
}
.selection-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}
.message-wrapper.selected-for-delete {
    outline: 2px solid var(--accent);
    border-radius: var(--radius-md);
    outline-offset: 2px;
}
.message-wrapper.dimmed {
    opacity: 0.4;
}

/* Chat search bar */
.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.chat-search-bar i {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.chat-search-bar input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.chat-search-count {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}
.message-search-highlight {
    background: rgba(139, 124, 246, 0.3);
    border-radius: 2px;
    padding: 0 1px;
}
.message-wrapper.search-match {
    box-shadow: 0 0 0 2px var(--accent-soft);
    border-radius: var(--radius-md);
}
.message-wrapper.search-highlighted {
    box-shadow: 0 0 0 2px var(--accent);
}

/* ═══ PREMIUM COMPOSER ═══ */
.composer {
    padding: 0.65rem 1rem 0.75rem 1rem;
    background: linear-gradient(
        180deg,
        rgba(20, 22, 36, 0.82) 0%,
        rgba(14, 16, 28, 0.92) 100%
    );
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.composer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 2rem;
    right: 2rem;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139, 124, 246, 0.4), rgba(99, 102, 241, 0.6), rgba(139, 124, 246, 0.4), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}
.composer:focus-within::before {
    opacity: 1;
}

/* Input Capsule */
.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    padding: 0 0.5rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 0 0 transparent;
    min-height: 44px;
    box-sizing: border-box;
}
.input-wrapper:focus-within {
    border-color: rgba(139, 124, 246, 0.55);
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 0 3px rgba(139, 124, 246, 0.2),
                0 8px 28px rgba(0, 0, 0, 0.35),
                inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary, #f8fafc);
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    padding: 0.55rem 0.4rem;
    line-height: 1.35;
    max-height: 150px;
    margin: 0;
    align-self: center;
    box-sizing: border-box;
}
.input-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.38);
    font-weight: 400;
    line-height: 1.35;
}

/* Inner action icons — вся кнопка кликабельна (не только верхняя часть) */
.composer-inner-btn {
    width: 44px;
    height: 100%;
    min-height: 44px;
    border-radius: 14px;
    background: transparent;
    border: none;
    color: rgba(241, 245, 249, 0.65);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    margin: 0;
    align-self: stretch;
    padding: 0;
    position: relative;
    box-sizing: border-box;
}
.composer-inner-btn:hover {
    color: var(--accent, #8b7cf6);
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.1);
}
.composer-inner-btn:active {
    transform: scale(0.92);
}
#ephemeral-btn.active,
#ephemeral-btn i.fa-solid {
    color: #a78bfa !important;
    filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.7));
}

/* Send/Mic button wrapper */
.composer-send-wrapper {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    margin: 0;
    align-self: flex-end;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn,
.mic-inline {
    position: absolute;
    top: 0;
    left: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.22s ease,
                background 0.2s ease,
                box-shadow 0.2s ease;
}

.mic-inline {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    opacity: 1;
    transform: scale(1) rotate(0deg);
    pointer-events: auto;
    z-index: 2;
}

.send-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    opacity: 0;
    transform: scale(0) rotate(-90deg);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper.has-text ~ .composer-send-wrapper .mic-inline,
.composer.has-text .mic-inline {
    opacity: 0;
    transform: scale(0) rotate(90deg);
    pointer-events: none;
}

.input-wrapper.has-text ~ .composer-send-wrapper .send-btn,
.composer.has-text .send-btn {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    pointer-events: auto;
    z-index: 3;
}

.send-btn:hover {
    transform: scale(1.12) rotate(-5deg);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5), 0 6px 22px rgba(139, 92, 246, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.send-btn:active {
    transform: scale(0.92);
}

.mic-inline:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 22px rgba(139, 92, 246, 0.55);
}
.mic-inline:active {
    transform: scale(0.92);
}
.mic-inline.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.6);
    opacity: 1 !important;
    transform: scale(1) !important;
    pointer-events: auto !important;
    animation: micPulse 1s infinite alternate ease-in-out;
}

/* ═══ WOW SEND OPTIONS FLOATING GLASS ═══ */
.send-options-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    background: rgba(10, 12, 22, 0.88);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(167, 139, 250, 0.18);
    border-radius: 18px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(167, 139, 250, 0.06),
        0 0 40px rgba(139, 124, 246, 0.04);
    z-index: 100;
    min-width: 165px;
    animation: sendOptFloat 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}
.send-options-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 10px;
    height: 10px;
    background: rgba(10, 12, 22, 0.92);
    border-right: 1px solid rgba(167, 139, 250, 0.18);
    border-bottom: 1px solid rgba(167, 139, 250, 0.18);
    transform: rotate(45deg);
    border-radius: 0 0 3px 0;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
}
@keyframes sendOptFloat {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.88);
        filter: blur(4px);
    }
    60% {
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.send-opt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    position: relative;
}
.send-opt-item i {
    font-size: 0.88rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light, #a78bfa);
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(139, 124, 246, 0.08);
    transition: all 0.2s ease;
}
.send-opt-item span {
    flex: 1;
}
.send-opt-item:hover {
    background: rgba(139, 124, 246, 0.12);
    color: #ffffff;
    transform: translateX(3px);
}
.send-opt-item:hover i {
    background: rgba(139, 124, 246, 0.2);
    color: #c4b5fd;
}
.send-opt-item:active {
    background: rgba(139, 124, 246, 0.18);
    transform: scale(0.96) translateX(2px);
}

/* Ephemeral Picker Popover */
.ephemeral-picker {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 80px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: rgba(18, 20, 34, 0.92);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    border: 1px solid rgba(167, 139, 250, 0.22);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    z-index: 50;
    animation: ephPopIn 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes ephPopIn {
    from { opacity: 0; transform: translateY(10px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.ephemeral-picker .eph-btn {
    padding: 5px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(241, 245, 249, 0.7);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}
.ephemeral-picker .eph-btn:hover {
    background: rgba(139, 124, 246, 0.18);
    color: #fff;
    border-color: rgba(139, 124, 246, 0.3);
    transform: translateY(-1px);
}
.ephemeral-picker .eph-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.45);
}

.file-previews {
    display: flex;
    gap: 8px;
    padding: 6px 10px;
    overflow-x: auto;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 1rem;
    right: 1rem;
    background: rgba(18, 20, 34, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    z-index: 15;
}
.file-previews::-webkit-scrollbar {
    height: 3px;
}
.file-preview-item {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}
.file-preview-item:hover {
    transform: scale(1.05);
    border-color: var(--accent, #8b7cf6);
}
.file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.file-preview-item .fp-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
}
.file-preview-item .fp-name {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-align: center;
    padding: 2px;
    word-break: break-all;
    line-height: 1.1;
    max-height: 100%;
    overflow: hidden;
}
.file-preview-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.18s ease;
    z-index: 2;
}
.file-preview-remove:hover {
    background: #dc2626;
    transform: scale(1.15);
}
@keyframes micPulse {
    0% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.4)); }
    100% { transform: scale(1.18); filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.8)); }
}

#chat-media-btn {
    display: none;
}

/* Mention dropdown */
.mention-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 180px;
    overflow-y: auto;
    background: var(--glass-xl);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 55;
    margin-bottom: 4px;
}
.mention-dropdown::-webkit-scrollbar {
    width: 3px;
}
.mention-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    transition: background 0.1s;
}
.mention-item:hover,
.mention-item.active {
    background: var(--bg-elevated);
}
.mention-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.mention-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.mention-item-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.6rem;
    color: #fff;
    flex-shrink: 0;
}
.mention-item-name {
    font-weight: 600;
    font-size: 0.8rem;
}

/* Mentions in messages */
.mention {
    color: var(--accent-light);
    font-weight: 600;
    background: var(--accent-soft);
    padding: 0 2px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.mention:hover {
    background: rgba(139, 124, 246, 0.2);
}
.message-wrapper.sent .mention {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}
.message-wrapper.sent .mention:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Formatting bar — floating on selection */
.format-bar {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0.9rem;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    background: var(--glass-xl);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 0.15s,
        transform 0.15s var(--spring);
}
.format-bar.hidden {
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
}
.format-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    transition: all 0.15s;
}
.format-btn:hover {
    background: var(--bg-island);
    color: var(--text-primary);
}
.format-btn:active {
    background: var(--accent-soft);
    color: var(--accent);
    transform: scale(0.95);
}
[data-theme="light"] .format-bar {
    background: rgba(255, 255, 255, 0.95);
}

/* Markdown rendering in messages */
.message-text b,
.message-text strong,
.message-bubble b,
.message-bubble strong {
    font-weight: 700;
}
.message-text i,
.message-text em,
.message-bubble i,
.message-bubble em {
    font-style: italic;
}
.message-text del,
.message-text s,
.message-bubble del,
.message-bubble s {
    text-decoration: line-through;
    opacity: 0.7;
}
.message-text code,
.message-bubble code,
.inline-code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.85em;
}
.message-wrapper.sent code,
.message-wrapper.sent .inline-code {
    background: rgba(255, 255, 255, 0.15);
}

.channel-notif-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.channel-subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(139, 124, 246, 0.25);
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trans);
}
.channel-subscribe-btn:hover {
    background: var(--accent);
    color: #fff;
}
.channel-subscribe-btn.subscribed {
    background: rgba(52, 211, 153, 0.1);
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.3);
}
.channel-subscribe-btn.subscribed:hover {
    background: var(--green);
    color: #fff;
}

/* ═══ EMOJI & STICKER PANELS ═══ */
.emoji-panel {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 0;
    z-index: 200;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s var(--spring);
    overflow: hidden;
    max-height: 400px;
    width: 360px;
}
.emoji-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.04) 0%,
        transparent 50%
    );
    pointer-events: none;
}
.emoji-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);
}
.emoji-tabs {
    display: flex;
    gap: 2px;
    padding: 0.6rem 0.6rem 0;
}
.emoji-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    transition: all 0.15s;
}
.emoji-tab:hover {
    background: var(--bg-island);
    color: var(--text-secondary);
}
.emoji-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.emoji-panel-content {
    padding: 0.6rem;
    max-height: 280px;
    overflow-y: auto;
}
#emoji-panel-stickers {
    position: relative;
    padding: 0;
}
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
}
.emoji-grid span {
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.12s;
}
.emoji-grid span:hover {
    background: var(--bg-island);
    transform: scale(1.25);
}
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    padding: 0.25rem 0;
}
.sticker-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.6rem;
    overflow: visible;
    position: relative;
    aspect-ratio: 1;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticker-item:hover {
    transform: scale(1.12);
}
.sticker-item:active {
    transform: scale(0.9);
}
.sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
    transition: filter 0.15s;
}
.sticker-item:hover img {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}
.sticker-item span {
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.1));
}
/* Sticker packs bar — Telegram-like thin strip */
.sticker-packs-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0.6rem 0.6rem 0.4rem;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border-subtle);
    align-items: flex-end;
}
.sticker-packs-bar::-webkit-scrollbar {
    display: none;
}
.sticker-pack-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    opacity: 0.5;
    position: relative;
}
.sticker-pack-btn::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 24px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--accent);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sticker-pack-btn.active {
    opacity: 1;
}
.sticker-pack-btn.active::after {
    transform: translateX(-50%) scaleX(1);
}
.sticker-pack-btn:hover:not(.active) {
    opacity: 0.75;
    background: var(--bg-hover);
}
.sticker-pack-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-island);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sticker-pack-add {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
    opacity: 0.5;
}
.sticker-pack-add:hover {
    opacity: 1;
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.sticker-grid-wrapper {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem 0.6rem;
    scrollbar-width: thin;
}
.sticker-grid-wrapper::-webkit-scrollbar {
    width: 3px;
}
.sticker-grid-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}
/* Sticker add FAB — minimal */
.sticker-add-btn {
    position: absolute;
    bottom: 0.4rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg-island);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.15s;
    z-index: 2;
    border: 1px solid var(--border-subtle);
}
.sticker-add-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
}
.sticker-add-btn:active {
    transform: scale(0.92);
}
/* Sticker grid empty state */
.sticker-grid-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
    gap: 0.6rem;
    text-align: center;
    min-height: 160px;
    box-sizing: border-box;
    width: 100%;
}
.sticker-grid-empty i {
    font-size: 2.8rem;
    opacity: 0.18;
    color: var(--text-tertiary);
    margin-bottom: 0.2rem;
}
.sticker-grid-empty p {
    font-size: 0.82rem;
    margin: 0;
    color: var(--text-muted);
    opacity: 0.55;
    font-weight: 400;
    letter-spacing: 0.01em;
}
.sticker-grid-empty button {
    padding: 0.55rem 1.3rem;
    border: none;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-top: 0.2rem;
}
.sticker-grid-empty button:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.sticker-grid-empty button:active {
    transform: scale(0.95);
}

/* GIF panel */
.gif-search-bar {
    margin-bottom: 0.5rem;
}
.gif-search-bar input {
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
}
.gif-search-bar input:focus {
    border-color: var(--accent);
}
.gif-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    max-height: 280px;
    overflow-y: auto;
}
.gif-grid::-webkit-scrollbar {
    width: 3px;
}
.gif-grid img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.15s;
}
.gif-grid img:hover {
    transform: scale(1.05);
}
.gif-loading {
    grid-column: 1/-1;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
/* ═══ MODALS ═══ */
.modal-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 14, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s var(--ease),
        backdrop-filter 0.3s var(--ease),
        -webkit-backdrop-filter 0.3s var(--ease);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 460px;
    max-height: 88vh;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        var(--shadow-xl);
    display: flex;
    flex-direction: column;
    transform: scale(0.94) translateY(10px);
    opacity: 0;
    transition:
        transform 0.35s var(--spring),
        opacity 0.3s var(--ease);
}
.modal-overlay.active .modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.modal-card > * {
    position: relative;
    z-index: 1;
}
.modal-card-wide {
    max-width: 600px;
}
.modal-card-folders {
    max-width: 480px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.modal-card-folders .modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.modal-card-folders .modal-header h3 i {
    font-size: 1rem;
    color: var(--accent);
    opacity: 0.7;
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}
.modal-footer {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.modal-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-search:focus-within {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), inset 0 1px 2px rgba(0,0,0,0.1);
}
.modal-search i {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    transition: color 0.3s ease;
}
.modal-search:focus-within i {
    color: var(--accent);
}
.modal-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 450;
    letter-spacing: -0.01em;
    outline: none;
}
.modal-search input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

/* Search results */
.search-results {
    max-height: 260px;
    overflow-y: auto;
    padding: 2px 0;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.2s ease;
}
.search-result-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.search-result-item:active {
    background: rgba(255, 255, 255, 0.07);
    transform: scale(0.98);
}
.search-result-item.selected {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.search-result-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}
.search-result-info {
    flex: 1;
    min-width: 0;
}
.search-result-name {
    font-weight: 590;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
}
.search-result-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ═══ CONTEXT MENU ═══ */
.context-menu {
    position: fixed;
    background: linear-gradient(160deg, rgba(28, 32, 54, 0.85), rgba(12, 14, 26, 0.78));
    backdrop-filter: blur(52px) saturate(190%);
    -webkit-backdrop-filter: blur(52px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 22px;
    box-shadow:
        0 26px 70px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    z-index: 10000;
    min-width: 236px;
    max-width: min(340px, calc(100vw - 16px));
    max-height: min(72vh, 560px);
    overflow-y: auto;
    scrollbar-width: none;
    padding: 7px;
    animation: menuAppear 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.context-menu::-webkit-scrollbar {
    display: none;
}
.context-menu::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 40% at 20% 0%, rgba(139, 124, 246, 0.1), transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%);
    border-radius: inherit;
    pointer-events: none;
}
@keyframes menuAppear {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
/* Шапка-превью сообщения (Telegram style) */
.ctx-msg-head {
    display: flex;
    align-items: stretch;
    gap: 9px;
    margin: 2px 2px 7px;
    padding: 8px 11px;
    border-radius: 14px;
    background: rgba(139, 124, 246, 0.08);
    border: 1px solid rgba(139, 124, 246, 0.14);
    position: relative;
    z-index: 1;
    animation: ctxSlideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ctx-msg-head-bar {
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, #a78bfa, #8b5cf6);
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.45);
}
.ctx-msg-head-text {
    font-size: 0.74rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.68);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.context-menu-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 9px;
    cursor: pointer;
    border-radius: 15px;
    transition:
        background 0.16s ease,
        color 0.16s ease,
        box-shadow 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    text-align: left;
    position: relative;
    z-index: 1;
}
.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
}
.context-menu-item:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.985);
}
.context-menu-item i {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.83rem;
    color: rgba(255, 255, 255, 0.55);
    flex-shrink: 0;
    transition:
        color 0.18s ease,
        background 0.18s ease,
        transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.context-menu-item:hover i {
    color: #cbd4ff;
    background: rgba(139, 124, 246, 0.16);
}
.context-menu-item:active .context-menu-item i {
    transform: scale(0.94);
}
.context-menu-item.danger {
    color: #f87171;
}
.context-menu-item.danger:hover {
    background: rgba(248, 113, 113, 0.12);
}
.context-menu-item.danger i {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}
.context-menu-item.danger:hover i {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.18);
}
.context-menu-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    margin: 5px 12px;
    position: relative;
    z-index: 1;
}

/* Context menu reaction picker */
.ctx-reactions-wrap {
    padding: 2px 3px;
    position: relative;
    z-index: 1;
}
.ctx-reactions-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}
.ctx-reactions-row + .ctx-reactions-row {
    margin-top: 4px;
}
.ctx-reactions-ext {
    display: none;
}
.ctx-reactions-ext.open {
    display: flex;
}
.ctx-reaction-btn {
    flex: 1;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.045);
    border-radius: 50%;
    font-size: 1.32rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: inherit;
    line-height: 1;
    animation: ctxSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ctx-reactions-row .ctx-reaction-btn:nth-child(1) { animation-delay: 0.015s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(2) { animation-delay: 0.03s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(3) { animation-delay: 0.045s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(4) { animation-delay: 0.06s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(5) { animation-delay: 0.075s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(6) { animation-delay: 0.09s; }
.ctx-reactions-row .ctx-reaction-btn:nth-child(7) { animation-delay: 0.105s; }
@keyframes ctxSlideIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.6);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.ctx-reaction-btn:hover {
    background: rgba(139, 124, 246, 0.2);
    transform: scale(1.3) translateY(-3px);
    box-shadow: 0 8px 20px rgba(139, 124, 246, 0.25);
}
.ctx-reaction-btn:active {
    transform: scale(0.95);
}
.ctx-reaction-full-btn {
    flex: 1;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, rgba(139, 124, 246, 0.22), rgba(99, 102, 241, 0.16));
    border-radius: 50%;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #c4b5fd;
    animation: ctxSlideIn 0.3s 0.115s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ctx-reaction-full-btn:hover {
    background: linear-gradient(135deg, rgba(139, 124, 246, 0.35), rgba(99, 102, 241, 0.26));
    color: #fff;
    transform: scale(1.12);
}
.ctx-reaction-full-btn i {
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-block;
}
.ctx-reaction-full-btn.active i {
    transform: rotate(180deg);
}
.reaction-picker {
    display: none;
    max-height: 168px;
    overflow-y: auto;
    padding: 7px 2px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 7px;
}
.reaction-picker.open {
    display: block;
    animation: ctxSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.reaction-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}
.reaction-picker .ctx-reaction-btn {
    width: 100%;
    height: 42px;
    font-size: 1.3rem;
}

/* ═══ TOAST ═══ */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.7rem 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    transition: transform 0.35s var(--spring);
    font-size: 0.85rem;
    color: var(--text-primary);
}
.toast-notification.show {
    transform: translateX(-50%) translateY(0);
}
.toast-success i {
    color: var(--green);
}
.toast-error i {
    color: var(--danger);
}
.toast-info i {
    color: var(--blue);
}
.toast-warning i {
    color: var(--amber);
}

/* ═══ LIGHTBOX ═══ */
.lightbox-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s var(--ease),
        backdrop-filter 0.3s var(--ease),
        -webkit-backdrop-filter 0.3s var(--ease);
}
.lightbox-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-overlay .lightbox-image {
    transform: scale(0.92);
    transition: transform 0.35s var(--spring);
}
.lightbox-overlay.active .lightbox-image {
    transform: scale(1);
}
.lightbox-image {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: var(--glass-md);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s var(--spring);
}
.lightbox-btn:hover {
    background: var(--bg-elevated);
    transform: translateY(-50%) scale(1.1);
}
.lightbox-prev {
    left: 1.5rem;
}
.lightbox-next {
    right: 1.5rem;
}
.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.85rem;
    background: var(--glass-md);
    backdrop-filter: blur(12px);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    background: rgba(20, 24, 38, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 2;
    transition: all 0.2s var(--spring);
}
.lightbox-close:hover {
    background: rgba(248, 113, 113, 0.3);
    transform: scale(1.1);
}

.lightbox-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 92vh;
}
.lightbox-video {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: var(--radius-md);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

.lightbox-bottombar {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.lightbox-download {
    width: 40px;
    height: 40px;
    background: rgba(20, 24, 38, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s var(--spring);
}
.lightbox-download:hover {
    background: rgba(139, 124, 246, 0.3);
    transform: scale(1.1);
}

/* ═══ RECORDING ═══ */
.recording-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 14, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.3s var(--ease),
        backdrop-filter 0.3s var(--ease),
        -webkit-backdrop-filter 0.3s var(--ease);
}
.recording-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.recording-dialog {
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    text-align: center;
    min-width: 320px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.92) translateY(12px);
    opacity: 0;
    transition:
        transform 0.35s var(--spring),
        opacity 0.3s var(--ease);
}
.recording-overlay.active .recording-dialog {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.recording-ring-wrap {
    position: relative;
    width: 170px;
    height: 170px;
    margin: 0 auto 1.5rem;
}
.recording-ring {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
}
.recording-ring-bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 4;
}
.recording-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s linear;
}
.recording-ring-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.recording-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    margin-bottom: 0.5rem;
}
.recording-wave span {
    width: 3px;
    background: var(--accent);
    border-radius: 3px;
    animation: wave 0.9s ease-in-out infinite;
}
.recording-wave span:nth-child(1) {
    height: 12px;
    animation-delay: 0s;
}
.recording-wave span:nth-child(2) {
    height: 22px;
    animation-delay: 0.1s;
}
.recording-wave span:nth-child(3) {
    height: 32px;
    animation-delay: 0.2s;
}
.recording-wave span:nth-child(4) {
    height: 22px;
    animation-delay: 0.3s;
}
.recording-wave span:nth-child(5) {
    height: 12px;
    animation-delay: 0.4s;
}
@keyframes wave {
    0%,
    100% {
        transform: scaleY(0.5);
    }
    50% {
        transform: scaleY(1);
    }
}
@keyframes voicePulse {
    0% {
        opacity: 0.7;
        transform: scaleY(0.85);
    }
    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}
.recording-timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}
.recording-limit {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.recording-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ═══ UPLOAD / DROP ═══ */
.upload-progress {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    min-width: 200px;
}
.upload-progress-bar {
    height: 3px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 2px;
    transition: width 0.3s var(--ease);
    width: 0;
}
.upload-progress-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.drop-zone-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 120px;
    background: var(--glass-xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px dashed var(--accent);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    z-index: -1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.3s var(--spring),
        border-color 0.25s ease;
    transform: translateY(8px);
}
.drop-zone-overlay.hint {
    opacity: 0.35;
    pointer-events: auto;
    z-index: 20;
    transform: translateY(0);
    border-color: var(--accent-light);
}
.drop-zone-overlay.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 20;
    transform: translateY(0);
    border-color: var(--accent);
    background: var(--glass-xl);
}
.drop-zone-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent);
    font-size: 1rem;
    font-weight: 600;
}
.drop-zone-content i {
    font-size: 2rem;
}

.connection-status {
    display: none !important;
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 500;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
}
.connection-status.online {
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.25);
    color: #34d399;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.1);
}
.connection-status.online i {
    color: #34d399;
    font-size: 0.5rem;
    filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.5));
    animation: connectionPulse 2s ease-in-out infinite;
}
@keyframes connectionPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
.connection-status.offline {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}
.connection-status.offline i {
    color: #ef4444;
    font-size: 0.5rem;
}
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-deep);
}
.app-loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: var(--radius-full);
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* ═══ SETTINGS & EXTRAS ═══ */
.new-chat-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-island);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 12px;
    transition: background 0.2s ease;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: #34c759;
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    min-height: 36px;
    align-items: center;
}
.selected-members:empty {
    display: none;
}
.selected-member-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 4px 10px 4px 4px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50px;
    font-size: 0.78rem;
    color: var(--text-primary);
    font-weight: 500;
}
.selected-member-badge .sm-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.selected-member-badge .sm-close {
    cursor: pointer;
    opacity: 0.4;
    font-size: 0.65rem;
    transition: 0.15s ease;
    margin-left: 2px;
}
.selected-member-badge .sm-close:hover {
    opacity: 1;
    color: var(--danger);
}
.group-name-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.75rem;
}
.group-name-section label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.group-name-section input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 450;
    letter-spacing: -0.01em;
    outline: none;
    transition: all 0.25s ease;
}
.group-name-section input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}
.group-name-section input:focus {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Participants */
.participant-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    background: var(--bg-island);
    border: 1px solid var(--border-subtle);
    margin-bottom: 0.3rem;
    transition: var(--trans);
}
.participant-item:hover {
    background: var(--bg-elevated);
}
.participant-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}
.participant-info {
    flex: 1;
    min-width: 0;
}
.participant-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.participant-role {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 500;
    margin-top: 0.05rem;
}
.participant-kick-btn {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.participant-kick-btn:hover {
    color: var(--danger) !important;
    background: rgba(248, 113, 113, 0.1) !important;
}

/* Poll & event cards in the conversation feed */
.message-poll-card{min-width:min(360px,100%);border:1px solid var(--dialog-accent,#8b7cf6);border-radius:16px;padding:13px;background:var(--bg-primary);box-shadow:0 8px 22px rgba(0,0,0,.07);}
.message-poll-card .poll-badge{display:inline-flex;align-items:center;gap:5px;color:var(--dialog-accent,#8b7cf6);font-size:.42rem;font-weight:900;letter-spacing:.08em;}
.message-poll-card h4{font-size:.68rem;margin:8px 0 10px;line-height:1.35;}
.message-poll-card .poll-options{display:grid;gap:6px;}
.message-poll-card .poll-option{position:relative;overflow:hidden;display:flex;align-items:center;justify-content:space-between;min-height:31px;padding:0 8px;border:1px solid var(--border-color,currentColor);border-radius:10px;background:var(--bg-secondary);color:inherit;font:inherit;text-align:left;cursor:pointer;}
.message-poll-card .poll-option i{position:absolute;left:0;top:0;bottom:0;width:var(--vote,0%);background:color-mix(in srgb,var(--dialog-accent,#8b7cf6) 12%,transparent);transition:width .28s;}
.message-poll-card .poll-option span{position:relative;z-index:1;}
.message-poll-card .poll-option b{position:relative;z-index:1;color:var(--text-muted);font-size:.55rem;font-weight:800;}
.message-poll-card .poll-option.voted{border-color:var(--dialog-accent,#8b7cf6);background:color-mix(in srgb,var(--dialog-accent,#8b7cf6) 8%,var(--bg-primary));}
.message-poll-card footer{display:flex;align-items:center;justify-content:space-between;margin-top:10px;padding-top:8px;border-top:1px solid var(--border-color);color:var(--text-muted);font-size:.48rem;}
.message-event-card{min-width:min(340px,100%);border:1px solid color-mix(in srgb,#a16df3 32%,var(--border-color));border-radius:16px;padding:13px;background:linear-gradient(135deg,color-mix(in srgb,#a16df3 7%,var(--bg-secondary)),var(--bg-secondary));box-shadow:0 8px 22px rgba(0,0,0,.07);position:relative;overflow:hidden;}
.message-event-card::before{content:"";position:absolute;inset:0;left:0;width:4px;background:linear-gradient(var(--dialog-accent,#a16df3),var(--dialog-accent-2,#ed70ba));}
.message-event-card header{display:flex;align-items:center;justify-content:space-between;color:var(--dialog-accent,#a16df3);font-size:.43rem;font-weight:900;letter-spacing:.08em;margin-bottom:8px;}
.message-event_card h4{font-size:.72rem;margin:0 0 5px;}
.message-event-card p{margin:0 0 8px;color:var(--text-secondary);font-size:.54rem;line-height:1.4;}
.message-event-card .event-meta{display:flex;gap:10px;color:var(--text-muted);font-size:.48rem;}
.message-event-card .event-meta span{display:flex;align-items:center;gap:5px;}
    position: relative;
    z-index: 2;
}
.message-wrapper.sent .message-reactions {
    justify-content: flex-end;
}
.message-wrapper.received .message-reactions {
    justify-content: flex-start;
}

.message-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px 1px 2px;
    background: var(--glass-lg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.18s var(--spring);
    user-select: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.message-reaction-pill:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--border-light);
}
.message-reaction-pill:active {
    transform: translateY(0) scale(0.95);
}
.message-reaction-pill .reaction-emoji {
    line-height: 1;
    font-size: 0.85rem;
}
.message-reaction-pill .reaction-count {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
}
.message-reaction-pill.reacted {
    background: var(--accent-soft);
    border-color: rgba(139, 124, 246, 0.35);
}
.message-reaction-pill.reacted .reaction-count {
    color: var(--accent);
}
.reaction-pill-avatars {
    display: flex;
    align-items: center;
}
.reaction-pill-avatar {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--glass-lg);
}
.reaction-pill-avatar + .reaction-pill-avatar {
    margin-left: -6px;
}

.message-wrapper.sent .message-reaction-pill {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}
.message-wrapper.sent .message-reaction-pill:hover {
    background: rgba(255, 255, 255, 0.2);
}
.message-wrapper.sent .reaction-pill-avatar {
    border-color: rgba(255, 255, 255, 0.3);
}
.message-wrapper.sent .message-reaction-pill .reaction-count {
    color: rgba(255, 255, 255, 0.6);
}
.message-wrapper.sent .message-reaction-pill.reacted {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}
.message-wrapper.sent .message-reaction-pill.reacted .reaction-count {
    color: #fff;
}

[data-theme="light"] .message-reaction-pill {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .message-reaction-pill.reacted {
    background: var(--accent-soft);
    border-color: var(--accent);
}
[data-theme="light"] .reaction-pill-avatar {
    border-color: #fff;
}
/* Reaction detail popup (below message) */
.reaction-detail-popup {
    background: var(--glass-xl);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.6rem;
    margin-top: 4px;
    box-shadow: var(--shadow-lg);
    max-width: 260px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.15s var(--spring);
    align-self: flex-start;
    width: fit-content;
}
.reaction-detail-popup.open {
    opacity: 1;
    transform: translateY(0);
}
.message-wrapper.sent .reaction-detail-popup {
    align-self: flex-end;
}
.message-wrapper.received .reaction-detail-popup {
    align-self: flex-start;
}
.reaction-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.35rem;
}
.reaction-detail-emoji-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border-subtle);
    background: var(--bg-island);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.reaction-detail-emoji-btn:hover {
    background: var(--bg-elevated);
    transform: scale(1.08);
}
.reaction-detail-emoji-btn.reacted {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.reaction-detail-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}
.reaction-detail-users {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 200px;
    overflow-y: auto;
}
.reaction-detail-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
}
.reaction-detail-user:hover {
    background: var(--bg-hover);
}
.reaction-detail-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.reaction-detail-avatar-empty {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: #fff;
}
.reaction-detail-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}
.reaction-detail-more {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 0;
}
.reaction-detail-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Archive modal */
/* ═══ ARCHIVE MODAL — REDESIGN ═══ */
.modal-card-archive {
    max-width: 520px;
    background: rgba(12, 14, 26, 0.92);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        0 24px 80px rgba(0, 0, 0, 0.5);
}
.modal-card-archive .modal-header {
    padding: 1rem 1.25rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
}
.modal-card-archive .modal-header h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.modal-card-archive .modal-header h3 i {
    font-size: 1rem;
    color: var(--accent-light);
    opacity: 0.8;
}
.archive-header-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 0.12rem 0.55rem;
    border-radius: var(--radius-full);
    margin-left: auto;
    margin-right: 0.5rem;
}
.modal-card-archive .modal-body {
    padding: 0.75rem 0.75rem 0.75rem;
}
/* Search */
.archive-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.85rem;
    margin-bottom: 0.45rem;
    transition: border-color 0.2s, background 0.2s;
}
.archive-search:focus-within {
    border-color: rgba(139, 124, 246, 0.4);
    background: rgba(255, 255, 255, 0.06);
}
.archive-search i {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.archive-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.archive-search input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
/* List */
.archive-list {
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px;
}
.archive-list::-webkit-scrollbar {
    width: 4px;
}
.archive-list::-webkit-scrollbar-track {
    background: transparent;
}
.archive-list::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 2px;
}
/* Item */
.archive-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.15s var(--ease);
    animation: archiveItemIn 0.3s var(--ease) both;
    position: relative;
}
@keyframes archiveItemIn {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.archive-item:hover {
    background: var(--bg-island);
}
.archive-item:active {
    background: var(--bg-hover);
}
/* Avatar */
.archive-item-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: var(--radius-full);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-light);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.2);
}
.archive-item-avatar-text {
    background: linear-gradient(135deg, var(--accent-soft), rgba(139, 124, 246, 0.12));
    border: 1px solid rgba(139, 124, 246, 0.15);
}
/* Body */
.archive-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.archive-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}
.archive-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Actions */
.archive-item-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
    margin-left: auto;
}
.archive-item:hover .archive-item-actions {
    opacity: 1;
    transform: translateX(0);
}
.archive-item-action {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: all 0.12s var(--ease);
}
.archive-unarchive:hover {
    background: var(--accent-soft);
    color: var(--accent-light);
}
.archive-delete:hover {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}
.archive-item-action:active {
    transform: scale(0.88);
}
/* Empty */
.archive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}
.archive-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: var(--accent-light);
    margin-bottom: 1rem;
    box-shadow: 0 0 30px rgba(139, 124, 246, 0.08);
}
.archive-empty-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.archive-empty-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 220px;
    line-height: 1.45;
}
/* Loading / Error states */
.archive-loading,
.archive-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 2.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.archive-loading i {
    font-size: 1.2rem;
    color: var(--accent-light);
}
.archive-error i {
    font-size: 1.2rem;
    color: var(--danger);
}
.archive-error {
    color: var(--danger);
}

/* ═══ ADMIN PANEL ═══ */
/* ADMIN PANEL — Premium Design */
.modal-card-admin {
    max-width: 900px;
    height: 84vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: var(--radius-xl, 20px);
    background: rgba(8, 10, 24, 0.95);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid rgba(139, 124, 246, 0.12);
    box-shadow: 0 32px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,124,246,0.04), 0 0 60px rgba(99,102,241,0.06);
}
.modal-card-admin .modal-header {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: rgba(139,124,246,0.04);
}
.modal-card-admin .modal-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    margin: 0;
    color: var(--text-primary, #fff);
}
.modal-card-admin .modal-header h3 i {
    color: var(--accent-light, #a5b4fc);
    font-size: 0.9rem;
}
.admin-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(139,124,246,0.2), rgba(99,102,241,0.1));
    color: var(--accent-light, #a5b4fc);
    border: 1px solid rgba(139,124,246,0.25);
    white-space: nowrap;
}
.admin-badge.role-owner {
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(245,158,11,0.08));
    color: #fbbf24;
    border-color: rgba(251,191,36,0.25);
}
.modal-card-admin .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
/* Tabs bar */
.admin-tabs {
    display: flex;
    gap: 0;
    padding: 0.3rem 0.85rem 0;
    background: rgba(255,255,255,0.015);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.admin-tab {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.8rem;
    border: none;
    background: transparent;
    color: rgba(148,163,184,0.7);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    font-family: inherit;
    border-radius: 0;
    position: relative;
}
.admin-tab i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}
.admin-tab:hover {
    color: var(--text-primary, #f1f5f9);
    background: rgba(255,255,255,0.03);
}
.admin-tab:hover i {
    transform: scale(1.1);
}
.admin-tab.active {
    color: var(--accent-light, #a5b4fc);
    border-bottom-color: var(--accent, #6366f1);
    background: rgba(139,124,246,0.06);
}
.admin-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent, #6366f1), transparent);
    border-radius: 1px;
}
/* Content area */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem 1.3rem;
    scrollbar-width: thin;
}
.admin-pane {
    display: none;
}
.admin-pane.active {
    display: block;
    animation: adminFadeUp 0.25s ease;
}
@keyframes adminFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
/* Stats grid */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.admin-stat-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 1.1rem 1rem;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
    position: relative;
    overflow: hidden;
}
.admin-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent, #6366f1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.admin-stat-card:hover::before {
    opacity: 0.6;
}
.admin-stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139,124,246,0.25);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25), 0 0 12px rgba(99,102,241,0.06);
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(139,124,246,0.03));
}
.admin-stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(99,102,241,0.12);
    color: var(--accent-light, #a5b4fc);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.45rem;
    font-size: 1rem;
    transition: transform 0.3s ease, background 0.3s;
}
.admin-stat-card:hover .admin-stat-icon {
    transform: scale(1.08);
    background: rgba(99,102,241,0.2);
}
.admin-stat-value {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary, #fff);
    letter-spacing: -0.03em;
    line-height: 1.15;
}
.admin-stat-label {
    font-size: 0.65rem;
    color: rgba(148,163,184,0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.15rem;
    font-weight: 600;
}
/* Pagination */
.admin-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.8rem 0 0.3rem;
    font-size: 0.75rem;
}
.admin-pagination button {
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary, #cbd5e1);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    transition: all 0.15s ease;
}
.admin-pagination button:hover:not(:disabled) {
    background: rgba(99,102,241,0.15);
    border-color: rgba(99,102,241,0.3);
    color: var(--accent-light, #a5b4fc);
    box-shadow: 0 4px 12px rgba(99,102,241,0.1);
}
.admin-pagination button:disabled {
    opacity: 0.25;
    cursor: default;
}
.admin-pagination span {
    color: var(--text-muted, #64748b);
    padding: 0 0.4rem;
    font-weight: 600;
    font-size: 0.72rem;
}
/* Tables */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    background: rgba(255,255,255,0.015);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.admin-table th {
    text-align: left;
    padding: 0.55rem 0.7rem;
    color: rgba(148,163,184,0.7);
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
    background: rgba(255,255,255,0.02);
}
.admin-table td {
    padding: 0.5rem 0.7rem;
    color: var(--text-primary, #e2e8f0);
    border-bottom: 1px solid rgba(255,255,255,0.03);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    font-size: 0.78rem;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td {
    background: rgba(139,124,246,0.04);
}
.admin-table tr:active td {
    background: rgba(139,124,246,0.08);
}
.admin-table .badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.admin-table .badge.ban {
    background: rgba(248,113,113,0.12);
    color: #f87171;
    border: 1px solid rgba(248,113,113,0.15);
}
.admin-table .badge.ok {
    background: rgba(52,211,153,0.12);
    color: #34d399;
    border: 1px solid rgba(52,211,153,0.15);
}
.admin-table .badge.staff {
    background: rgba(139,124,246,0.12);
    color: #a5b4fc;
    border: 1px solid rgba(139,124,246,0.15);
}
.admin-table .badge.owner {
    background: rgba(251,191,36,0.12);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.15);
}
.admin-table td .actions {
    display: flex;
    gap: 4px;
}
/* Action buttons */
.admin-btn {
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary, #cbd5e1);
    font-size: 0.67rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
}
.admin-btn:hover {
    background: rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.3);
    color: var(--accent-light, #a5b4fc);
    box-shadow: 0 4px 10px rgba(99,102,241,0.08);
}
.admin-btn.danger {
    color: #f87171;
    border-color: rgba(248,113,113,0.2);
}
.admin-btn.danger:hover {
    background: rgba(248,113,113,0.12);
    border-color: rgba(248,113,113,0.35);
    color: #fca5a5;
    box-shadow: 0 4px 10px rgba(248,113,113,0.08);
}
.admin-btn.success {
    color: #34d399;
    border-color: rgba(52,211,153,0.2);
}
.admin-btn.success:hover {
    background: rgba(52,211,153,0.12);
    border-color: rgba(52,211,153,0.35);
    color: #6ee7b7;
    box-shadow: 0 4px 10px rgba(52,211,153,0.08);
}
/* Search */
.admin-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.admin-search input {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary, #f1f5f9);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: all 0.2s ease;
}
.admin-search input:focus {
    border-color: rgba(139,124,246,0.35);
    background: rgba(139,124,246,0.04);
    box-shadow: 0 0 0 3px rgba(139,124,246,0.06);
}
.admin-search input::placeholder { color: rgba(148,163,184,0.4); }
/* Config rows */
.admin-config-row {
    display: flex;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.admin-config-row:last-child { border-bottom: none; }
.admin-config-key {
    width: 160px;
    font-size: 0.75rem;
    color: rgba(148,163,184,0.7);
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-config-val {
    font-size: 0.82rem;
    color: var(--text-primary, #e2e8f0);
    font-family: 'SF Mono','Fira Code',monospace;
    word-break: break-all;
}
/* Suggestion cards */
.admin-sug-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 0.9rem 1.1rem;
    margin-bottom: 0.65rem;
    transition: all 0.2s ease;
}
.admin-sug-card:hover {
    border-color: rgba(139,124,246,0.18);
    background: rgba(139,124,246,0.025);
    transform: translateY(-1px);
}
.admin-sug-card .sug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}
.admin-sug-card .sug-user {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent-light, #a5b4fc);
}
.admin-sug-card .sug-date {
    font-size: 0.65rem;
    color: rgba(148,163,184,0.6);
}
.admin-sug-card .sug-email {
    font-size: 0.7rem;
    color: rgba(148,163,184,0.6);
    margin-bottom: 0.25rem;
}
.admin-sug-card .sug-text {
    font-size: 0.85rem;
    color: var(--text-primary, #e2e8f0);
    line-height: 1.55;
    white-space: pre-wrap;
}
/* Section title */
.admin-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.admin-section-title i {
    color: var(--accent-light, #a5b4fc);
    font-size: 0.8rem;
}
/* Loading skeleton */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    color: rgba(148,163,184,0.6);
    gap: 0.6rem;
    font-size: 0.85rem;
}
.admin-loading i {
    animation: adminSpin 0.8s linear infinite;
}
@keyframes adminSpin { to { transform: rotate(360deg); } }
/* Empty state */
.admin-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: rgba(148,163,184,0.6);
    font-size: 0.85rem;
}
/* Staff add form */
.admin-add-staff {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, rgba(139,124,246,0.05), rgba(99,102,241,0.02));
    border: 1px dashed rgba(139,124,246,0.2);
    border-radius: 14px;
    align-items: center;
}
.admin-add-staff input {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary, #f1f5f9);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s;
}
.admin-add-staff input:focus {
    border-color: rgba(139,124,246,0.35);
}
/* Audit entries */
.audit-entry {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    transition: all 0.15s ease;
}
.audit-entry:hover {
    background: rgba(255,255,255,0.035);
    border-color: rgba(255,255,255,0.07);
}
.audit-entry:last-child { margin-bottom: 0; }
.audit-entry .ae-admin {
    font-weight: 700;
    color: var(--accent-light, #a5b4fc);
    min-width: 80px;
    font-size: 0.8rem;
}
.audit-entry .ae-action {
    color: var(--text-secondary, #cbd5e1);
    font-weight: 600;
    min-width: 100px;
    font-size: 0.75rem;
}
.audit-entry .ae-action {
    background: rgba(99,102,241,0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    text-align: center;
}
.audit-entry .ae-target {
    color: rgba(148,163,184,0.6);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'SF Mono','Fira Code',monospace;
    font-size: 0.72rem;
}
.audit-entry .ae-time {
    color: rgba(148,163,184,0.5);
    font-size: 0.65rem;
    white-space: nowrap;
    min-width: 60px;
    text-align: right;
}
/* Mobile adjustments */
@media (max-width: 600px) {
    .modal-card-admin { height: 92vh; border-radius: var(--radius-lg, 16px); }
    .admin-tabs { padding: 0.25rem 0.5rem 0; }
    .admin-tab { padding: 0.4rem 0.5rem; font-size: 0.68rem; }
    .admin-tab span { display: none; }
    .admin-tab i { font-size: 0.9rem; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .admin-stat-card { padding: 0.85rem; }
    .admin-stat-value { font-size: 1.3rem; }
    .admin-content { padding: 0.75rem; }
    .admin-config-key { width: 100px; font-size: 0.7rem; }
    .admin-add-staff { flex-direction: column; }
    .audit-entry { flex-wrap: wrap; gap: 0.3rem; padding: 0.55rem 0.7rem; }
    .audit-entry .ae-target { min-width: 100%; order: 10; }
}

/* ═══ FOLDERS MODAL — iOS 26 redesigned ═══ */
.modal-card-folders .modal-body {
    padding: 0.5rem 1rem 1rem;
}
.fm-section {
    margin-bottom: 0.25rem;
}
.fm-section:last-child {
    margin-bottom: 0;
}
.fm-section-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.15rem 0.5rem;
}
.fm-section-label i {
    font-size: 0.62rem;
    opacity: 0.4;
}
.fm-create-bar {
    display: flex;
    gap: 0.5rem;
}
.fm-create-bar input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}
.fm-create-bar input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.07);
}
.fm-create-bar input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.fm-create-bar button {
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.fm-create-bar button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.fm-create-bar button:active {
    transform: scale(0.95);
}
.fm-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 0.6rem 0 0.5rem;
}
.folders-list {
    display: flex;
    flex-direction: column;
}
.folder-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0.5rem;
    border-radius: 12px;
    transition: background 0.2s ease;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
}
.folder-item:hover {
    background: rgba(255, 255, 255, 0.04);
}
.folder-item:active {
    background: rgba(255, 255, 255, 0.07);
}
.folder-item + .folder-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.folder-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--accent);
    flex-shrink: 0;
}
.folder-item-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-primary);
}
.folder-item-chats {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
    line-height: 1.4;
}
.folder-item-del {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    flex-shrink: 0;
}
.folder-item:hover .folder-item-del {
    opacity: 1;
}
.folder-item-del:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}
.folder-item-del:active {
    transform: scale(0.85);
}
.folders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 2rem 1rem;
    text-align: center;
}
.folders-empty i {
    font-size: 2.2rem;
    color: var(--text-muted);
    opacity: 0.15;
    margin-bottom: 0.15rem;
}
.folders-empty span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.folders-empty small {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Settings folder form — reused from settings */
.create-folder-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.create-folder-form input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s var(--ease);
}
.create-folder-form input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.07);
}
.create-folder-form input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.create-folder-form button {
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}
.create-folder-form button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.create-folder-form button:active {
    transform: scale(0.95);
}

/* Info modals */
.chat-info-body,
.channel-info-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.chat-info-avatar-section,
.channel-info-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}
.chat-info-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: var(--shadow-md);
}
.chat-info-details {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.chat-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}
.chat-info-label {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.chat-info-value {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}
.chat-info-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.chat-info-section-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.chat-info-media {
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.2rem;
}
.chat-media-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}
.chat-media-grid .media-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.15s;
    background: var(--bg-input);
}
.chat-media-grid .media-thumb:hover {
    opacity: 0.8;
}
.media-thumb-video {
    position: relative;
    aspect-ratio: 1;
    cursor: pointer;
}
.media-thumb-video .media-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    background: #000;
}
.media-thumb-video-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    pointer-events: none;
}
.participants-count {
    margin-left: auto;
    font-size: 0.65rem;
    background: var(--bg-island);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-weight: 500;
}
.participants-add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.participants-add-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}
.participants-add-form input:focus {
    border-color: var(--accent);
}
.participants-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.channel-create-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.channel-create-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--bg-island);
    border: 2px dashed var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}
.channel-create-avatar:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

/* ═══════════════════════════════════════
   CHANNEL INFO / MANAGEMENT MODAL — iOS 26 LIQUID GLASS
   ═══════════════════════════════════════ */
.ch-modal {
    max-width: 500px !important;
    width: 92vw !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 34px !important;
    background: rgba(28, 34, 62, 0.48) !important;
    backdrop-filter: blur(48px) saturate(220%) !important;
    -webkit-backdrop-filter: blur(48px) saturate(220%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.55), inset 0 2px 3px rgba(255, 255, 255, 0.4), inset 0 -1.5px 2px rgba(255, 255, 255, 0.15), 0 0 50px rgba(168, 85, 247, 0.25) !important;
}

.ch-hero {
    position: relative !important;
    padding: 2.2rem 1.5rem 2.2rem !important;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.55) 0%, rgba(124, 58, 237, 0.45) 50%, rgba(192, 38, 211, 0.35) 100%) !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.ch-hero-glow {
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 65%);
    top: -100px;
    right: -80px;
    pointer-events: none;
}
.ch-hero-glow::after {
    content: "";
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(180,164,252,0.15) 0%, transparent 70%);
    bottom: -90px;
    left: -60px;
}
.ch-hero-noise {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(45deg, transparent 0, transparent 2px, rgba(255,255,255,0.015) 2px, rgba(255,255,255,0.015) 4px);
    pointer-events: none;
}
.ch-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: rgba(0, 0, 0, 0.35) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    font-size: 0.95rem !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 3 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.35) !important;
}
.ch-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
    transform: scale(1.08) !important;
}
.ch-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.ch-avatar-wrap {
    position: relative;
    width: 96px;
    height: 96px;
}
.ch-avatar {
    width: 96px !important;
    height: 96px !important;
    border-radius: 50% !important;
    background-color: #6366f1 !important;
    background-image: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 2.4rem !important;
    color: #ffffff !important;
    background-size: cover !important;
    background-position: center !important;
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.4), 0 0 0 5px rgba(22, 28, 52, 0.8), inset 0 2px 4px rgba(255, 255, 255, 0.35) !important;
    position: relative !important;
    z-index: 2 !important;
}
.ch-avatar-ring {
    position: absolute !important;
    inset: -6px !important;
    border-radius: 50% !important;
    border: 2px solid rgba(168, 85, 247, 0.45) !important;
    animation: upRingPulse 3s ease-in-out infinite !important;
    pointer-events: none !important;
}
.ch-avatar-edit {
    position: absolute !important;
    bottom: -2px !important;
    right: -2px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
    color: #ffffff !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    border: 2.5px solid rgba(22, 28, 52, 0.95) !important;
    z-index: 3 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
.ch-avatar-edit:hover {
    transform: scale(1.12) !important;
}
.ch-name {
    font-size: 1.45rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    margin: 0.3rem 0 0 !important;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
    letter-spacing: -0.025em !important;
}
.ch-subline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
}
.ch-sub-count {
    font-weight: 600;
}
.ch-dot {
    opacity: 0.5;
}
.ch-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.72rem;
    font-weight: 700;
    color: #ffffff;
}
.ch-badge i {
    font-size: 0.7rem;
    color: #c084fc;
}

/* Tabs Segmented Slider */
.ch-tabs {
    display: flex !important;
    gap: 4px !important;
    padding: 5px !important;
    background: rgba(0, 0, 0, 0.35) !important;
    border-radius: 20px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    margin: 14px 20px 0 !important;
    backdrop-filter: blur(20px) !important;
    border-bottom: none !important;
}
.ch-tab {
    flex: 1 !important;
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.65) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    padding: 0.55rem 0.8rem !important;
    cursor: pointer !important;
    border-radius: 15px !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-family: inherit !important;
    text-align: center !important;
    margin-bottom: 0 !important;
}
.ch-tab:hover {
    color: #ffffff !important;
}
.ch-tab.active {
    background: rgba(255, 255, 255, 0.18) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), inset 0 1px 1.5px rgba(255, 255, 255, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    border-bottom-color: rgba(255, 255, 255, 0.22) !important;
}

/* Body / panes */
.ch-body {
    padding: 1.25rem 1.5rem 1.5rem;
    max-height: 420px;
    overflow-y: auto;
}
.ch-pane {
    display: none;
    animation: chFadeIn 0.25s var(--ease);
}
.ch-pane.active {
    display: block;
}
@keyframes chFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Info card (description) */
.ch-info-card {
    display: flex !important;
    gap: 0.9rem !important;
    padding: 0.85rem 1.1rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 22px !important;
    margin-bottom: 0.8rem !important;
    box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(24px) !important;
}
.ch-info-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 12px !important;
    background: rgba(168, 85, 247, 0.15) !important;
    border: 1px solid rgba(168, 85, 247, 0.28) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #c084fc !important;
    font-size: 0.95rem !important;
    flex-shrink: 0 !important;
}
.ch-info-body {
    flex: 1;
    min-width: 0;
}
.ch-info-label {
    font-size: 0.64rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 700 !important;
    margin-bottom: 0.15rem !important;
}
.ch-info-text {
    font-size: 0.9rem !important;
    color: #ffffff !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
    font-weight: 500 !important;
}

/* Stat grid */
.ch-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1rem;
}
.ch-stat-card {
    padding: 0.85rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 20px !important;
    text-align: center !important;
    box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(20px) !important;
}
.ch-stat-icon {
    font-size: 1.1rem !important;
    color: #c084fc !important;
    margin-bottom: 0.3rem !important;
}
.ch-stat-label {
    font-size: 0.64rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 700 !important;
    margin-bottom: 0.15rem !important;
}
.ch-stat-value {
    font-size: 0.85rem !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Action list */
.ch-action-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.ch-action-list > .btn {
    width: 100%;
    justify-content: flex-start;
    gap: 0.6rem;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
}
.ch-action-list > div {
    display: flex;
    gap: 0.4rem;
}
.ch-action-list > div input {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    font-size: 0.85rem;
    font-family: inherit;
}
.ch-action-list > div input:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.5) !important;
}
.ch-action-list > div .btn {
    flex-shrink: 0;
    padding: 0.45rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 14px !important;
}

/* Members */
.ch-members-toolbar {
    margin-bottom: 0.85rem;
}
.ch-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.ch-search-wrap > i {
    position: absolute;
    left: 0.85rem;
    color: #c084fc;
    font-size: 0.85rem;
    pointer-events: none;
}
.ch-search-input {
    width: 100%;
    padding: 0.65rem 0.85rem 0.65rem 2.3rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 16px !important;
    color: #ffffff !important;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.25s ease;
}
.ch-search-input:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2) !important;
}
.ch-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.ch-members-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.ch-members-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
    padding: 2rem 0;
}
.ch-member-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem !important;
    border-radius: 16px !important;
    transition: background 0.18s ease;
}
.ch-member-row:hover {
    background: rgba(255, 255, 255, 0.08) !important;
}
.ch-member-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.ch-member-info {
    flex: 1;
    min-width: 0;
}
.ch-member-name {
    font-size: 0.88rem !important;
    color: #ffffff !important;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.ch-member-role {
    font-size: 0.62rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ch-member-role.owner {
    background: rgba(168, 85, 247, 0.18) !important;
    color: #c084fc !important;
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.ch-member-role.admin {
    background: rgba(52,211,153,0.18) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52,211,153,0.3);
}
.ch-member-role.subscriber {
    background: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.6) !important;
}
.ch-member-status {
    font-size: 0.72rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    margin-top: 0.1rem;
}
.ch-member-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}
.ch-member-actions .btn {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.72rem;
    border-radius: 12px !important;
}

/* Manage pane */
.ch-section-title {
    font-size: 0.66rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 700 !important;
    margin-bottom: 0.75rem;
    padding-top: 0.5rem;
}
.ch-section-title:first-child {
    padding-top: 0;
}
.ch-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}
.ch-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.ch-field label {
    font-size: 0.66rem !important;
    font-weight: 700 !important;
    color: rgba(255, 255, 255, 0.5) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
}
.ch-field input,
.ch-field textarea {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 16px !important;
    color: #ffffff !important;
    padding: 12px 14px !important;
    font-size: 0.9rem !important;
}
.ch-field input:focus,
.ch-field textarea:focus {
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2) !important;
}
.ch-type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.ch-type-option {
    padding: 0.75rem 0.5rem !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.06) !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-family: inherit;
}
.ch-type-option i {
    font-size: 1.1rem;
    color: #c084fc !important;
    transition: color 0.2s;
}
.ch-type-option span {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffffff !important;
}
.ch-type-option small {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5) !important;
}
.ch-type-option:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}
.ch-type-option.active {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 1.5px rgba(255, 255, 255, 0.35) !important;
}
.ch-type-option.active i {
    color: #c084fc !important;
}
.ch-save-btn {
    width: 100%;
    justify-content: center;
    margin-top: 0.25rem;
    padding: 11px 22px !important;
    border-radius: 16px !important;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #d946ef 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.45) !important;
}

/* Scrollbar */
.ch-body::-webkit-scrollbar {
    width: 5px;
}
.ch-body::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
.ch-body::-webkit-scrollbar-track {
    background: transparent;
}

/* Channel sub count in header */
.channel-sub-count {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
    .ch-modal {
        max-width: 100%;
        border-radius: var(--radius-xl);
    }
    .ch-info-grid {
        grid-template-columns: 1fr;
    }
    .ch-type-toggle {
        grid-template-columns: 1fr;
    }
}

/* Misc components */
.shortcuts-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: var(--bg-island);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.shortcut-item .key {
    font-family: "SF Mono", monospace;
    font-size: 0.75rem;
    background: var(--bg-elevated);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-light);
}
.message-sender-name {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.12rem;
    padding-left: 0.3rem;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.message-forwarded-banner {
    font-size: 0.68rem;
    color: var(--accent);
    padding: 0.15rem 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.2rem;
    opacity: 0.8;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1rem;
    background: linear-gradient(90deg, var(--glass-sm), rgba(14, 18, 28, 0.4));
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-faint);
    border-left: 3px solid var(--accent);
    flex-shrink: 0;
    margin: 0 0.6rem 0;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    position: relative;
    overflow: hidden;
}
.typing-indicator::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    animation: typingBarPulse 1.5s ease-in-out infinite;
}
@keyframes typingBarPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
.typing-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.65rem;
    color: #fff;
    box-shadow:
        0 0 0 2px rgba(139, 124, 246, 0.15),
        0 2px 8px rgba(139, 124, 246, 0.2);
}
.typing-body {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.typing-name {
    font-weight: 700;
    font-size: 0.74rem;
    color: var(--accent-light);
}
.typing-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.typing-dots {
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 12px;
}
.typing-dots span {
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
.typing-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-light);
    font-weight: 600;
    font-size: 0.74rem;
}
.typing-status-dots {
    display: inline-flex;
    gap: 3px;
    align-items: flex-end;
    height: 10px;
}
.typing-status-dots span {
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s ease-in-out infinite;
}
.typing-status-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-status-dots span:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typingBounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.2;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}
.typing-status-dots span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-status-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.sidebar-search-results {
    margin: 0 0.65rem 0.5rem;
    max-height: calc(100vh - 330px);
    overflow-y: auto;
    background: var(--glass-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-lg);
    animation: fadeUp 0.15s var(--ease);
    padding: 0.3rem;
}
.sidebar-search-results::-webkit-scrollbar {
    width: 3px;
}
.sidebar-search-results::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
.ssr-section {
    margin: 0;
}
.ssr-section + .ssr-section {
    border-top: 1px solid var(--border-faint);
}
.ssr-header {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 0.5rem 0.7rem 0.2rem;
    font-weight: 700;
    opacity: 0.6;
}
.ssr-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.6rem;
    cursor: pointer;
    transition: all 0.12s;
    border-radius: 10px;
    margin-bottom: 1px;
}
.ssr-item:last-child {
    border-radius: 10px;
}
.ssr-item:hover {
    background: var(--bg-elevated);
}
.ssr-item .chat-info {
    flex: 1;
    min-width: 0;
}
.ssr-item .chat-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
}
.ssr-item .chat-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ssr-msg-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 0.65rem;
}
.ssr-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.ssr-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.forward-chats-list {
    max-height: 300px;
    overflow-y: auto;
}
.forward-user-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--trans);
}
.forward-user-item:hover {
    background: var(--bg-island);
}
.forward-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    flex-shrink: 0;
}

.settings-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

/* Settings tabs */
.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 1rem;
    flex-shrink: 0;
}
.settings-tab {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: left;
    position: relative;
}
.settings-tab:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}
.settings-tab:active {
    transform: scale(0.97);
}
.settings-tab.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.1));
    color: #c4b5fd;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.settings-tab i {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
    transition: color 0.2s;
}
.settings-tab:hover i {
    color: rgba(255, 255, 255, 0.6);
}
.settings-tab.active i {
    color: #a78bfa;
}
.settings-tab-content {
    display: none;
}
.settings-tab-content.active {
    display: block;
    animation: tabContentIn 0.25s ease;
}
@keyframes tabContentIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.settings-avatar-wrap {
    position: relative;
    width: 100px;
    height: 100px;
}
.settings-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid var(--border-light);
    box-shadow: var(--shadow-md);
}
.settings-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--bg-glass-strong);
    transition: var(--trans);
    box-shadow: var(--shadow-sm);
}
.settings-avatar-edit:hover {
    transform: scale(1.1);
}
.settings-avatar-edit i {
    color: #fff;
    font-size: 0.75rem;
}
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
/* Chat dropdown */
.chat-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 210px;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    padding: 0.3rem;
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    z-index: 500;
    animation: chatDropIn 0.15s var(--ease);
}
.chat-dropdown.open { display: flex; }
@keyframes chatDropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-dropdown-item {
    display: flex; align-items: center; gap: 0.65rem;
    width: 100%; padding: 0.5rem 0.65rem;
    background: none; border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem; font-family: inherit;
    cursor: pointer; transition: background 0.12s; text-align: left;
}
.chat-dropdown-item i {
    width: 16px; text-align: center;
    color: var(--text-muted); font-size: 0.82rem;
}
.chat-dropdown-item:hover { background: var(--bg-hover); }
.chat-dropdown-item:hover i { color: var(--accent); }
.chat-dropdown-item.danger { color: var(--red); }
.chat-dropdown-item.danger i { color: var(--red); }
.chat-dropdown-item.danger:hover { background: rgba(239,68,68,0.08); }
.chat-dropdown-divider {
    height: 1px; background: var(--border-subtle);
    margin: 0.2rem 0.3rem;
}
.skeleton-chat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
}
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-island) 25%,
        var(--bg-elevated) 50%,
        var(--bg-island) 75%
    );
    background-size: 200% 100%;
    animation: skel 1.5s infinite;
    border-radius: var(--radius-sm);
}
.skeleton-avatar {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-full);
}
.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.skeleton-line {
    height: 12px;
    border-radius: 6px;
}
.skeleton-line:first-child {
    width: 55%;
}
.skeleton-line:last-child {
    width: 35%;
}
@keyframes skel {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

#global-bg-gallery,
.chat-bg-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-top: 0.75rem;
}
.chat-bg-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s var(--spring);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: var(--bg-elevated);
}
.chat-bg-option .check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--accent);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 2;
}
.chat-bg-option .check i {
    font-size: 0.5rem;
    color: #fff;
}
.chat-bg-option.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-bg-option.active .check {
    display: flex;
}
.chat-bg-option:hover {
    transform: scale(1.06) translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.chat-bg-option-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 4px;
    font-size: 0.42rem;
    font-weight: 500;
    text-align: center;
    background: linear-gradient(transparent, rgba(0,0,0,0.5));
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
    pointer-events: none;
}
.chat-bg-option:hover .chat-bg-option-label {
    opacity: 1;
}
.bg-reset {
    border: 2px dashed var(--border-subtle);
}
.bg-reset:hover {
    border-color: var(--accent);
}
.bg-custom {
    border: 2px dashed var(--border-subtle);
    cursor: pointer;
}
.bg-custom:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.bg-custom input {
    display: none;
}
.bg-custom-ico {
    font-size: 1.4rem;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.2s var(--ease);
}
.bg-custom:hover .bg-custom-ico {
    opacity: 0.8;
}
.bg-option-icon {
    font-size: 1.3rem;
    color: rgba(255,255,255,0.25);
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

@keyframes overlayIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.delete-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 14, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayIn 0.2s var(--ease);
}
.delete-confirm-dialog {
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2rem 2rem 1.5rem;
    box-shadow:
        var(--shadow-xl),
        0 0 60px rgba(248, 113, 113, 0.04);
    text-align: center;
    max-width: 340px;
    width: 90vw;
    animation: modalIn 0.3s var(--spring);
}
.delete-confirm-dialog .dcd-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}
.delete-confirm-dialog .dcd-icon i {
    font-size: 1.4rem;
    color: var(--danger);
}
.delete-confirm-dialog h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.delete-confirm-dialog p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.5rem;
}
.delete-confirm-dialog strong {
    color: var(--text-primary);
}
.delete-confirm-actions {
    display: flex;
    gap: 0.75rem;
}
.delete-confirm-actions button {
    flex: 1;
    padding: 0.65rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-cancel-delete {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-cancel-delete:hover {
    background: var(--bg-hover);
}
.btn-confirm-delete {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.btn-confirm-delete:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

/* Utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-success {
    color: var(--green);
}
.text-danger {
    color: var(--danger);
}
.text-muted {
    color: var(--text-muted);
}
.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}
.sidebar-empty i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.3;
}
.sidebar-empty p {
    font-size: 0.85rem;
}
.channel-type-btn.active {
    background: var(--accent) !important;
    color: #fff !important;
}
/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 320px;
    }
}
@media (max-width: 480px) {
    .auth-container {
        padding: 0.75rem;
    }
    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .sticker-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    .sticker-packs-bar {
        padding: 0.5rem 0.5rem 0.35rem;
    }
    .sticker-pack-btn {
        width: 30px;
        height: 30px;
    }
    .sticker-grid-wrapper {
        max-height: 170px;
        padding: 0.4rem 0.5rem;
    }
    .context-menu {
        min-width: 170px;
    }
    .message-wrapper {
        max-width: 90%;
    }
}

/* ═══ LIGHT THEME ═══ */
[data-theme="light"] {
    --accent: #7c6ae0;
    --accent-light: #a898f0;
    --accent-dark: #6858c8;
    --accent-soft: rgba(124, 106, 224, 0.1);
    --accent-glow: rgba(124, 106, 224, 0.15);

    --glass-sm: rgba(255, 252, 248, 0.7);
    --glass-md: rgba(255, 252, 248, 0.82);
    --glass-lg: rgba(255, 252, 248, 0.92);
    --glass-xl: rgba(255, 252, 248, 0.97);

    --bg-deep: #e4e1d8;
    --bg-base: #eeebe4;
    --bg-surface: #faf8f4;
    --bg-elevated: #e8e5dc;
    --bg-hover: #dedbd2;
    --bg-input: #e4e1d8;
    --bg-glass: var(--glass-md);
    --bg-glass-strong: var(--glass-lg);
    --bg-island: rgba(238, 235, 228, 0.85);

    --text-primary: #181a1e;
    --text-secondary: #555a66;
    --text-muted: #888d9a;

    --border-faint: rgba(0, 0, 0, 0.04);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.11);
    --border-medium: rgba(0, 0, 0, 0.15);
    --border-strong: rgba(0, 0, 0, 0.2);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 56px rgba(0, 0, 0, 0.11);
    --shadow-island:
        0 3px 14px rgba(0, 0, 0, 0.05), 0 0 0 1px var(--border-subtle);
    --shadow-glow: 0 0 24px var(--accent-glow);

    .messenger-body {
        background: var(--bg-deep);
    }
    .modern-sidebar {
        background: var(--bg-surface);
        border-right-color: var(--border-medium);
    }
    .main-area {
        background: var(--bg-base);
    }
    .chat-topbar {
        background: var(--bg-surface);
        border-bottom-color: var(--border-subtle);
    }
    .composer {
        background: var(--bg-surface);
        border-top-color: var(--border-subtle);
    }
    .messages-container {
        background: transparent;
    }
    .message-wrapper.received .message-bubble {
        background: #fff;
        border-color: var(--border-subtle);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }
    .message-wrapper.sent .message-bubble {
        background: linear-gradient(145deg, var(--accent), var(--accent-dark));
        color: #fff;
    }
    .chat-avatar {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    .modal-card {
        background: var(--glass-xl);
    }
    .context-menu {
        background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(243, 245, 252, 0.92));
        border-color: rgba(15, 23, 42, 0.1);
        box-shadow:
            0 24px 60px rgba(30, 41, 59, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 1);
    }
    .context-menu::before {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 40%);
    }
    .context-menu-item:hover {
        background: rgba(15, 23, 42, 0.05);
    }
    .context-menu-item:active {
        background: rgba(15, 23, 42, 0.08);
    }
    .context-menu-item i {
        background: rgba(15, 23, 42, 0.05);
        color: rgba(15, 23, 42, 0.45);
    }
    .context-menu-item:hover i {
        color: #7c6ae0;
        background: rgba(124, 106, 224, 0.12);
    }
    .context-menu-item.danger {
        color: #d32f2f;
    }
    .context-menu-item.danger i {
        color: #d32f2f;
        background: rgba(211, 47, 47, 0.07);
    }
    .context-menu-item.danger:hover {
        background: rgba(211, 47, 47, 0.08);
    }
    .context-menu-item.danger:hover i {
        color: #b71c1c;
        background: rgba(211, 47, 47, 0.12);
    }
    .context-menu-divider {
        background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.1), transparent);
    }
    .ctx-msg-head {
        background: rgba(124, 106, 224, 0.08);
        border-color: rgba(124, 106, 224, 0.16);
    }
    .ctx-msg-head-text {
        color: rgba(15, 23, 42, 0.65);
    }
    .ctx-reaction-btn {
        background: rgba(15, 23, 42, 0.04);
    }
    .ctx-reaction-btn:hover {
        background: rgba(124, 106, 224, 0.16);
        box-shadow: 0 8px 18px rgba(124, 106, 224, 0.18);
    }
    .ctx-reaction-full-btn {
        background: linear-gradient(135deg, rgba(124, 106, 224, 0.16), rgba(99, 102, 241, 0.1));
        color: #7c6ae0;
    }
    .reaction-picker {
        border-top-color: rgba(15, 23, 42, 0.07);
    }
    .toast-notification {
        background: var(--glass-xl);
    }
    .emoji-panel {
        background: var(--glass-xl);
    }
    .sidebar-profile {
        background: transparent;
    }
    .sidebar-tab {
        color: var(--text-muted);
        border-color: var(--border-subtle);
    }
    .sidebar-tab.active {
        background: rgba(0, 0, 0, 0.03);
        color: var(--accent);
    }
    .profile-avatar::after {
        border-color: var(--bg-glass);
    }
    .input-wrapper {
        background: var(--bg-surface);
        border-color: var(--border-subtle);
    }
    .input-wrapper:focus-within {
        background: #fff;
        border-color: var(--accent);
        box-shadow: 0 0 0 2px var(--accent-soft);
    }
    .chat-item.active {
        background: var(--accent-soft);
    }
    .chat-item:hover {
        background: var(--bg-elevated);
    }
    .btn-icon {
        background: var(--bg-elevated);
        border-color: var(--border-subtle);
        color: var(--text-secondary);
    }
    .btn-icon:hover {
        background: var(--bg-surface);
        color: var(--text-primary);
    }
    .search-box input,
    .sidebar-search input {
        background: var(--bg-surface);
        border-color: var(--border-subtle);
    }
    .sidebar-bottom {
        border-color: var(--border-subtle);
    }
    .delete-confirm-dialog {
        background: var(--glass-xl);
    }
    .recording-dialog {
        background: var(--glass-xl);
    }
    .lightbox-btn {
        background: rgba(255, 255, 255, 0.85);
        color: var(--text-primary);
    }
    .lightbox-counter {
        background: rgba(255, 255, 255, 0.85);
        color: var(--text-primary);
        border-color: var(--border-subtle);
    }
    .sidebar-search-results {
        background: var(--glass-sm);
        border-color: var(--border-subtle);
    }
    .empty-title {
        background: linear-gradient(135deg, var(--text-primary), #555a66);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    .empty-card {
        background: var(--bg-surface);
        border-color: var(--border-subtle);
    }
    .empty-card:hover {
        background: var(--bg-elevated);
        border-color: var(--border-light);
    }
    .empty-card-ico {
        background: var(--accent-soft);
    }
    .empty-card:hover .empty-card-ico {
        background: color-mix(in srgb, var(--accent) 15%, transparent);
    }
    .empty-footer {
        opacity: 0.28;
    }
    .partner-avatar.online::after {
        border-color: var(--bg-base);
    }
}
/* ═══ FOLDER PICKER — iOS 26 native sheet ═══ */
.folder-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 14, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}
.folder-picker-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.folder-picker {
    background: var(--glass-xl);
    backdrop-filter: blur(48px);
    -webkit-backdrop-filter: blur(48px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: scale(0.92) translateY(12px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    overflow: hidden;
}
.folder-picker-overlay.active .folder-picker {
    transform: scale(1) translateY(0);
    opacity: 1;
}
.folder-picker-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.folder-picker-head i {
    font-size: 1.2rem;
    color: var(--accent);
    opacity: 0.7;
}
.folder-picker-head > div {
    flex: 1;
    min-width: 0;
}
.folder-picker-head span {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
}
.folder-picker-head small {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fp-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.fp-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}
.folder-picker-body {
    padding: 0.5rem 0.75rem 0.75rem;
}
.folder-picker-list {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.65rem;
}
.fp-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.folder-picker-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    -webkit-tap-highlight-color: transparent;
}
.folder-picker-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.folder-picker-item:active {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(0.98);
}
.folder-picker-item + .folder-picker-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.folder-picker-item i {
    font-size: 0.95rem;
    color: var(--text-muted);
    width: 20px;
    text-align: center;
    transition: color 0.2s ease;
    flex-shrink: 0;
}
.folder-picker-item.active {
    color: var(--accent);
}
.folder-picker-item.active i {
    color: var(--accent);
}
.folder-picker-item span {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}
.fp-item-count {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}
.folder-picker-create {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    transition: all 0.2s ease;
}
.folder-picker-create:focus-within {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
}
.folder-picker-create input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    padding: 0.2rem 0;
}
.folder-picker-create input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}
.folder-picker-create button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.folder-picker-create button:hover {
    filter: brightness(1.1);
    transform: scale(1.05);
}
.folder-picker-create button:active {
    transform: scale(0.9);
}

/* ═══ GROUP MESSAGE SENDER ═══ */
.message-sender-name {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.12rem;
    padding-left: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.message-sender-avatar {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}
.message-sender-avatar-text {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent), var(--blue));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}
/* ═══ DESIGN POLISH & SUBTLE ANIMATIONS ═══ */

/* Button micro-interactions */
.btn {
    transition: all 0.2s var(--spring);
}
.btn-icon {
    transition: all 0.18s var(--spring);
}
.btn-icon:hover {
    transform: scale(1.06);
}
.btn-icon:active {
    transform: scale(0.94);
}

/* Nav buttons */
.nav-btn {
    transition: all 0.2s var(--spring);
}
.nav-btn:hover {
    transform: scale(1.08);
}
.nav-btn.active {
    transform: scale(1);
}

/* Input focus glow */
.search-box input,
.input-wrapper,
.modal-search,
.input-group input {
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        box-shadow 0.25s ease;
}

/* ═══ MESSAGE BUBBLE STYLES ═══ */
@keyframes msgSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes msgFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Online dot pulse */
.chat-avatar.online::after,
.partner-avatar.online::after {
    animation: onlinePulse 2s ease-in-out infinite;
}
@keyframes onlinePulse {
    0%,
    100% {
        box-shadow: 0 0 4px var(--success);
    }
    50% {
        box-shadow: 0 0 10px var(--success);
    }
}

/* Send button hover */
.send-btn {
    transition: all 0.2s var(--spring);
}
.send-btn:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Composer input subtle grow */
.composer .btn-icon {
    transition: all 0.18s var(--spring);
}
.composer .btn-icon:hover {
    transform: scale(1.08);
    color: var(--accent);
}

/* Panel entrance */
.emoji-panel.active {
    animation: panelUp 0.2s var(--spring);
}
@keyframes panelUp {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(0.92) translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) scale(1) translateY(0);
    }
}

/* Modal backdrop fade */
.modal-overlay.active {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Chat info modal avatar */
.chat-info-avatar {
    transition: transform 0.3s var(--spring);
    cursor: pointer;
}
.chat-info-avatar:hover {
    transform: scale(1.05);
}

/* Selection toolbar slide up */
.selection-toolbar {
    animation: slideUp 0.2s var(--spring);
}
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Reply bar */
.reply-bar {
    animation: slideDown 0.2s var(--spring);
}
.reply-bar.hidden {
    display: none;
}
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Unread badge pop */
.unread-badge {
    animation: badgePop 0.3s var(--spring);
}
@keyframes badgePop {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Toast notification */
.toast-notification.show {
    animation: toastUp 0.35s var(--spring);
}
@keyframes toastUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes floatGentle {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Auth icon float */
.auth-icon-wrapper {
    animation: floatGentle 4s ease-in-out infinite;
}

/* Toggle switch smooth */
.toggle-slider::before {
    transition:
        transform 0.25s var(--spring),
        background 0.2s ease;
}

/* Tab active indicator */
.nav-btn.active::after {
    animation: indicatorGrow 0.3s var(--spring);
}
@keyframes indicatorGrow {
    from {
        transform: translateY(-50%) scaleY(0);
    }
    to {
        transform: translateY(-50%) scaleY(1);
    }
}

/* Channel avatar subtle */
.channel-avatar {
    transition: transform 0.2s var(--spring);
}
.chat-item:hover .channel-avatar {
    transform: scale(1.05);
}



/* Smooth scrollbar */
::-webkit-scrollbar-thumb {
    transition: background 0.3s ease;
}

/* Date divider fade */
.messages-date-divider span {
    animation: fadeInScale 0.3s var(--spring);
}
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Modal close button hover */
.modal-header .btn-icon:hover {
    transform: rotate(90deg);
    transition: transform 0.3s var(--spring);
}

/* Theme button active pulse */
.theme-btn.btn-primary {
    animation: themeActive 0.3s var(--spring);
}
@keyframes themeActive {
    from {
        transform: scale(0.95);
    }
    to {
        transform: scale(1);
    }
}

/* Folder header hover */
.folder-header {
    transition:
        background 0.15s ease,
        padding-left 0.15s ease;
}
.folder-header:hover {
    padding-left: 1.1rem;
}

/* Skeleton loading shimmer */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-island) 25%,
        var(--bg-elevated) 37%,
        var(--bg-island) 63%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* Particapant item hover */
.participant-item {
    transition: all 0.15s ease;
}
.participant-item:hover {
    transform: translateX(2px);
    background: var(--bg-elevated);
}

/* Search results item hover */
.search-result-item {
    transition: all 0.15s ease;
}
.search-result-item:hover {
    transform: translateX(2px);
}

/* ═══════════════════════════════════════
   PREMIUM DESIGN REFRESH v2
   ═══════════════════════════════════════ */

/* Richer glass panels */
.nav-sidebar {
    background: linear-gradient(
        180deg,
        rgba(14, 18, 28, 0.65) 0%,
        rgba(14, 18, 28, 0.55) 100%
    );
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}
.sidebar-panel {
    background: linear-gradient(
        180deg,
        rgba(14, 18, 28, 0.62) 0%,
        rgba(14, 18, 28, 0.52) 100%
    );
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

/* Nav brand */
.nav-brand {
    transition: all 0.3s var(--spring);
}
.nav-brand:hover {
    transform: scale(1.08);
}

/* Performance: skip off-screen rendering */
.chat-item {
    contain: layout style;
    content-visibility: auto;
    contain-intrinsic-size: 56px;
}

/* ===== REFINED SEARCH ===== */
.search-box input {
    background: rgba(15, 18, 26, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    font-size: 0.86rem;
    transition: all 0.25s ease;
}
.search-box input:focus {
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.02);
}

/* ===== ENHANCED MESSAGES ===== */
.messages-container {
    padding: 0.75rem 1rem;
    scroll-behavior: smooth;
}

/* Better sent bubble */
.message-wrapper.sent .message-bubble {
    background: linear-gradient(145deg, var(--accent) 0%, #7465d4 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 1.2rem 1.2rem 0.2rem 1.2rem;
}
.message-wrapper.sent .message-bubble::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 40%
    );
    pointer-events: none;
}

/* Better received bubble */
.message-wrapper.received .message-bubble {
    background: linear-gradient(
        145deg,
        rgba(20, 24, 36, 0.9) 0%,
        rgba(16, 20, 30, 0.85) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 1.2rem 1.2rem 1.2rem 0.2rem;
}

/* Softer date divider */
.messages-date-divider span {
    background: rgba(20, 24, 36, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.3rem 1rem;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}

/* ===== RICHER COMPOSER ===== */
.composer {
    background: linear-gradient(
        180deg,
        rgba(14, 18, 28, 0.65) 0%,
        rgba(14, 18, 28, 0.55) 100%
    );
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: 0.7rem 1rem;
    gap: 0.6rem;
}
.input-wrapper {
    background: rgba(15, 18, 26, 0.8);
    border: 1.5px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: 0.2rem 0.2rem 0.2rem 1rem;
    transition: all 0.25s ease;
}
.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--bg-surface);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.05),
        0 0 0 3px rgba(255, 255, 255, 0.02);
}

/* Send button gradient */
.send-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #7465d4 100%);
    width: 38px;
    height: 38px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.15);
}
.send-btn:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.1) rotate(-8deg);
}

/* ===== RICHER MODALS ===== */
.modal-card {
    background: linear-gradient(
        180deg,
        rgba(20, 24, 38, 0.95) 0%,
        rgba(16, 20, 32, 0.92) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* Softer modal header */
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ===== СТАРЫЙ БЛОК УДАЛЁН (консолидировано выше iOS 26) ===== */

/* ===== POLISHED PANELS ===== */
.emoji-panel {
    background: linear-gradient(
        180deg,
        rgba(20, 24, 38, 0.95) 0%,
        rgba(16, 20, 32, 0.92) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(40px) saturate(160%);
    -webkit-backdrop-filter: blur(40px) saturate(160%);
}

/* ===== BETTER TOPBAR ===== */
.chat-topbar {
    background: linear-gradient(
        180deg,
        rgba(14, 18, 28, 0.7) 0%,
        rgba(14, 18, 28, 0.55) 100%
    );
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* ===== SOFTER BUTTONS ===== */
.btn {
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.25s var(--spring);
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #7465d4 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.15);
}
.btn-primary:hover {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 6px 18px rgba(0, 0, 0, 0.18);
}

/* ===== REFINED TOAST ===== */
.toast-notification {
    background: linear-gradient(
        180deg,
        rgba(20, 24, 38, 0.95) 0%,
        rgba(16, 20, 32, 0.92) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(40px) saturate(160%);
    -webkit-backdrop-filter: blur(40px) saturate(160%);
}

/* ===== BETTER TYPING INDICATOR ===== */
.typing-indicator {
    background: linear-gradient(
        180deg,
        rgba(14, 18, 28, 0.5) 0%,
        transparent 100%
    );
    padding: 0.4rem 1.25rem;
}
.typing-dots span {
    background: var(--accent);
}

/* ===== ENHANCED SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
    transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* ===== FOLDER HEADER FINE-TUNE ===== */
.folder-header {
    transition: all 0.2s ease;
}
.folder-header:hover {
    background: var(--bg-hover);
}

/* ===== RICHER REPLY BAR ===== */
.reply-bar {
    background: linear-gradient(90deg, var(--accent-soft), transparent);
    border-left: 3px solid var(--accent);
    padding: 0.6rem 1rem;
}

/* ===== BETTER SELECTION TOOLBAR ===== */
.selection-toolbar {
    background: var(--accent-soft);
    border-top: 1px solid var(--accent-soft);
}

/* ===== ENHANCED LIGHTBOX ===== */
.lightbox-btn {
    background: rgba(20, 24, 38, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.25s var(--spring);
}
.lightbox-btn:hover {
    background: rgba(30, 34, 48, 0.85);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 24px rgba(139, 124, 246, 0.15);
}
.lightbox-counter {
    background: rgba(20, 24, 38, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== SOFTER FOCUS STATES ===== */
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

/* ===== ENHANCED RECORDING DIALOG ===== */
.recording-dialog {
    background: linear-gradient(
        180deg,
        rgba(20, 24, 38, 0.95) 0%,
        rgba(16, 20, 32, 0.92) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

/* ===== BETTER CHAT BG GALLERY ===== */
.chat-bg-option {
    transition: all 0.3s var(--spring);
}
.chat-bg-option:hover {
    transform: scale(1.06) translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.chat-bg-option .check {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 300px;
        --nav-width: 60px;
    }
}
/* Global: hide recording bar on desktop */
.recording-bar {
    display: none !important;
}
@media (max-width: 480px) {
    .auth-container {
        padding: 0.75rem;
    }
    .auth-card {
        border-radius: var(--radius-lg);
    }
    .auth-logo-text {
        font-size: 1.8rem;
    }
    .auth-left,
    .auth-right {
        padding: 1.5rem;
    }
    .auth-tab {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    .message-wrapper {
        max-width: 92%;
    }
    .composer {
        padding: 0.4rem 0.5rem;
        gap: 0.25rem;
    }
    .emoji-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .sticker-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }
    .emoji-grid span {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    .sticker-packs-bar {
        gap: 0.4rem;
        padding: 0.5rem 0.5rem 0.35rem;
    }
    .sticker-pack-btn {
        width: 30px;
        height: 30px;
    }
    .sticker-grid-wrapper {
        max-height: 170px;
        padding: 0.4rem 0.5rem;
    }
    .sticker-add-btn {
        bottom: 0.3rem;
        right: 0.4rem;
    }
    .media-sticker img {
        max-width: 150px;
        max-height: 150px;
    }
    .context-menu {
        min-width: 160px;
    }
    .panel-header {
        padding: 1rem 1.25rem 0.5rem;
    }
    .panel-header h2 {
        font-size: 1.1rem;
    }
    .search-box {
        padding: 0.4rem 1.25rem 0.75rem;
    }
    .chat-item {
        padding: 0.55rem 0.6rem;
    }
    .chat-avatar {
        width: 40px;
        height: 40px;
        min-width: 40px;
        font-size: 0.85rem;
    }
    .chat-name {
        font-size: 0.85rem;
    }
    .chat-preview {
        font-size: 0.74rem;
    }
    .empty-avatar {
        width: 78px;
        height: 78px;
    }
    .empty-avatar-inner {
        font-size: 1.4rem;
    }
    .empty-avatar-inner i {
        font-size: 1.4rem;
    }
    .empty-title {
        font-size: 1.2rem;
    }
    .empty-subtitle {
        font-size: 0.7rem;
    }
    .empty-card {
        padding: 8px 10px;
        gap: 8px;
    }
    .empty-card-ico {
        width: 28px;
        height: 28px;
    }
    .empty-card-ico i {
        font-size: 0.7rem;
    }
    .empty-card-lbl {
        font-size: 0.7rem;
    }
    .empty-card-desc {
        font-size: 0.55rem;
    }
    .empty-cards {
        flex-direction: column;
        max-width: 260px;
        width: 100%;
    }
    .settings-content-scroll {
        padding: 0.7rem;
    }
    .settings-card {
        padding: 0.85rem;
        border-radius: var(--radius-md);
    }
    .settings-page-header h2 {
        font-size: 1.05rem;
    }
    .settings-page-header p {
        font-size: 0.72rem;
    }
    .modal-card-settings {
        max-height: 98vh !important;
    }
    .settings-dropdown-btn {
        padding: 0.55rem 0.75rem;
        font-size: 0.82rem;
    }
    .settings-dropdown-menu {
        width: calc(100% - 1.5rem);
        max-width: 300px;
        max-height: 55vh;
    }
}
/* ══════════════════════════════════════════════════════════════
   CREATE CHAT MODAL — iOS 26 Glass Bottom Sheet
   ══════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════
   CREATE CHAT / GROUP / CHANNEL MODAL — iOS 26 LIQUID GLASS
   ══════════════════════════════════════════════════════════════ */
.create-chat-card {
    max-width: 460px;
    background: rgba(28, 34, 62, 0.48) !important;
    backdrop-filter: blur(48px) saturate(220%) !important;
    -webkit-backdrop-filter: blur(48px) saturate(220%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow:
        0 32px 100px rgba(0, 0, 0, 0.55),
        inset 0 2px 3px rgba(255, 255, 255, 0.4),
        inset 0 -1.5px 2px rgba(255, 255, 255, 0.15),
        0 0 50px rgba(168, 85, 247, 0.25) !important;
    border-radius: 30px !important;
    padding: 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.create-chat-card::before {
    display: none !important;
}

.create-chat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse 100% 55% at 50% 0%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
    border-radius: inherit;
}

/* ── Drag handle ── */
.cch-handle {
    width: 38px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.25);
    margin: 12px auto 0;
    flex-shrink: 0;
}

/* ── Header ── */
.cch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 4px;
    flex-shrink: 0;
}
.cch-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.cch-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #ffffff;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.35);
}
.cch-close:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: scale(1.08);
}

/* ── Segmented control ── */
.cch-segmented {
    display: flex;
    gap: 4px;
    margin: 12px 20px 8px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 18px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}
.cch-seg {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.cch-seg:hover {
    color: #ffffff;
}
.cch-seg.active {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), inset 0 1px 1.5px rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

/* ── Body ── */
.cch-body {
    padding: 8px 20px 4px;
    overflow-y: auto;
    max-height: 420px;
    flex: 1;
}

/* ── Search pill ── */
.cch-search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 11px 14px;
    backdrop-filter: blur(16px);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.cch-search:focus-within {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2), inset 0 1px 2px rgba(0,0,0,0.1);
    background: rgba(255, 255, 255, 0.09);
}
.cch-search i {
    color: #c084fc;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}
.cch-search:focus-within i {
    color: #d946ef;
}
.cch-search input {
    flex: 1;
    border: none;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    outline: none;
}
.cch-search input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

/* ── Search results ── */
.cch-body .search-results {
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 0 2px;
}
.cch-body .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 2px;
}
.cch-body .search-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}
.cch-body .search-result-item:active {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(0.98);
}
.cch-body .search-result-item.selected {
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.cch-body .search-result-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.cch-body .search-result-info {
    flex: 1;
    min-width: 0;
}
.cch-body .search-result-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #ffffff;
    letter-spacing: -0.01em;
}
.cch-body .search-result-status {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
}

/* ── Selected members chips ── */
.cch-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    min-height: 38px;
    align-items: center;
    backdrop-filter: blur(16px);
}
.cch-members:empty {
    display: none;
}
.cch-member {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 4px;
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.28);
    border-radius: 50px;
    font-size: 0.8rem;
    color: #ffffff;
    font-weight: 600;
}
.cch-member .cm-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.cch-member .cm-close {
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.7rem;
    transition: 0.15s ease;
    margin-left: 2px;
}
.cch-member .cm-close:hover {
    opacity: 1;
    color: #f87171;
}

/* ── Form fields ── */
.cch-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
}
.cch-field label {
    font-size: 0.66rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}
.cch-field input,
.cch-field textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    resize: vertical;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
}
.cch-field input::placeholder,
.cch-field textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}
.cch-field input:focus,
.cch-field textarea:focus {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2), inset 0 1px 2px rgba(0,0,0,0.1);
    background: rgba(255, 255, 255, 0.09);
}

/* ── Channel avatar ── */
.cch-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding-top: 4px;
}
.cch-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 2px dashed rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.2);
}
.cch-avatar:hover {
    border-color: #c084fc;
    background: rgba(168, 85, 247, 0.12);
    transform: scale(1.05);
}
.cch-avatar-label {
    font-size: 0.75rem;
    color: #c084fc;
    font-weight: 600;
    cursor: pointer;
}

/* ── Channel type toggle ── */
.cch-type-group {
    display: flex;
    gap: 8px;
}
.cch-type-btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.cch-type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.cch-type-btn.active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 1.5px rgba(255, 255, 255, 0.35);
}

/* ── Footer ── */
.cch-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 20px 20px;
    flex-shrink: 0;
}
.cch-cancel {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.2s ease;
}
.cch-cancel:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}
.cch-submit {
    padding: 10px 22px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #d946ef 100%);
    color: #fff;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.45);
}
.cch-submit:hover {
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 10px 28px rgba(168, 85, 247, 0.6);
}
.cch-submit:active {
    transform: scale(0.97);
}
.cch-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .create-chat-card {
        max-width: 100% !important;
        border-radius: 26px 26px 0 0 !important;
        margin-top: auto;
        border-bottom: none !important;
    }
    .cch-handle {
        margin: 8px auto 0;
    }
    .cch-header {
        padding: 10px 18px 2px;
    }
    .cch-segmented {
        margin: 10px 18px 6px;
    }
    .cch-body {
        padding: 6px 18px 2px;
        max-height: 60vh;
    }
    .cch-footer {
        padding: 10px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .cch-submit {
        flex: 1;
        justify-content: center;
    }
}

/* Light theme overrides */
[data-theme="light"] .create-chat-card {
    background: rgba(248, 250, 255, 0.68) !important;
    backdrop-filter: blur(60px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
}
[data-theme="light"] .cch-close {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .cch-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
}
[data-theme="light"] .cch-segmented {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .cch-seg {
    color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .cch-seg:hover {
    color: #000;
}
[data-theme="light"] .cch-seg.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
[data-theme="light"] .cch-search {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .cch-search:focus-within {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}
[data-theme="light"] .cch-search i {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .cch-search input::placeholder {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .cch-body .search-result-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .cch-body .search-result-item.selected {
    background: rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .cch-members {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .cch-member {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}
[data-theme="light"] .cch-field input,
[data-theme="light"] .cch-field textarea {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .cch-field input::placeholder,
[data-theme="light"] .cch-field textarea::placeholder {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .cch-field input:focus,
[data-theme="light"] .cch-field textarea:focus {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
}
[data-theme="light"] .cch-avatar {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.4);
}
[data-theme="light"] .cch-avatar:hover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
}
[data-theme="light"] .cch-type-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .cch-type-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: #000;
}
[data-theme="light"] .cch-type-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
[data-theme="light"] .cch-cancel {
    color: rgba(0, 0, 0, 0.5);
}
[data-theme="light"] .cch-cancel:hover {
    color: #000;
    background: rgba(0, 0, 0, 0.05);
}
/* ═══ AUTH PAGE (inline-styled, CSS fallback) ═══ */
.auth-body {
    background: #070910;
}
.auth-card .auth-logo-icon {
    animation: floatIcon 4s ease-in-out infinite;
}
@keyframes floatIcon {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}
.btn-auth .spinner {
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
/* ===== NEW AUTH PAGE STYLES ===== */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(
            ellipse 80% 60% at 20% 30%,
            rgba(139, 124, 246, 0.12) 0%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 60% 80% at 80% 70%,
            rgba(99, 102, 241, 0.1) 0%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 50% 50% at 50% 50%,
            rgba(167, 139, 250, 0.06) 0%,
            transparent 60%
        );
    animation: meshShift 20s ease-in-out infinite;
}
@keyframes meshShift {
    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }
    33% {
        transform: scale(1.05) rotate(1deg);
    }
    66% {
        transform: scale(0.98) rotate(-0.5deg);
    }
}

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.08;
}
.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent);
    top: -100px;
    left: -100px;
    animation: orb1 15s ease-in-out infinite;
}
.orb-2 {
    width: 300px;
    height: 300px;
    background: #6366f1;
    bottom: -80px;
    right: -80px;
    animation: orb2 18s ease-in-out infinite;
}
@keyframes orb1 {
    0%,
    100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(60px, 40px);
    }
}
@keyframes orb2 {
    0%,
    100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-50px, -30px);
    }
}

.grain {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-wrap {
    position: relative;
    z-index: 2;
    width: 420px;
    max-width: 92vw;
}

.logo {
    text-align: center;
    margin-bottom: 2.5rem;
    animation: fadeDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.logo-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 8px 24px rgba(0, 0, 0, 0.12);
}
.logo-icon i {
    font-size: 1.5rem;
    color: #fff;
}
.logo-text {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    letter-spacing: 0.02em;
}

.auth-card {
    background: var(--bg-glass);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 2rem;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    animation: cardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0.25rem;
    margin-bottom: 1.75rem;
}
.tab {
    flex: 1;
    padding: 0.6rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 9px;
    transition: all 0.2s ease;
}
.tab:hover {
    color: var(--text-secondary);
}
.tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    font-weight: 600;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.1);
}

.form {
    display: none;
    flex-direction: column;
    gap: 0.85rem;
}
.form.active {
    display: flex;
    animation: formIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes formIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.field {
    position: relative;
}
.field-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
    transition: color 0.2s ease;
}
.field input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}
.field input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:focus ~ .field-icon {
    color: var(--accent);
}
.field input::placeholder {
    color: var(--text-muted);
}

.pass-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}
.pass-toggle:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.strength {
    margin-top: -0.3rem;
}
.strength-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.2rem;
}
.strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition:
        width 0.3s ease,
        background 0.3s ease;
}
.strength-text {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.submit {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.submit::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.08) 0%,
        transparent 50%
    );
    pointer-events: none;
}
.submit:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 6px 18px rgba(0, 0, 0, 0.15);
}
.submit:active {
    transform: translateY(0);
}
.submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.submit .loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}
.submit.loading .loader {
    display: block;
}
.submit.loading .label {
    display: none;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error {
    color: var(--danger);
    font-size: 0.8rem;
    text-align: center;
    min-height: 1.2rem;
    font-weight: 500;
}
.error.shake {
    animation: shake 0.4s ease;
}
@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-4px);
    }
    75% {
        transform: translateX(4px);
    }
}

.footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    animation: fadeDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}
.footer span {
    color: var(--accent-light);
}
.footer-author {
    font-size: 1.6em;
    font-weight: 800;
    letter-spacing: 0.02em;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.5rem;
        border-radius: 20px;
    }
    .logo-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }
    .logo-icon i {
        font-size: 1.3rem;
    }
    .logo-text {
        font-size: 1.6rem;
    }
    .logo {
        margin-bottom: 2rem;
    }
}

/* ═══ MEDIA MESSAGES ═══ */
.media-wrap {
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-width: 320px;
    background: var(--bg-elevated);
    position: relative;
    min-height: 60px;
}
.media-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, var(--bg-elevated) 25%, var(--bg-surface) 40%, var(--bg-elevated) 55%);
    background-size: 200% 100%;
    animation: placeholder-shimmer 1.6s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    border-radius: var(--radius-sm);
}
@keyframes placeholder-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.media-image {
    width: 100%;
    max-height: 400px;
    display: block;
    cursor: pointer;
    object-fit: contain;
    position: relative;
    z-index: 1;
}
.media-image.loaded + .media-wrap::after,
.media-wrap:has(.media-image.loaded)::after {
    opacity: 0;
}
.media-wrap.media-video-wrap::after,
.media-wrap:has(.media-video)::after,
.media-wrap.e2e-loading::after {
    opacity: 0;
}
.media-video-wrap {
    background: #000;
    cursor: pointer;
    max-height: 320px;
}
.media-video {
    width: 100%;
    height: 100%;
    display: block;
    max-height: 320px;
}
.media-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s;
    pointer-events: none;
}
.media-play-overlay i {
    font-size: 2.8rem;
    color: #fff;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.6));
    pointer-events: none;
}
.media-play-overlay.playing {
    opacity: 0;
}
.media-wrap.e2e-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}
.media-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.media-file {
    display: flex;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    min-width: 200px;
    transition: background 0.15s;
}
.media-file:hover {
    background: var(--bg-hover);
}
.message-wrapper.sent .media-file {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}
.message-wrapper.sent .media-file:hover {
    background: rgba(255, 255, 255, 0.1);
}
.media-file-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    background: var(--accent-soft);
    color: var(--accent);
}
.message-wrapper.received .media-file-icon {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
}
.media-file-info {
    flex: 1;
    min-width: 0;
}
.media-file-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-file-size {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 1px;
}
.message-wrapper.sent .media-file-name {
    color: rgba(255, 255, 255, 0.9);
}
.message-wrapper.sent .media-file-size {
    color: rgba(255, 255, 255, 0.5);
}
.media-sticker {
    font-size: 4rem;
    line-height: 1;
    text-align: center;
    padding: 4px 0;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.06));
}
.media-sticker img {
    max-width: 200px;
    max-height: 200px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    transition: transform 0.2s var(--spring);
}
.media-sticker img:hover {
    transform: scale(1.05);
}
.media-sticker[data-sticker-url] {
    cursor: pointer;
}
.message-wrapper.sent .media-sticker img {
    filter: drop-shadow(0 2px 12px rgba(139, 124, 246, 0.15));
}
.message-wrapper.received .media-sticker img {
    filter: drop-shadow(0 2px 12px rgba(52, 211, 153, 0.12));
}
/* ═══ VOICE MESSAGE PLAYER ═══ */
.message-voice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 2px;
    min-width: 200px;
}
.message-voice.e2e-loading {
    min-height: 54px;
    min-width: 200px;
}
.voice-play-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition:
        transform 0.2s var(--spring),
        box-shadow 0.2s;
    position: relative;
}
.voice-play-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.voice-play-btn:active {
    transform: scale(0.93);
}
.voice-play-btn i {
    font-size: 0.9rem;
}
.voice-play-btn .fa-play {
    margin-left: 2px;
}
.message-wrapper.received .voice-play-btn {
    background: linear-gradient(135deg, #34d399, #059669);
    box-shadow: 0 4px 14px rgba(52, 211, 153, 0.3);
}
.message-wrapper.received .voice-play-btn:hover {
    box-shadow: 0 6px 22px rgba(52, 211, 153, 0.45);
}
.voice-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 38px;
    padding: 2px 0;
}
.voice-bar {
    width: 3px;
    border-radius: 2px;
    min-height: 4px;
    transition:
        background 0.12s,
        opacity 0.12s;
}
.message-wrapper.sent .voice-bar {
    background: rgba(255, 255, 255, 0.3);
    opacity: 0.55;
}
.message-wrapper.sent .voice-bar.active {
    background: #fff;
    opacity: 1;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
    animation: voicePulse 0.6s ease-in-out infinite alternate;
}
.message-wrapper.received .voice-bar {
    background: var(--text-muted);
    opacity: 0.3;
}
.message-wrapper.received .voice-bar.active {
    background: #34d399;
    opacity: 1;
    box-shadow: 0 0 6px rgba(52, 211, 153, 0.25);
}
.voice-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.voice-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
}
.message-wrapper.sent .voice-time {
    color: rgba(255, 255, 255, 0.5);
}
.voice-volume-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.voice-vol-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 2px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}
.voice-vol-btn:hover {
    color: var(--text-primary);
}
.message-wrapper.sent .voice-vol-btn {
    color: rgba(255, 255, 255, 0.45);
}
.message-wrapper.sent .voice-vol-btn:hover {
    color: rgba(255, 255, 255, 0.8);
}
.voice-vol-slider {
    width: 0;
    opacity: 0;
    transition:
        width 0.25s,
        opacity 0.2s;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-medium);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}
.voice-vol-slider.open {
    width: 56px;
    opacity: 1;
}
.voice-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-base);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.voice-vol-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-base);
}
.message-wrapper.received .voice-vol-slider::-webkit-slider-thumb {
    background: #34d399;
}
.message-wrapper.received .voice-vol-slider::-moz-range-thumb {
    background: #34d399;
}

/* ═══ SETTINGS DESIGN V2 — iOS 26 Comfortable Dark Glass ═══ */
/* layout, sidebar, tabs & dropdown — see also SETTINGS MODAL section below */
.settings-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}
.settings-divider-accent {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    margin: 0;
    flex-shrink: 0;
}
.settings-sidebar {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(10, 12, 24, 0.55) !important;
    backdrop-filter: blur(48px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(48px) saturate(200%) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding: 10px !important;
    min-width: 200px;
}
.settings-sidebar-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.settings-sidebar-group + .settings-sidebar-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.settings-sidebar-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.25);
    padding: 6px 12px 4px;
}
.settings-sidebar .settings-tab span {
    transition: color 0.15s;
}
#mobile-logout-divider,
#mobile-logout-section {
    display: none;
}
#logout-btn-advanced {
    width: 100%;
    padding: 0.75rem;
    background: rgba(248, 113, 113, 0.06);
    color: rgba(248, 113, 113, 0.8);
    border: 1px solid rgba(248, 113, 113, 0.12);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s ease;
    margin-top: 0.5rem;
}
#logout-btn-advanced:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
    transform: none;
    box-shadow: none;
}
.settings-mobile-nav {
    display: none;
}
.settings-mobile-dropdown {
    position: relative;
}
.settings-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.9rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(24px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    outline: none;
    gap: 0.5rem;
}
.settings-dropdown-btn:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.09) !important;
}
.settings-dropdown-btn:focus-visible {
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.25) !important;
}
.settings-dropdown-btn.open {
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}
.settings-dropdown-current {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}
.settings-dropdown-current i {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #818cf8 !important;
    flex-shrink: 0;
}
.settings-dropdown-current span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#settings-dropdown-arrow {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.2s var(--ease);
    flex-shrink: 0;
}
.settings-dropdown-btn.open #settings-dropdown-arrow {
    transform: rotate(180deg);
    color: #818cf8 !important;
}
.settings-dropdown-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: calc(100% - 2rem);
    max-width: 340px;
    max-height: 60vh;
    overflow-y: auto;
    background: rgba(10, 12, 24, 0.82) !important;
    backdrop-filter: blur(56px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(56px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 24px !important;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 400;
    padding: 8px !important;
}
.settings-dropdown-menu.open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}
.settings-dropdown-menu::-webkit-scrollbar {
    width: 3px;
}
.settings-dropdown-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.settings-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px !important;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65) !important;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    border-radius: 14px !important;
    letter-spacing: -0.01em;
}
.settings-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
}
.settings-dropdown-item:active {
    background: rgba(99, 102, 241, 0.15) !important;
    transform: scale(0.97);
}
.settings-dropdown-item.active {
    color: #ffffff !important;
    font-weight: 600 !important;
    background: rgba(99, 102, 241, 0.18) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
}
.settings-dropdown-item.active::before {
    display: none;
}
.settings-dropdown-item i {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.35);
    flex-shrink: 0;
    transition: color 0.2s;
}
.settings-dropdown-item:hover i {
    color: #ffffff !important;
}
.settings-dropdown-item.active i {
    color: #a78bfa !important;
}
.settings-dropdown-item span {
    flex: 1;
    min-width: 0;
}
.settings-dropdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 399;
    display: none;
    background: transparent;
}
.settings-dropdown-overlay.active {
    display: block;
}
.settings-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
    background: transparent;
}
.settings-content-scroll::-webkit-scrollbar {
    width: 4px;
}
.settings-content-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}
.settings-content-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}
.settings-page-header {
    margin-bottom: 1.25rem;
}
.settings-page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.1rem;
    color: var(--text-primary);
}
.settings-page-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}
.settings-card-section {
    animation: settingsFadeIn 0.3s ease;
}
.settings-card-section + .settings-card-section {
    margin-top: 0.5rem;
}
@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.settings-section-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.settings-section-header i {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
    font-size: 0.8rem;
}
.settings-section-header div {
    flex: 1;
}
.settings-section-header span {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}
.settings-section-header small {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.05rem;
}
.legal-section { padding: 1rem 1.25rem !important; text-align: center; }
.legal-notice { font-size: 0.7rem; color: var(--text-muted); line-height: 1.6; }
.legal-notice a { color: var(--text-muted); text-decoration: none; transition: color 0.15s ease; }
.legal-notice a:hover { color: var(--accent); text-decoration: underline; }

.settings-card-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 1.1rem 0;
}
.settings-avatar-section {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.settings-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    cursor: pointer;
}
.settings-avatar-wrap img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s var(--spring);
}
.settings-avatar-wrap:hover img {
    transform: scale(1.04);
}
.settings-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    box-shadow: none;
}
.settings-avatar-edit:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(139, 124, 246, 0.4);
}
.settings-avatar-edit i {
    color: #fff;
    font-size: 0.65rem;
}
.settings-avatar-info {
    flex: 1;
    min-width: 0;
}
.settings-avatar-info span:first-child {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.1rem;
}
.settings-avatar-info span:last-child {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
}
.settings-form-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    position: relative;
}
.settings-field label {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.settings-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(8, 11, 24, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 14px !important;
    padding: 0 0.85rem;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.3) !important;
}
.settings-input-wrap:hover {
    border-color: rgba(255, 255, 255, 0.18) !important;
    background: rgba(12, 16, 32, 0.55) !important;
}
.settings-input-wrap:focus-within {
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2) !important;
}
.settings-input-wrap i {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: color 0.2s;
}
.settings-input-wrap:focus-within i {
    color: var(--accent);
}
.settings-input-wrap .input {
    flex: 1;
    padding: 0.65rem 0;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
}
.settings-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    resize: vertical;
    min-height: 70px;
    transition: all 0.15s ease;
}
.settings-textarea:hover {
    border-color: rgba(255, 255, 255, 0.1);
}
.settings-textarea:focus {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12);
}
.settings-save-btn {
    width: 100%;
    margin-top: 0.5rem;
}
.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.65rem;
    margin: 0 -0.65rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
    cursor: pointer;
}
.settings-toggle-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.settings-toggle-row + .settings-toggle-row {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.settings-toggle-info {
    flex: 1;
    min-width: 0;
}
.settings-toggle-info span {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}
.settings-toggle-info small {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.08rem;
}
.settings-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.55rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s var(--ease);
}
.settings-info-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.settings-info-row + .settings-info-row {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.settings-info-row span:first-child {
    font-size: 0.84rem;
    color: var(--text-primary);
    font-weight: 500;
}
.settings-info-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: "SF Mono", Consolas, monospace;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    border: 1px solid rgba(255, 255, 255, 0.04);
}
/* Theme selector */
.theme-selector {
    display: flex;
    gap: 0.85rem;
}
.theme-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 0.85rem 0.75rem 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    box-shadow: none;
}
.theme-option::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.06) 0%,
        transparent 60%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}
.theme-option:hover::after {
    opacity: 1;
}
.theme-option:hover {
    border-color: rgba(139, 92, 246, 0.25);
    background: rgba(255, 255, 255, 0.05);
    transform: none;
    box-shadow: none;
}
.theme-option.active {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
    transform: none;
}
.theme-option.active::after {
    opacity: 1;
}
.theme-option span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0.55rem;
}
.theme-preview {
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    gap: 3px;
    padding: 4px;
}
.theme-preview-dark {
    background: #0b0e1a;
}
.theme-preview-light {
    background: #f2f5f9;
}
.tp-sidebar {
    width: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.theme-preview-light .tp-sidebar {
    background: rgba(0, 0, 0, 0.04);
}
.tp-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px;
}
.tp-bubble {
    height: 8px;
    border-radius: 4px;
}
.tp-bubble-sent {
    background: var(--accent);
    align-self: flex-end;
    width: 55%;
}
.tp-bubble-rec {
    background: var(--bg-island);
    align-self: flex-start;
    width: 40%;
    border: 1px solid var(--border-subtle);
}
.theme-preview-light .tp-bubble-rec {
    background: #fff;
}
/* QR login */
.qr-login-container {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}
.qr-login-visual {
    flex-shrink: 0;
}
.qr-frame {
    width: 160px;
    height: 160px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}
.qr-frame img {
    width: 160px;
    height: 160px;
    display: block;
}
.qr-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
}
.qr-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.qr-login-info {
    flex: 1;
    min-width: 0;
}
.qr-login-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}
.qr-login-status.qr-approved {
    color: var(--green);
}
.qr-login-status.qr-error {
    color: var(--danger);
}
.qr-login-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}
/* My QR section */
.myqr-container {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}
.myqr-frame {
    width: 120px;
    height: 120px;
    background: #fff;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    transition: all 0.2s ease;
    padding: 6px;
}
.myqr-frame:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.myqr-frame img {
    width: 120px;
    height: 120px;
    display: block;
}
.myqr-info {
    flex: 1;
    min-width: 0;
}
.myqr-username {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.1rem;
}
.myqr-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.5rem;
}
.myqr-actions {
    display: flex;
    gap: 0.4rem;
}
.myqr-actions .btn {
    transition: opacity 0.15s ease;
}
.myqr-actions .btn:hover {
    transform: none;
    opacity: 0.85;
}
/* Slider row */
.settings-slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-radius: var(--radius-sm);
    transition: background 0.2s var(--ease);
}
.settings-slider-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.settings-slider-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.settings-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}
.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    border: none;
    transition: none;
}
.settings-range::-webkit-slider-thumb:hover {
    transform: none;
}
.settings-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.settings-slider-value {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}
/* Bubble presets */
.bubble-preset {
    min-width: 0;
    transition: all 0.15s ease !important;
}
.bubble-preset:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.04) !important;
    transform: none !important;
}
.bubble-preset.preset-active {
    border-color: rgba(99, 102, 241, 0.5) !important;
    background: rgba(99, 102, 241, 0.08) !important;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2) !important;
    transform: none !important;
}
@media (max-width: 600px) {
    .bubble-preset {
        flex: 1 1 45% !important;
    }
}

/* Disable animations */
[style*="--anim-disable:none"] * {
    transition: none !important;
    animation: none !important;
}

/* Privacy dropdowns */
.privacy-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.6rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}
.privacy-item:hover {
    background: rgba(255, 255, 255, 0.03);
}
.privacy-item + .privacy-item {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.privacy-item-info {
    flex: 1;
    min-width: 0;
}
.privacy-item-info span {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}
.privacy-item-info small {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.08rem;
}
.privacy-select {
    display: none;
}
.custom-privacy-select {
    position: relative;
    flex-shrink: 0;
    min-width: 135px;
}
.custom-privacy-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    outline: none;
    white-space: nowrap;
}
.custom-privacy-btn:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.09) !important;
}
.custom-privacy-btn:focus-visible,
.custom-privacy-btn.open {
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.1) !important;
}
.custom-privacy-btn i {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.2s var(--ease);
    flex-shrink: 0;
}
.custom-privacy-btn.open i {
    transform: rotate(180deg);
    color: #818cf8;
}
.custom-privacy-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 100%;
    background: rgba(20, 20, 28, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 18px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    overflow: hidden;
    padding: 6px !important;
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
    pointer-events: none;
    transition:
        opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 50;
}
.custom-privacy-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.custom-privacy-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem !important;
    border: none;
    border-radius: 12px !important;
    background: transparent;
    color: rgba(255, 255, 255, 0.75) !important;
    font-family: inherit;
    font-size: 0.82rem !important;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease !important;
    text-align: left;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.custom-privacy-option:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}
.custom-privacy-option:active {
    background: rgba(99, 102, 241, 0.15) !important;
}
.custom-privacy-option.selected {
    color: #ffffff !important;
    font-weight: 700 !important;
    background: rgba(99, 102, 241, 0.22) !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
}
.custom-privacy-option.selected i {
    color: #818cf8 !important;
    visibility: visible;
}
.custom-privacy-option i {
    font-size: 0.7rem;
    visibility: hidden;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .privacy-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .custom-privacy-select {
        width: 100%;
    }
}

/* Devices list */
.devices-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.devices-loading,
.devices-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}
.devices-empty i {
    font-size: 1.2rem;
    opacity: 0.5;
}
.devices-error {
    color: var(--danger);
}
.device-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.55rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--ease);
}
.device-row:hover {
    background: rgba(255, 255, 255, 0.03);
}
.device-row + .device-row {
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.device-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.2s var(--ease);
    border: 1px solid var(--border-subtle);
}
.device-row:hover .device-icon {
    color: var(--accent);
    background: linear-gradient(
        135deg,
        var(--accent-soft) 0%,
        rgba(139, 124, 246, 0.12) 100%
    );
    border-color: rgba(139, 124, 246, 0.12);
}
.device-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}
.device-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}
.device-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.device-status {
    flex-shrink: 0;
}
.device-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.device-badge.device-approved {
    background: linear-gradient(
        135deg,
        rgba(34, 197, 94, 0.1) 0%,
        rgba(34, 197, 94, 0.06) 100%
    );
    color: var(--green);
    border: 1px solid rgba(34, 197, 94, 0.1);
}
.device-badge.device-pending {
    background: linear-gradient(
        135deg,
        rgba(234, 179, 8, 0.1) 0%,
        rgba(234, 179, 8, 0.06) 100%
    );
    color: var(--amber);
    border: 1px solid rgba(234, 179, 8, 0.1);
}
.device-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.device-row:hover .device-actions {
    opacity: 1;
}
.device-revoke-btn {
    color: var(--text-muted);
}
.device-revoke-btn:hover {
    color: var(--danger);
    background: rgba(248, 113, 113, 0.1) !important;
}
.device-revoking {
    opacity: 0.5;
    pointer-events: none;
}
.device-revoking .device-revoke-btn i {
    animation: spin 0.6s linear infinite;
}
.devices-actions {
    padding: 0.75rem 0;
    display: flex;
    justify-content: flex-end;
}
.devices-actions .btn-danger {
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.15);
}
.devices-actions .btn-danger:hover {
    background: rgba(248, 113, 113, 0.16);
}
@media (max-width: 600px) {
    .device-actions {
        opacity: 1;
    }
    .settings-layout {
        flex-direction: column;
    }
    .settings-sidebar {
        display: none;
    }
    .settings-mobile-nav {
        display: block;
        margin-bottom: 0.75rem;
    }
    #mobile-logout-divider,
    #mobile-logout-section {
        display: block;
    }
    .settings-content-scroll {
        padding: 0.75rem;
    }
    .modal-card-settings .modal-header {
        padding: 0.85rem 1rem;
    }
    .modal-card-settings .modal-header h3 {
        font-size: 1rem;
    }
    .settings-card {
        padding: 0.9rem;
    }
    .settings-page-header {
        margin-bottom: 0.85rem;
    }
    .settings-page-header h2 {
        font-size: 1.1rem;
    }
    .settings-section-header {
        gap: 0.5rem;
        padding-bottom: 0.6rem;
        margin-bottom: 0.85rem;
    }
    .settings-section-header i {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    .settings-avatar-section {
        flex-direction: column;
        text-align: center;
    }
    .settings-avatar-wrap {
        width: 64px;
        height: 64px;
    }
    .settings-avatar-info span:first-child {
        font-size: 0.95rem;
    }
    .settings-field label {
        font-size: 0.65rem;
    }
    .privacy-item {
        padding: 0.6rem 0.4rem;
    }
    .bubble-preset {
        flex: 1 1 45% !important;
    }
    .qr-login-container {
        flex-direction: column;
        text-align: center;
    }
    .myqr-container {
        flex-direction: column;
        text-align: center;
    }
    .myqr-actions {
        justify-content: center;
    }
    .theme-selector {
        flex-direction: column;
    }
    .theme-option {
        padding: 0.6rem 0.5rem 0.5rem;
    }
    .theme-preview {
        height: 48px;
    }
    .modal-card-settings {
        max-width: 100% !important;
        max-height: 96vh !important;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    }
    .settings-form-grid {
        gap: 0.6rem;
    }
    .settings-input-wrap {
        padding: 0 0.7rem;
    }
}

/* ═══ COMPREHENSIVE LIGHT OVERRIDES ═══ */
[data-theme="light"] .search-box input {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
}
[data-theme="light"] .search-box input:focus {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .messages-container {
    background: transparent;
}
/* Topbar — light theme */
[data-theme="light"] .chat-topbar {
    background: rgba(248, 250, 255, 0.72) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 28px !important;
    margin: 0.5rem 0.75rem 0.25rem 0.75rem !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06), inset 0 1.5px 2px rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .topbar-action-btn {
    color: rgba(0, 0, 0, 0.35) !important;
    background: transparent !important;
}
[data-theme="light"] .topbar-action-btn:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: rgba(0, 0, 0, 0.6) !important;
}
[data-theme="light"] .chat-partner:hover {
    background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .partner-status {
    color: rgba(0, 0, 0, 0.45) !important;
}
[data-theme="light"] .topbar-chip {
    background: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.5);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .chat-back-btn {
    color: rgba(0, 0, 0, 0.35) !important;
}
[data-theme="light"] .chat-back-btn:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: rgba(0, 0, 0, 0.6) !important;
}

/* Sidebar dock — light theme */
[data-theme="light"] .dock-actions {
    border-left-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .dock-action {
    color: rgba(0, 0, 0, 0.25) !important;
}
[data-theme="light"] .dock-action:hover {
    color: rgba(0, 0, 0, 0.45) !important;
}
[data-theme="light"] .dock-chevron {
    opacity: 0.2;
}

/* Composer — light theme */
[data-theme="light"] .composer {
    background: rgba(248, 250, 255, 0.72) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-radius: 36px !important;
    margin: 0.35rem 0.75rem 0.75rem 0.75rem !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06), inset 0 1.5px 2px rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .composer::before {
    background: linear-gradient(90deg, transparent, rgba(124, 106, 224, 0.12), rgba(99, 102, 241, 0.18), rgba(124, 106, 224, 0.12), transparent);
}
[data-theme="light"] .input-wrapper {
    background: rgba(0, 0, 0, 0.04) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(0, 0, 0, 0.07) !important;
    border-radius: var(--radius-full, 9999px) !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease !important;
}
[data-theme="light"] .input-wrapper:focus-within {
    background: #fff !important;
    border-color: var(--accent, #7c6ae0) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02), 0 0 0 3px rgba(124, 106, 224, 0.1), 0 0 25px rgba(124, 106, 224, 0.08) !important;
}
[data-theme="light"] .input-wrapper textarea {
    color: #0f172a !important;
}
[data-theme="light"] .input-wrapper textarea::placeholder {
    color: #94a3b8 !important;
}
[data-theme="light"] .composer-inner-btn {
    color: #94a3b8 !important;
    border-radius: 50% !important;
}
[data-theme="light"] .composer-inner-btn:hover {
    color: var(--accent, #7c6ae0) !important;
    background: rgba(124, 106, 224, 0.08) !important;
}
[data-theme="light"] .composer-attach-btn {
    color: #94a3b8 !important;
}
[data-theme="light"] .composer-attach-btn:hover {
    color: var(--accent, #7c6ae0) !important;
}
[data-theme="light"] .mic-inline {
    background: linear-gradient(135deg, #7c6ae0 0%, #6366f1 100%);
    box-shadow: 0 4px 14px rgba(124, 106, 224, 0.3);
}
[data-theme="light"] .send-btn {
    background: linear-gradient(135deg, #7c6ae0 0%, #6366f1 50%, #3b82f6 100%);
    box-shadow: 0 4px 14px rgba(124, 106, 224, 0.3);
}
[data-theme="light"] .message-wrapper.received .message-bubble {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #1e293b;
}
[data-theme="light"] .messages-date-divider span {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .date-indicator span {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .send-options-menu {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(139, 124, 246, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(139, 124, 246, 0.06), 0 0 40px rgba(139, 124, 246, 0.02);
}
[data-theme="light"] .send-options-menu::after {
    background: rgba(255, 255, 255, 0.96);
    border-right-color: rgba(139, 124, 246, 0.15);
    border-bottom-color: rgba(139, 124, 246, 0.15);
}
[data-theme="light"] .send-opt-item {
    color: #334155;
}
[data-theme="light"] .send-opt-item i {
    color: var(--accent, #8b7cf6);
    background: rgba(139, 124, 246, 0.08);
}
[data-theme="light"] .send-opt-item:hover {
    background: rgba(139, 124, 246, 0.08);
    color: #0f172a;
}
[data-theme="light"] .send-opt-item:hover i {
    background: rgba(139, 124, 246, 0.16);
    color: #7c3aed;
}
[data-theme="light"] .send-opt-item:active {
    background: rgba(139, 124, 246, 0.14);
}
[data-theme="light"] .ephemeral-picker {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(139, 124, 246, 0.25);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .ephemeral-picker .eph-btn {
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
}
[data-theme="light"] .modal-card {
    background: var(--glass-xl);
    border-color: var(--border-light);
    box-shadow: var(--shadow-xl);
}
[data-theme="light"] .modal-card::before {
    opacity: 0;
}
[data-theme="light"] .modal-card-folders .modal-header h3 i {
    color: var(--accent-dark) !important;
    opacity: 0.8 !important;
}
[data-theme="light"] .modal-header {
    border-bottom-color: var(--border-subtle);
}
[data-theme="light"] .create-tabs {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .create-tab {
    color: rgba(0, 0, 0, 0.45);
}
[data-theme="light"] .create-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 4px rgba(99, 102, 241, 0.25);
}
[data-theme="light"] .modal-search {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .modal-search:focus-within {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .modal-search i {
    color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .modal-search input::placeholder {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .search-result-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .search-result-item:active {
    background: rgba(0, 0, 0, 0.07);
}
[data-theme="light"] .search-result-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.25);
}
[data-theme="light"] .group-name-section input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .group-name-section input::placeholder {
    color: rgba(0, 0, 0, 0.25);
}
[data-theme="light"] .group-name-section input:focus {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
[data-theme="light"] .selected-members {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .selected-member-badge {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}
[data-theme="light"] .emoji-panel {
    background: var(--glass-xl);
    border-color: var(--border-light);
}
[data-theme="light"] .emoji-panel::before {
    opacity: 0;
}
[data-theme="light"] .btn-primary {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .toast-notification {
    background: var(--glass-xl);
    border-color: var(--border-light);
}
[data-theme="light"] .typing-indicator {
    background: rgba(250, 248, 244, 0.7);
}
[data-theme="light"] .reply-bar {
    background: linear-gradient(90deg, var(--accent-soft), transparent);
}
[data-theme="light"] .selection-toolbar {
    background: rgba(0, 0, 0, 0.02);
    border-top-color: var(--border-subtle);
}
[data-theme="light"] .lightbox-btn {
    background: rgba(250, 248, 244, 0.85);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}
[data-theme="light"] .lightbox-btn:hover {
    background: #fff;
}
[data-theme="light"] .lightbox-counter {
    background: rgba(250, 248, 244, 0.85);
    border-color: var(--border-subtle);
    color: var(--text-primary);
}
[data-theme="light"] .recording-dialog {
    background: var(--glass-xl);
    border-color: var(--border-light);
}
[data-theme="light"] .chat-section-header {
    color: var(--accent);
    opacity: 0.6;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .modal-card-settings {
    background: rgba(248, 250, 255, 0.82) !important;
    backdrop-filter: blur(56px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(56px) saturate(200%) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.12), inset 0 1.5px 2px rgba(255, 255, 255, 0.9), inset 0 -1px 1.5px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .modal-card-settings::after {
    opacity: 0.7;
}
[data-theme="light"] .modal-card-settings .modal-header {
    background: rgba(240, 244, 252, 0.5) !important;
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .modal-card-settings .modal-header h3 {
    color: #0f172a !important;
}
[data-theme="light"] .settings-sidebar {
    background: rgba(248, 250, 255, 0.35) !important;
    border-right-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .settings-sidebar-label {
    color: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .settings-sidebar .settings-tab {
    background: transparent !important;
    border: none !important;
    color: rgba(0, 0, 0, 0.5) !important;
}
[data-theme="light"] .settings-sidebar .settings-tab i {
    color: rgba(0, 0, 0, 0.25) !important;
    background: transparent !important;
}
[data-theme="light"] .settings-sidebar .settings-tab:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #000 !important;
}
[data-theme="light"] .settings-sidebar .settings-tab:hover i {
    color: rgba(0, 0, 0, 0.5) !important;
}
[data-theme="light"] .settings-sidebar .settings-tab.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.25) !important;
}
[data-theme="light"] .settings-sidebar .settings-tab.active i {
    color: #fff !important;
}
[data-theme="light"] .settings-sidebar-group + .settings-sidebar-group {
    border-top-color: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .settings-card,
[data-theme="light"] .pacc-card,
[data-theme="light"] .privacy-item-card {
    background: rgba(248, 250, 255, 0.48) !important;
    backdrop-filter: blur(48px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(48px) saturate(200%) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: inset 0 1.5px 2px rgba(255, 255, 255, 0.9), 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .settings-card:hover {
    background: rgba(248, 250, 255, 0.6) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .settings-card input[type="text"],
[data-theme="light"] .settings-card input[type="password"],
[data-theme="light"] .settings-card input[type="email"],
[data-theme="light"] .settings-card textarea,
[data-theme="light"] .settings-card select {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
}
[data-theme="light"] .settings-input-wrap {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .settings-input-wrap:hover {
    border-color: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .settings-input-wrap:focus-within {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .settings-input-wrap i {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-input-wrap:focus-within i {
    color: var(--accent, #7c6ae0) !important;
}
[data-theme="light"] .settings-textarea {
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .settings-textarea:hover {
    border-color: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .settings-textarea:focus {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .settings-dropdown-btn {
    background: rgba(248, 250, 255, 0.65) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
    backdrop-filter: blur(20px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(200%) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .settings-dropdown-btn:hover {
    background: rgba(248, 250, 255, 0.85) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}
[data-theme="light"] .settings-dropdown-btn.open {
    background: #ffffff !important;
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15) !important;
}
[data-theme="light"] .settings-dropdown-menu {
    background: rgba(248, 250, 255, 0.82) !important;
    backdrop-filter: blur(48px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(48px) saturate(200%) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.1), inset 0 1px 0 #ffffff !important;
    border-radius: 20px !important;
    padding: 6px !important;
}
[data-theme="light"] .settings-dropdown-item {
    color: #334155 !important;
    border-radius: 14px !important;
}
[data-theme="light"] .settings-dropdown-item:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #4f46e5 !important;
}
[data-theme="light"] .settings-dropdown-item:hover i {
    color: #4f46e5 !important;
}
[data-theme="light"] .settings-dropdown-item.active {
    background: rgba(99, 102, 241, 0.14) !important;
    color: #4338ca !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}
[data-theme="light"] .settings-dropdown-item.active i {
    color: #4338ca !important;
}
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}
[data-theme="light"] .settings-dropdown-item.active i {
    color: #4f46e5 !important;
}
[data-theme="light"] .settings-dropdown-item i {
    color: #64748b !important;
}
[data-theme="light"] .settings-toggle-row:hover,
[data-theme="light"] .settings-info-row:hover,
[data-theme="light"] .privacy-item:hover,
[data-theme="light"] .settings-slider-row:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}
[data-theme="light"] .theme-option {
    background: rgba(255, 255, 255, 0.6) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .theme-option.active {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(99, 102, 241, 0.06) !important;
}
[data-theme="light"] .theme-option:hover {
    border-color: rgba(99, 102, 241, 0.2) !important;
    background: rgba(255, 255, 255, 0.8) !important;
}
[data-theme="light"] .theme-option span {
    color: var(--text-primary) !important;
}
[data-theme="light"] .custom-privacy-btn {
    background: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1e293b !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .custom-privacy-btn:hover {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}
[data-theme="light"] .custom-privacy-btn.open {
    background: #ffffff !important;
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15) !important;
}
[data-theme="light"] .custom-privacy-menu {
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12), inset 0 1px 0 #ffffff !important;
    border-radius: 18px !important;
    padding: 6px !important;
}
[data-theme="light"] .custom-privacy-option {
    color: #334155 !important;
    border-radius: 12px !important;
}
[data-theme="light"] .custom-privacy-option:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #4f46e5 !important;
}
[data-theme="light"] .custom-privacy-option.selected {
    background: rgba(99, 102, 241, 0.14) !important;
    color: #4338ca !important;
    font-weight: 700 !important;
    border: 1px solid rgba(99, 102, 241, 0.25) !important;
}
[data-theme="light"] .custom-privacy-option.selected i {
    color: #4f46e5 !important;
}
[data-theme="light"] .device-icon {
    background: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .device-row:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}
[data-theme="light"] .device-revoke-btn:hover {
    background: rgba(248, 113, 113, 0.08) !important;
}
[data-theme="light"] .settings-section-header {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .settings-section-header i {
    background: rgba(0, 0, 0, 0.03) !important;
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-section-header span {
    color: var(--text-primary) !important;
}
[data-theme="light"] .settings-section-header small {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-toggle-row,
[data-theme="light"] .settings-info-row,
[data-theme="light"] .privacy-item,
[data-theme="light"] .settings-slider-row {
    border-bottom-color: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .settings-toggle-info span,
[data-theme="light"] .privacy-item-info span,
[data-theme="light"] .settings-info-row span:first-child {
    color: var(--text-primary) !important;
}
[data-theme="light"] .settings-toggle-info small,
[data-theme="light"] .privacy-item-info small {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-info-value {
    background: rgba(0, 0, 0, 0.04) !important;
    color: var(--text-secondary) !important;
    border-color: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .settings-slider-label {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-slider-value {
    color: var(--text-secondary) !important;
}
[data-theme="light"] .settings-tab-logout {
    color: var(--danger) !important;
}
[data-theme="light"] .settings-tab-logout i {
    color: var(--danger) !important;
    background: color-mix(in srgb, var(--danger) 8%, rgba(0,0,0,0.02)) !important;
}
[data-theme="light"] .settings-tab-logout:hover {
    color: var(--danger) !important;
    background: rgba(0,0,0,0.03) !important;
}
[data-theme="light"] .settings-tab-logout:hover i {
    background: color-mix(in srgb, var(--danger) 14%, rgba(0,0,0,0.02)) !important;
}
[data-theme="light"] .settings-tab-logout.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.25) !important;
}
[data-theme="light"] .settings-tab-logout.active i {
    color: #fff !important;
    background: rgba(255,255,255,0.18) !important;
}
[data-theme="light"] .bubble-preset {
    border-color: rgba(0, 0, 0, 0.06) !important;
    background: rgba(255, 255, 255, 0.5) !important;
}
[data-theme="light"] .bubble-preset.preset-active {
    border-color: rgba(99, 102, 241, 0.4) !important;
    background: rgba(99, 102, 241, 0.06) !important;
}
[data-theme="light"] .bubble-preset:hover {
    border-color: rgba(0, 0, 0, 0.1) !important;
    background: rgba(255, 255, 255, 0.7) !important;
}
[data-theme="light"] .toggle-slider {
    background: rgba(0, 0, 0, 0.2) !important;
}
[data-theme="light"] .toggle-switch input:checked + .toggle-slider {
    background: #34c759 !important;
}
[data-theme="light"] .settings-range {
    background: rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .settings-range::-webkit-slider-thumb,
[data-theme="light"] .settings-range::-moz-range-thumb {
    background: #fff !important;
}
[data-theme="light"] .settings-avatar-section {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .settings-avatar-wrap img {
    border-color: rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] .settings-avatar-edit {
    border-color: rgba(0, 0, 0, 0.08) !important;
}
[data-theme="light"] .settings-avatar-info span:first-child {
    color: var(--text-primary) !important;
}
[data-theme="light"] .settings-avatar-info span:last-child {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-form-grid label {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-page-header p {
    color: var(--text-muted) !important;
}
[data-theme="light"] .settings-page-header h2 {
    color: var(--text-primary) !important;
}
[data-theme="light"] .settings-checkbox-label {
    color: var(--text-primary) !important;
}
[data-theme="light"] .myqr-frame {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .qr-frame {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .cover-picker-item {
    border-color: rgba(0,0,0,0.06) !important;
}
[data-theme="light"] .devices-actions .btn-danger {
    background: rgba(248, 113, 113, 0.06);
    color: #d32f2f;
    border-color: rgba(248, 113, 113, 0.12);
}
[data-theme="light"] .settings-card-divider {
    background: transparent !important;
}
[data-theme="light"] .fm-section-label {
    color: #94a3b8 !important;
}
[data-theme="light"] .fm-section-label i {
    opacity: 0.4 !important;
}
[data-theme="light"] .fm-create-bar input {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.07) !important;
    color: #0f172a !important;
}
[data-theme="light"] .fm-create-bar input:focus {
    background: #fff !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(124, 106, 224, 0.08) !important;
}
[data-theme="light"] .fm-create-bar input::placeholder {
    color: #94a3b8 !important;
}
[data-theme="light"] .fm-create-bar button {
    box-shadow: 0 2px 8px rgba(124, 106, 224, 0.15) !important;
}
[data-theme="light"] .fm-divider {
    background: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .folder-item:hover {
    background: rgba(0, 0, 0, 0.02) !important;
}
[data-theme="light"] .folder-item:active {
    background: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .folder-item + .folder-item {
    border-top-color: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .folder-item-icon {
    background: rgba(0, 0, 0, 0.03) !important;
    color: var(--accent-dark) !important;
}
[data-theme="light"] .folder-item-name {
    color: #0f172a !important;
}
[data-theme="light"] .folder-item-chats {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #64748b !important;
}
[data-theme="light"] .folder-item-del {
    color: rgba(0, 0, 0, 0.12) !important;
}
[data-theme="light"] .folder-item-del:hover {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #d32f2f !important;
}
[data-theme="light"] .folders-empty i {
    color: #94a3b8 !important;
    opacity: 0.15 !important;
}
[data-theme="light"] .create-folder-form input {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.07) !important;
    color: #0f172a !important;
}
[data-theme="light"] .create-folder-form input:focus {
    background: #fff !important;
    border-color: var(--accent) !important;
}
[data-theme="light"] .create-folder-form input::placeholder {
    color: #94a3b8 !important;
}
[data-theme="light"] .create-folder-form button {
    box-shadow: 0 2px 8px rgba(124, 106, 224, 0.15) !important;
}
[data-theme="light"] .folder-picker {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(64px) !important;
    -webkit-backdrop-filter: blur(64px) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}
[data-theme="light"] .folder-picker-head {
    border-bottom-color: rgba(0, 0, 0, 0.04) !important;
}
[data-theme="light"] .folder-picker-head span {
    color: #0f172a !important;
}
[data-theme="light"] .folder-picker-head small {
    color: #94a3b8 !important;
}
[data-theme="light"] .folder-picker-head i {
    color: var(--accent-dark) !important;
    opacity: 0.8 !important;
}
[data-theme="light"] .fp-close-btn {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #94a3b8 !important;
}
[data-theme="light"] .fp-close-btn:hover {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #334155 !important;
}
[data-theme="light"] .folder-picker-item {
    color: #64748b !important;
}
[data-theme="light"] .folder-picker-item:hover {
    background: rgba(0, 0, 0, 0.02) !important;
    color: #0f172a !important;
}
[data-theme="light"] .folder-picker-item:active {
    background: rgba(0, 0, 0, 0.05) !important;
}
[data-theme="light"] .folder-picker-item + .folder-picker-item {
    border-top-color: rgba(0, 0, 0, 0.03) !important;
}
[data-theme="light"] .folder-picker-item i {
    color: #94a3b8 !important;
}
[data-theme="light"] .folder-picker-item.active {
    color: var(--accent-dark) !important;
}
[data-theme="light"] .folder-picker-item.active i {
    color: var(--accent-dark) !important;
}
[data-theme="light"] .fp-item-count {
    background: rgba(0, 0, 0, 0.04) !important;
    color: #94a3b8 !important;
}
[data-theme="light"] .folder-picker-create {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
}
[data-theme="light"] .folder-picker-create:focus-within {
    border-color: var(--accent) !important;
    background: #fff !important;
}
[data-theme="light"] .folder-picker-create input {
    color: #0f172a !important;
}
[data-theme="light"] .folder-picker-create input::placeholder {
    color: #94a3b8 !important;
}
[data-theme="light"] .fp-empty {
    color: #94a3b8 !important;
}
[data-theme="light"] .devices-actions .btn-danger:hover {
    background: rgba(248, 113, 113, 0.12);
}
[data-theme="light"] .sidebar-notif {
    background: rgba(250, 248, 244, 0.92);
    border-color: var(--border-subtle);
}
.push-info-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}
.push-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.push-status-icon.idle {
    background: var(--bg-input);
    color: var(--text-muted);
}
.push-status-icon.ok {
    background: rgba(76, 175, 80, 0.12);
    color: #4caf50;
}
.push-status-icon.err {
    background: rgba(244, 67, 54, 0.12);
    color: #f44336;
}
.push-status-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.push-status-text span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.push-status-text small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Visual polish */
@keyframes skeletonPulse {
    0%,
    100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
}
@keyframes popIn {
    0% {
        transform: scale(0.85);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
.message-wrapper.sent:hover .message-bubble-wrapper {
    transform: none;
}
.message-wrapper.received:hover .message-bubble-wrapper {
    transform: none;
}
.message-wrapper.selected-for-delete .message-bubble-wrapper {
    transform: scale(0.97);
    opacity: 0.7;
}
.message-wrapper.dimmed {
    opacity: 0.35;
}
.new-message {
    animation: popIn 0.2s var(--spring);
}
.sidebar-tab.active {
    position: relative;
}
.sidebar-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    animation: fadeSlide 0.2s var(--ease);
}
.toast.show {
    animation: popIn 0.25s var(--spring);
}
.chat-item.active {
    transition: all 0.2s var(--spring);
}
.chat-item {
    transition:
        all 0.15s var(--ease),
        padding 0.2s var(--ease);
}

/* ═══════════════════════════════════════════
   MOBILE — clean consolidated overrides
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* sidebar.css переопределяет основные переменные и лейаут */
    :root {
        --nav-width: 0px;
        --sidebar-width: 100%;
    }

    /* ═══════════════════════════════════
       HEADER
       ═══════════════════════════════════ */
    .sidebar-header {
        padding: 1.15rem 1.05rem 0.95rem;
    }
    .sidebar-brand {
        gap: 0.55rem;
    }
    .sidebar-brand-icon {
        width: 44px;
        height: 44px;
        border-radius: 15px;
        background: linear-gradient(135deg, #8b7cf6, #7465d4);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 4px 12px rgba(0, 0, 0, 0.15);
        font-size: 0.95rem;
    }
    .sidebar-brand span {
        font-size: 1.25rem;
        font-weight: 800;
        letter-spacing: -0.03em;
        color: var(--accent-light);
    }
    .sidebar-action-btn {
        width: 44px;
        height: 44px;
        border-radius: 15px;
        font-size: 1rem;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        color: var(--text-secondary);
        transition: all 0.2s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .sidebar-action-btn:active {
        background: var(--accent);
        color: #fff;
        transform: scale(0.9);
    }

    /* ═══════════════════════════════════
       PROFILE CARD
       ═══════════════════════════════════ */
    .sidebar-profile {
        margin: 0.3rem 0.95rem 0.7rem;
        padding: 0.75rem 0.85rem;
        background: var(--bg-glass);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--border-subtle);
        border-radius: 24px;
        box-shadow: 0 4px 28px rgba(0, 0, 0, 0.1);
    }
    .sidebar-profile:active {
        transform: scale(0.97);
    }
    .profile-avatar {
        width: 48px;
        height: 48px;
        min-width: 48px;
        border-radius: 50%;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
    .profile-avatar::after {
        border-color: rgba(22, 26, 44, 0.55);
    }
    .profile-name {
        font-size: 0.92rem;
        font-weight: 600;
        letter-spacing: -0.015em;
    }
    .profile-status {
        font-size: 0.74rem;
        opacity: 0.5;
        font-weight: 500;
    }

    /* ═══════════════════════════════════
       SEARCH
       ═══════════════════════════════════ */
    .sidebar-search {
        padding: 0 0.9rem 0.6rem;
    }
    .sidebar-search input {
        height: 46px;
        padding: 0 1.1rem 0 2.6rem;
        font-size: 0.87rem;
        font-weight: 400;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        border-radius: 18px;
        color: var(--text-primary);
        box-shadow:
            inset 0 1px 3px rgba(0, 0, 0, 0.06),
            0 1px 2px rgba(0, 0, 0, 0.03);
        transition: all 0.25s ease;
    }
    .sidebar-search input::placeholder {
        color: var(--text-muted);
        opacity: 0.45;
    }
    .sidebar-search input:focus {
        background: var(--bg-surface);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow:
            0 0 0 3px rgba(255, 255, 255, 0.02),
            inset 0 1px 2px rgba(0, 0, 0, 0.03);
    }
    .sidebar-search i {
        left: 1.6rem;
        font-size: 0.8rem;
        color: var(--text-muted);
        opacity: 0.4;
        transition: all 0.25s ease;
    }
    .sidebar-search:focus-within i {
        color: var(--accent);
        opacity: 0.7;
    }

    /* ═══════════════════════════════════
       TABS
       ═══════════════════════════════════ */
    .sidebar-tabs {
        padding: 0 0.9rem 0.55rem;
        gap: 0.55rem;
    }
    .sidebar-tab {
        flex: 1;
        padding: 0.62rem 0;
        background: transparent;
        border: none;
        border-bottom: 3px solid transparent;
        font-size: 0.86rem;
        font-weight: 500;
        color: var(--text-muted);
        transition: all 0.2s ease;
    }
    .sidebar-tab span {
        display: inline !important;
    }
    .sidebar-tab i {
        display: none;
    }
    .sidebar-tab.active {
        border-bottom-color: var(--accent);
        color: var(--accent);
        font-weight: 600;
    }
    .sidebar-tab.active::after {
        display: none;
    }
    .sidebar-tab:hover {
        color: var(--text-secondary);
    }

    /* ═══════════════════════════════════
       CHAT ITEMS
       ═══════════════════════════════════ */
    .chat-item {
        padding: 0.75rem 0.9rem;
        gap: 0.85rem;
        border-radius: 20px;
        margin-bottom: 5px;
        background: transparent;
        border: none;
        transition: all 0.22s ease;
    }
    .chat-item:hover {
        background: var(--bg-elevated);
    }
    .chat-item:active {
        background: var(--bg-hover);
        transform: scale(0.98);
    }
    .chat-item.active {
        background: rgba(255, 255, 255, 0.02);
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    }
    .chat-item.active::before {
        display: none;
    }
    .chat-avatar {
        width: 54px;
        height: 54px;
        min-width: 54px;
        font-size: 1.15rem;
        font-weight: 700;
        border-radius: 50%;
        background: linear-gradient(135deg, #8b7cf6, #6366f1);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        transition: transform 0.2s ease;
    }
    .chat-item.active .chat-avatar {
        box-shadow:
            0 0 0 2px rgba(255, 255, 255, 0.08),
            0 4px 12px rgba(0, 0, 0, 0.12);
    }
    .chat-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.25rem;
        overflow: hidden;
    }
    .chat-name {
        font-size: 0.98rem;
        font-weight: 600;
        letter-spacing: -0.015em;
        line-height: 1.2;
    }
    .chat-preview {
        font-size: 0.84rem;
        line-height: 1.35;
        opacity: 0.52;
        font-weight: 400;
    }
    .chat-meta {
        align-self: flex-start;
        gap: 0.45rem;
        padding-top: 0.22rem;
    }
    .chat-time {
        font-size: 0.67rem;
        opacity: 0.38;
        font-weight: 500;
    }
    .unread-badge {
        min-width: 22px;
        height: 22px;
        font-size: 0.62rem;
        font-weight: 700;
        background: linear-gradient(135deg, var(--accent), var(--accent-dark));
        color: #fff;
        border-radius: 50%;
    }
    .chat-section-header {
        font-size: 0.63rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.13em;
        color: var(--text-muted);
        opacity: 0.42;
        padding: 0.65rem 0.95rem 0.28rem;
    }
    .channel-avatar {
        width: 54px;
        height: 54px;
        min-width: 54px;
        border-radius: 50%;
        background: linear-gradient(135deg, #f59e0b, #d97706);
        box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
    }

    /* ═══════════════════════════════════
       BOTTOM BAR
       ═══════════════════════════════════ */
    .sidebar-bottom {
        padding: 0.7rem 0.9rem;
        gap: 0.55rem;
        background: linear-gradient(
            180deg,
            transparent 0%,
            var(--bg-elevated) 45%
        );
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
        position: sticky;
        bottom: 0;
        z-index: 5;
    }
    .sidebar-bottom-btn {
        flex: 1;
        padding: 0.75rem;
        border-radius: 14px;
        font-size: 0.86rem;
        font-weight: 500;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        transition: all 0.2s ease;
    }
    .sidebar-bottom-btn:active {
        transform: scale(0.95);
        background: var(--bg-hover);
    }

    /* ═══════════════════════════════════
       TOPBAR (dialog)
       ═══════════════════════════════════ */
    .chat-topbar {
        padding: 0.8rem 1rem;
        background: linear-gradient(
            180deg,
            rgba(14, 18, 28, 0.92) 0%,
            rgba(14, 18, 28, 0.88) 100%
        );
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
    }
    .chat-back-btn {
        width: 44px;
        height: 44px;
        border-radius: 16px;
        font-size: 1.2rem;
        margin-right: 0.45rem;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        color: var(--text-secondary);
    }
    .chat-back-btn:active {
        background: var(--bg-hover);
        transform: scale(0.93);
    }
    .partner-avatar {
        width: 44px;
        height: 44px;
        font-size: 1rem;
        border-radius: 50%;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    }
    .partner-info h3 {
        font-size: 1rem;
        font-weight: 600;
        letter-spacing: -0.015em;
    }
    .partner-status {
        font-size: 0.78rem;
        opacity: 0.5;
        font-weight: 500;
    }
    .topbar-actions .btn-icon {
        width: 44px;
        height: 44px;
        border-radius: 16px;
        font-size: 1.1rem;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
    }
    .topbar-actions .btn-icon:active {
        background: var(--bg-hover);
        transform: scale(0.93);
    }
    .topbar-actions .btn-icon:not(#chat-info-btn) {
        display: none;
    }

    /* ═══════════════════════════════════
       MESSAGES
       ═══════════════════════════════════ */
    .messages-container {
        padding: 0.9rem 0.7rem;
        background: var(--bg-surface);
    }
    .message-wrapper {
        max-width: 76%;
        margin-bottom: 0.35rem;
    }
    .message-wrapper:active {
        transform: scale(0.97);
    }
    .message-bubble {
        padding: 0.7rem 1rem;
        font-size: 0.96rem;
        line-height: 1.5;
        border-radius: 24px;
    }
    .message-wrapper.sent .message-bubble {
        background: linear-gradient(
            135deg,
            var(--accent) 0%,
            var(--accent-dark) 100%
        );
        color: #fff;
        border-bottom-right-radius: 7px;
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.08),
            0 4px 12px rgba(0, 0, 0, 0.15);
    }
    .message-wrapper.received .message-bubble {
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
        border-bottom-left-radius: 7px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    }
    .message-meta {
        font-size: 0.68rem;
        opacity: 0.6;
        margin-top: 0.28rem;
    }
    .message-sender-name {
        font-size: 0.8rem;
        font-weight: 600;
        margin-bottom: 0.18rem;
        color: var(--accent-light);
    }
    .messages-date-divider {
        margin: 0.85rem 0 0.35rem;
        gap: 0.65rem;
    }
    .messages-date-divider span {
        padding: 0.28rem 0.9rem;
        font-size: 0.72rem;
        font-weight: 600;
        border-radius: 14px;
        background: var(--bg-elevated);
        border: 1px solid var(--border-subtle);
    }
    .date-indicator {
        top: 4px;
    }
    .date-indicator span {
        font-size: 0.58rem;
        padding: 0.16rem 0.7rem;
    }

    /* ═══════════════════════════════════
       COMPOSER
       ═══════════════════════════════════ */
    /* ═══════════════════════════════════
       MOBILE COMPOSER - ULTRA CONVENIENT
       ═══════════════════════════════════ */
    .composer {
        padding: 0.5rem 0.6rem calc(0.5rem + env(safe-area-inset-bottom, 0px)) 0.6rem;
        gap: 0.4rem;
        background: rgba(16, 18, 30, 0.9);
        backdrop-filter: blur(32px) saturate(220%);
        -webkit-backdrop-filter: blur(32px) saturate(220%);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.35);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        display: flex;
        align-items: flex-end;
    }

    .input-wrapper {
        flex: 1;
        display: flex;
        align-items: center;
        padding: 0 0.4rem;
        background: rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 24px;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
        min-height: 44px;
        box-sizing: border-box;
    }

    .input-wrapper:focus-within {
        background: rgba(0, 0, 0, 0.42);
        border-color: rgba(139, 124, 246, 0.6);
        box-shadow: 0 0 0 3px rgba(139, 124, 246, 0.22);
    }

    .input-wrapper textarea {
        flex: 1;
        font-size: 0.96rem;
        padding: 0.55rem 0.3rem;
        line-height: 1.35;
        max-height: 120px;
        margin: 0;
        align-self: center;
        box-sizing: border-box;
    }

    .composer-inner-btn {
        width: 36px;
        height: 36px;
        font-size: 1.15rem;
        margin: 0;
        align-self: center;
    }

    .composer-send-wrapper {
        width: 44px;
        height: 44px;
        margin: 0;
        align-self: flex-end;
    }

    .send-btn,
    .mic-inline {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    .send-btn:active {
        transform: scale(0.88);
    }
    .mic-inline:active {
        transform: scale(0.88);
    }

    .ephemeral-picker {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 94vw;
        overflow-x: auto;
        bottom: calc(100% + 8px);
        padding: 6px 8px;
        border-radius: 20px;
        background: rgba(16, 18, 30, 0.95);
        border: 1px solid rgba(167, 139, 250, 0.3);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    }

    .reply-bar {
        margin: 0 0.5rem 0.4rem 0.5rem;
        padding: 0.55rem 0.85rem;
        border-radius: 14px;
    }

    .file-previews {
        left: 0.5rem;
        right: 0.5rem;
        bottom: calc(100% + 6px);
        padding: 6px 8px;
        border-radius: 16px;
    }

    .file-preview-item {
        width: 60px;
        height: 60px;
        border-radius: 12px;
    }

    /* ═══════════════════════════════════
       RECORDING — TELEGRAM-STYLE
       ═══════════════════════════════════ */
    .recording-bar {
        display: none;
        flex: 1;
        align-items: center;
        gap: 0.6rem;
        padding: 0.35rem 0.35rem 0.35rem 0.6rem;
        border-radius: 28px;
    }
    .composer.recording-active .input-wrapper,
    .composer.recording-active .file-previews,
    .composer.recording-active .composer-send-wrapper {
        display: none !important;
    }
    .composer.recording-active .recording-bar {
        display: flex !important;
    }
    .rec-bar-cancel,
    .rec-bar-send {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .rec-bar-cancel {
        color: #94a3b8;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        font-size: 1.1rem;
    }
    .rec-bar-cancel:hover {
        background: rgba(239, 68, 68, 0.15);
        color: #ef4444;
        border-color: rgba(239, 68, 68, 0.2);
    }
    .rec-bar-cancel:active {
        transform: scale(0.9);
    }
    .rec-bar-send {
        background: linear-gradient(135deg, #8b5cf6, #6366f1);
        color: #fff;
        font-size: 1.15rem;
        box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    .rec-bar-send:hover {
        box-shadow: 0 6px 22px rgba(139, 92, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
        transform: scale(1.08);
    }
    .rec-bar-send:active {
        transform: scale(0.92);
    }
    .rec-bar-indicator {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        justify-content: center;
    }
    .rec-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #ef4444;
        animation: recPulse 1s ease-in-out infinite;
    }
    @keyframes recPulse {
        0%, 100% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.5; transform: scale(0.85); }
    }
    .rec-bar-timer {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text-primary);
        font-variant-numeric: tabular-nums;
        letter-spacing: 0.02em;
        min-width: 3.2rem;
        text-align: center;
    }
    .rec-bar-wave {
        display: none;
    }

    /* ═══════════════════════════════════
       REPLY / PINNED
       ═══════════════════════════════════ */
    .reply-bar {
        padding: 0.65rem 1rem;
        border-top: 1px solid var(--border-subtle);
        border-left: 4px solid var(--accent);
        background: var(--accent-soft);
    }
    .pinned-banner {
        padding: 0.6rem 1rem;
        background: var(--accent-soft);
        border-left: 4px solid var(--accent);
        margin: 0.45rem 0.6rem;
        border-radius: 10px;
    }

    /* ═══════════════════════════════════
       MODALS / PANELS / MISC
       ═══════════════════════════════════ */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
        z-index: 300;
    }
    .modal-card {
        max-width: 100%;
        max-height: 94vh;
        border-radius: 26px 26px 0 0;
    }
    .modal-body {
        padding: 1.4rem 1.5rem;
        max-height: calc(94vh - 130px);
    }
    .modal-header {
        padding: 1.4rem 1.5rem 0.9rem;
    }
    .modal-header h3 {
        font-size: 1.1rem;
        font-weight: 700;
    }
    .modal-footer {
        padding: 0.9rem 1.5rem 1.4rem;
    }
    .modal-card-settings {
        height: 96vh;
        max-height: 96vh;
        border-radius: 26px 26px 0 0;
    }

    .emoji-panel {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-height: 48vh;
        transform: translateY(100%);
        border-radius: 22px 22px 0 0;
        z-index: 350;
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.16);
    }
    .emoji-panel.active {
        transform: translateY(0);
    }
    .emoji-grid span {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
        border-radius: 14px;
    }

    .context-menu {
        min-width: 210px;
        border-radius: 18px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    }
    .context-menu-item {
        padding: 0.75rem 1rem;
        font-size: 0.92rem;
        border-radius: 12px;
    }

    .auth-card {
        flex-direction: column;
        min-height: auto;
        border-radius: 24px;
    }
    .auth-left {
        width: 100%;
        padding: 2rem 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
    .auth-left::after {
        display: none;
    }
    .auth-right {
        width: 100%;
        padding: 1.5rem;
    }
    .auth-features {
        display: none;
    }
    .auth-logo-text {
        font-size: 2.2rem;
    }

    .empty-avatar {
        width: 88px;
        height: 88px;
    }

    .connection-status {
        display: none !important;
    }
    .lightbox-btn {
        width: 42px;
        height: 42px;
    }
    .scroll-bottom-hint {
        bottom: 76px;
        right: 12px;
        width: 44px;
        height: 44px;
        border-radius: 16px;
    }
    .voice-badge {
        bottom: 126px;
        right: 12px;
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }
    .recording-dialog {
        min-width: auto;
        padding: 1.5rem;
        border-radius: 22px;
    }
    .delete-confirm-dialog {
        min-width: auto;
    width: 90vw !important;
        border-radius: 18px;
    }
    .media-wrap {
        max-width: 290px;
        border-radius: 14px;
    }
    .media-sticker img {
        max-width: 170px;
        max-height: 170px;
    }
    .message-voice {
        min-width: auto;
    }
    .media-file {
        min-width: auto;
    }
}

/* ═══ COVER COLOR PICKER ═══ */
.cover-options-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.45rem;
    margin-top: 0.5rem;
}
.cover-color-opt {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
    position: relative;
}
.cover-color-opt:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.cover-color-opt.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.cover-pattern-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0.6rem 0.3rem;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    min-height: 60px;
}
.cover-pattern-opt:hover {
    transform: translateY(-2px);
}
.cover-pattern-opt.active {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.cover-pattern-opt i {
    font-size: 1.3rem;
    color: var(--accent);
}
.cover-pattern-opt span {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ═══ CHAT SWIPE ACTIONS ═══ */
.chat-swipe-actions {
    position: absolute;
    right: 0;
    top: 6px;
    bottom: 6px;
    display: flex;
    align-items: stretch;
    z-index: 0;
    gap: 2px;
    padding: 3px;
    background: var(--glass-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow:
        var(--shadow-lg),
        0 0 40px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: swipeIn 0.4s var(--spring);
}
@keyframes swipeIn {
    0% {
        opacity: 0;
        transform: translateX(16px) scale(0.88) rotateY(-8deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1) rotateY(0);
    }
}
.csa-btn {
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    color: #fff;
    border-radius: var(--radius-lg);
    transition: all 0.25s var(--spring);
    position: relative;
    overflow: hidden;
    background: transparent;
}
.csa-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.csa-btn::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: calc(var(--radius-lg) - 1px);
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.csa-btn:hover::before {
    opacity: 1;
}
.csa-btn:hover::after {
    opacity: 1;
}
.csa-btn:active {
    transform: scale(0.85);
}
.csa-btn i {
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
    transition: all 0.3s var(--spring);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.csa-btn:hover i {
    transform: scale(1.15) rotate(0deg);
}
.csa-btn:active i {
    transform: scale(0.85);
}

.csa-archive {
    color: #a5b4fc;
}
.csa-archive::before {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.45),
        rgba(79, 70, 229, 0.25)
    );
    box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.15);
}
.csa-archive:hover {
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.3);
}
.csa-archive:hover i {
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.6))
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.csa-mute {
    color: #fcd34d;
}
.csa-mute::before {
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.45),
        rgba(217, 119, 6, 0.25)
    );
    box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.15);
}
.csa-mute:hover {
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.3);
}
.csa-mute:hover i {
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.6))
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.csa-delete {
    color: #fca5a5;
}
.csa-delete::before {
    background: linear-gradient(
        135deg,
        rgba(239, 68, 68, 0.45),
        rgba(220, 38, 38, 0.25)
    );
    box-shadow: inset 0 0 20px rgba(239, 68, 68, 0.15);
}
.csa-delete:hover {
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.3);
}
.csa-delete:hover i {
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.6))
        drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.csa-btn .csa-glow {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    transform: translate(-50%, -50%);
    top: 50%;
    left: 50%;
}
.csa-archive .csa-glow {
    background: radial-gradient(
        circle,
        rgba(99, 102, 241, 0.3),
        transparent 70%
    );
}
.csa-mute .csa-glow {
    background: radial-gradient(
        circle,
        rgba(245, 158, 11, 0.3),
        transparent 70%
    );
}
.csa-delete .csa-glow {
    background: radial-gradient(
        circle,
        rgba(239, 68, 68, 0.3),
        transparent 70%
    );
}
.csa-btn:hover .csa-glow {
    opacity: 1;
}

/* ═══ REDUCED MOTION ═══ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.1s !important;
    }
}

@keyframes suggest-hero-shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.suggest-card {
    max-width: 480px;
    padding: 0;
    overflow: hidden;
}

.suggest-hero {
    position: relative;
    height: 130px;
    background: linear-gradient(120deg, #6366f1, #8b7cf6, #b4a4fc, #818cf8, #6366f1);
    background-size: 300% 300%;
    animation: suggest-hero-shimmer 8s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.suggest-hero-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent 65%);
    filter: blur(20px);
    animation: suggest-glow 4s ease-in-out infinite;
}
.suggest-hero-icon {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}
.suggest-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    color: #fff;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.8;
}
.suggest-close-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.35);
}

.suggest-body {
    padding: 1.5rem 1.5rem 1rem;
}
.suggest-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    background: linear-gradient(180deg, #fff, var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.suggest-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}
.suggest-textarea-wrap {
    position: relative;
}
.suggest-textarea-wrap textarea {
    width: 100%;
    resize: vertical;
    min-height: 130px;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.55;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.suggest-textarea-wrap textarea:focus {
    outline: none;
    border-color: rgba(139, 124, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(139, 124, 246, 0.1);
}
.suggest-textarea-wrap textarea::placeholder {
    color: var(--text-muted);
}
.suggest-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.6rem;
}
.suggest-counter {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
.suggest-error {
    color: var(--danger);
    font-size: 0.72rem;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.suggest-error.show {
    opacity: 1;
}

.suggest-footer {
    padding: 1rem 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
.suggest-send {
    background: linear-gradient(135deg, var(--accent), #6366f1);
    box-shadow: 0 4px 16px rgba(139, 124, 246, 0.35);
}
.suggest-send:hover {
    box-shadow: 0 6px 22px rgba(139, 124, 246, 0.45);
}
.suggest-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.suggest-send i {
    transition: transform 0.2s var(--spring);
}
.suggest-send:hover i {
    transform: translateX(3px) rotate(-8deg);
}

/* ═══ CUSTOM STATUS BADGE & PRESET PICKER ═══ */
.custom-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    color: var(--text-primary, #f1f5f9);
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s var(--spring);
    user-select: none;
    cursor: pointer;
}
.custom-status-pill:hover {
    transform: translateY(-1px) scale(1.03);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
.custom-status-pill .status-emoji {
    font-size: 0.88rem;
    line-height: 1;
}
.custom-status-pill .status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.status-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}
.status-preset-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s var(--ease);
}
.status-preset-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
    color: #fff;
    transform: translateY(-1px);
}
.status-preset-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}
.status-preset-btn .preset-emoji {
    font-size: 1.1rem;
}

/* ═══ ACTIVE SESSIONS SECURITY DASHBOARD ═══ */
.sessions-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}
.session-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    transition: all 0.22s var(--ease);
}
.session-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.session-card.current-session {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99, 102, 241, 0.05));
}
.session-device-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--accent);
    flex-shrink: 0;
}
.session-card.current-session .session-device-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(52, 211, 153, 0.2));
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}
.session-info {
    flex: 1;
    min-width: 0;
}
.session-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.session-current-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.session-sub {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}
.terminate-sessions-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    margin-top: 1.25rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.25));
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.22s var(--ease);
}
.terminate-sessions-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.35));
    border-color: rgba(239, 68, 68, 0.55);
    color: #fff;
    transform: translateY(-1.5px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* ═══ VOICE WAVEFORM PLAYER & SPEED CONTROLLER ═══ */
.voice-player-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.95rem;
    min-width: 240px;
    max-width: 320px;
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.voice-play-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border: none;
    color: #fff;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: all 0.2s var(--spring);
    flex-shrink: 0;
}
.voice-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.55);
}
.voice-play-btn:active {
    transform: scale(0.94);
}
.voice-wave-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.voice-spectrum {
    display: flex;
    align-items: center;
    gap: 2.5px;
    height: 22px;
    cursor: pointer;
}
.voice-spectrum-bar {
    flex: 1;
    width: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 3px;
    transition: height 0.15s var(--ease), background 0.15s ease;
}
.voice-spectrum-bar.played {
    background: #a855f7;
    box-shadow: 0 0 6px rgba(168, 85, 247, 0.6);
}
.message-wrapper.sent .voice-spectrum-bar {
    background: rgba(255, 255, 255, 0.45);
}
.message-wrapper.sent .voice-spectrum-bar.played {
    background: #ffffff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}
.voice-time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}
.message-wrapper.sent .voice-time-row {
    color: rgba(255, 255, 255, 0.7);
}
.voice-speed-badge {
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s var(--ease);
    user-select: none;
}
.voice-speed-badge:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* ==========================================================================
   ADMIN PANEL (XSM CONTROL) — NATIVE XSSM APP DESIGN SYSTEM INTEGRATION
   ========================================================================== */

.modal-card-admin {
    width: 95vw;
    max-width: 1120px;
    height: 86vh;
    max-height: 760px;
    padding: 0 !important;
    display: flex !important;
    flex-direction: row !important;
    overflow: hidden !important;
    position: relative !important;
    border-radius: var(--radius-2xl, 24px) !important;
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14)) !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 40px var(--accent-glow, rgba(139, 124, 246, 0.1)) !important;
    background: var(--bg-surface, #101422) !important;
    backdrop-filter: blur(24px) !important;
}

/* Sleek Admin Input Fields & Search Inputs */
.admin-search {
    position: relative;
    margin-bottom: 1.1rem;
    display: flex;
    align-items: center;
}

.admin-search input,
.admin-content input[type="text"],
.admin-content input[type="number"],
.admin-content input[type="search"],
.admin-content input[type="password"],
.admin-content textarea,
.admin-content select,
.admin-content .input {
    width: 100%;
    background: rgba(15, 17, 28, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: var(--radius-md, 12px) !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    padding: 0.7rem 1.1rem !important;
    transition: all 0.22s ease !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    outline: none !important;
}

.admin-search input::placeholder,
.admin-content input::placeholder,
.admin-content textarea::placeholder {
    color: #64748b !important;
    font-weight: 400 !important;
}

.admin-search input:focus,
.admin-content input[type="text"]:focus,
.admin-content input[type="number"]:focus,
.admin-content input[type="search"]:focus,
.admin-content textarea:focus,
.admin-content select:focus,
.admin-content .input:focus {
    background: rgba(22, 26, 44, 0.95) !important;
    border-color: var(--accent, #8b7cf6) !important;
    box-shadow:
        0 0 14px rgba(139, 124, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.admin-content input:disabled,
.admin-content textarea:disabled,
.admin-content select:disabled {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    opacity: 0.65 !important;
}

/* Sidebar Styling - Native App Sidebar Theme */
.admin-sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--bg-surface, #101422);
    border-right: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
    gap: 1.2rem;
    z-index: 1;
}

.admin-sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0 0.4rem 0.85rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.admin-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 12px);
    background: linear-gradient(135deg, var(--accent, #8b7cf6) 0%, var(--accent-dark, #7465d4) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 14px rgba(139, 124, 246, 0.35);
    transition: transform 0.25s ease;
}

.admin-logo-icon:hover {
    transform: scale(1.06);
}

.admin-title-wrap h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    letter-spacing: -0.01em;
}

.admin-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: var(--radius-full, 9999px);
    background: rgba(248, 113, 113, 0.15);
    color: var(--red, #f87171);
    border: 1px solid rgba(248, 113, 113, 0.3);
    margin-top: 2px;
}

.admin-badge.role-staff {
    background: rgba(129, 140, 248, 0.15);
    color: var(--accent-light, #b4a4fc);
    border-color: rgba(129, 140, 248, 0.3);
}

/* Tabs */
.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.admin-tab {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary, #959db5);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trans, all 0.2s ease);
    text-align: left;
    width: 100%;
}

.admin-tab i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.admin-tab:hover {
    background: var(--bg-hover, #1d2137);
    color: var(--text-primary, #ebeef5);
    border-color: var(--border-subtle, rgba(255, 255, 255, 0.06));
}

.admin-tab:hover i {
    transform: scale(1.1);
    color: var(--accent-light, #b4a4fc);
}

.admin-tab.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(139, 124, 246, 0.3);
}

.admin-tab.active i {
    color: #ffffff;
}

.admin-sidebar-footer {
    padding: 0.8rem 0.4rem 0;
    font-size: 0.74rem;
    color: var(--text-muted, #58607a);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    font-weight: 600;
}

.admin-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green, #34d399);
    box-shadow: 0 0 8px var(--green, #34d399);
}

/* Main Wrap & Topbar */
.admin-main-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-base, #0b0e1a);
    overflow: hidden;
    z-index: 1;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.6rem;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    background: var(--bg-surface, #101422);
}

.admin-topbar h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    display: flex;
    align-items: center;
    gap: 0.65rem;
    letter-spacing: -0.01em;
}

.admin-topbar h4 i {
    color: var(--accent, #8b7cf6);
}

.admin-content {
    flex: 1;
    padding: 1.6rem;
    overflow-y: auto;
    position: relative;
}

/* Hero Greeting Banner */
.admin-hero-banner {
    background: linear-gradient(135deg, rgba(139, 124, 246, 0.15) 0%, rgba(22, 26, 44, 0.8) 100%);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-xl, 20px);
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.2));
}

.admin-hero-title h2 {
    margin: 0 0 0.3rem;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-hero-title p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #959db5);
    font-weight: 500;
}

.admin-hero-badges {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-hero-pill {
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-full, 9999px);
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary, #ebeef5);
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* KPI Cards Grid */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.admin-stat-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--trans, all 0.2s ease);
}

.admin-stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-medium, rgba(255, 255, 255, 0.14));
    background: var(--bg-elevated, #161a2c);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.admin-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 12px);
    background: var(--accent-soft, rgba(139, 124, 246, 0.08));
    color: var(--accent, #8b7cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.admin-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    letter-spacing: -0.02em;
    line-height: 1;
}

.admin-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #959db5);
    font-weight: 600;
}

/* Quick Actions */
.admin-section-header-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--text-muted, #58607a);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-quick-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.admin-quick-btn {
    padding: 0.7rem 1.15rem;
    border-radius: var(--radius-md, 12px);
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ebeef5);
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    transition: var(--trans, all 0.2s ease);
}

.admin-quick-btn:hover {
    background: var(--bg-elevated, #161a2c);
    border-color: var(--accent, #8b7cf6);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(139, 124, 246, 0.2);
}

/* Health Grid */
.admin-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.6rem;
}

.admin-health-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--trans, all 0.2s ease);
}

.admin-health-card:hover {
    border-color: var(--border-medium, rgba(255, 255, 255, 0.14));
    background: var(--bg-elevated, #161a2c);
}

.admin-health-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.admin-health-title {
    font-size: 0.78rem;
    color: var(--text-muted, #58607a);
    font-weight: 600;
}

.admin-health-val {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
}

.admin-health-indicator {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.76rem;
    font-weight: 800;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-full, 9999px);
    background: rgba(52, 211, 153, 0.12);
    color: var(--green, #34d399);
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.admin-health-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green, #34d399);
    box-shadow: 0 0 6px var(--green, #34d399);
}

/* System Announcement Card */
.admin-broadcast-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14));
    border-radius: var(--radius-xl, 20px);
    padding: 1.6rem;
    margin-bottom: 1.6rem;
}

.admin-broadcast-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-broadcast-card p {
    margin: 0 0 1.2rem;
    font-size: 0.85rem;
    color: var(--text-secondary, #959db5);
}

.admin-template-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.admin-template-chip {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full, 9999px);
    background: var(--bg-elevated, #161a2c);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    color: var(--text-secondary, #959db5);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trans, all 0.2s ease);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.admin-template-chip:hover {
    background: var(--bg-hover, #1d2137);
    border-color: var(--accent, #8b7cf6);
    color: var(--text-primary, #ebeef5);
    transform: translateY(-1px);
}

.admin-broadcast-preview {
    background: var(--bg-base, #0b0e1a);
    border: 1px dashed var(--border-medium, rgba(255, 255, 255, 0.14));
    border-radius: var(--radius-lg, 16px);
    padding: 1rem 1.2rem;
    margin-top: 1rem;
}

.admin-preview-title {
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-light, #b4a4fc);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-preview-banner {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    border-radius: var(--radius-md, 12px);
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary, #ebeef5);
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-preview-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 8px);
    background: var(--accent, #8b7cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

/* Glass Tables */
.admin-table-wrap {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    margin-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th {
    background: var(--bg-elevated, #161a2c);
    padding: 0.9rem 1.1rem;
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--text-muted, #58607a);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    text-align: left;
}

.admin-table td {
    padding: 0.9rem 1.1rem;
    font-size: 0.88rem;
    color: var(--text-primary, #ebeef5);
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.04));
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: var(--trans, all 0.2s ease);
}

.admin-table tbody tr:hover {
    background: var(--bg-hover, #1d2137);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Avatar Cells */
.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-user-info {
    display: flex;
    flex-direction: column;
}

.admin-user-name {
    font-weight: 700;
    color: var(--text-primary, #ebeef5);
    font-size: 0.88rem;
}

.admin-user-sub {
    font-size: 0.74rem;
    color: var(--text-muted, #58607a);
}

/* System Settings Cards */
.admin-settings-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.14));
    border-radius: var(--radius-xl, 20px);
    padding: 1.5rem;
    margin-bottom: 1.6rem;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.1rem;
}

.admin-setting-item {
    background: var(--bg-base, #0b0e1a);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    padding: 1rem 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-setting-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.admin-setting-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary, #ebeef5);
}

.admin-setting-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted, #58607a);
    margin-top: 0.1rem;
}

/* Custom Toggle Switch */
.admin-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.admin-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-elevated, #161a2c);
    border: 1px solid var(--border-light, rgba(255, 255, 255, 0.1));
    transition: 0.25s ease;
    border-radius: 34px;
}

.admin-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted, #58607a);
    transition: 0.25s ease;
    border-radius: 50%;
}

.admin-toggle-switch input:checked + .admin-toggle-slider {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: transparent;
}

.admin-toggle-switch input:checked + .admin-toggle-slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* Config Cards Grid */
.admin-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.admin-config-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--trans, all 0.2s ease);
}

.admin-config-card:hover {
    border-color: var(--border-medium, rgba(255, 255, 255, 0.14));
    background: var(--bg-elevated, #161a2c);
}

.admin-config-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #959db5);
    font-weight: 600;
}

.admin-config-value {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary, #ebeef5);
    background: var(--bg-base, #0b0e1a);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm, 8px);
    font-family: var(--font-mono, monospace);
}

/* Suggestions Cards */
.admin-sug-card {
    background: var(--bg-surface, #101422);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
    border-radius: var(--radius-lg, 16px);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: var(--trans, all 0.2s ease);
}

.admin-sug-card:hover {
    border-color: var(--border-medium, rgba(255, 255, 255, 0.14));
    background: var(--bg-elevated, #161a2c);
}

.sug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.sug-user {
    font-weight: 700;
    color: var(--accent-light, #b4a4fc);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sug-date {
    font-size: 0.74rem;
    color: var(--text-muted, #58607a);
}

.sug-text {
    font-size: 0.88rem;
    color: var(--text-primary, #ebeef5);
    line-height: 1.5;
    background: var(--bg-base, #0b0e1a);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md, 12px);
    border-left: 3px solid var(--accent, #8b7cf6);
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .modal-card-admin {
        flex-direction: column !important;
        height: 94vh;
        max-height: 94vh;
        border-radius: var(--radius-xl) !important;
    }
    .admin-sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        padding: 0.75rem;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }
    .admin-sidebar-header, .admin-sidebar-footer {
        display: none;
    }
    .admin-tabs {
        flex-direction: row;
        overflow-x: auto;
        width: 100%;
    }
    .admin-tab {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
    }
}

/* Dashboard Hero Greeting Banner */
.admin-hero-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(168, 85, 247, 0.12) 50%, rgba(236, 72, 153, 0.08) 100%);
    border: 1px solid rgba(139, 124, 246, 0.3);
    border-radius: 20px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.admin-hero-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2), transparent 70%);
    pointer-events: none;
}

.admin-hero-title h2 {
    margin: 0 0 0.3rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-hero-title p {
    margin: 0;
    font-size: 0.85rem;
    color: #cbd5e1;
    font-weight: 500;
}

.admin-hero-badges {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-hero-pill {
    padding: 0.45rem 0.9rem;
    border-radius: 20px;
    background: rgba(15, 16, 26, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.78rem;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

/* Glass Table Design Overhaul */
.admin-table-wrap {
    background: rgba(12, 13, 22, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(14px);
    margin-bottom: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.admin-table th {
    background: rgba(255, 255, 255, 0.04);
    padding: 1rem 1.15rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.admin-table td {
    padding: 0.95rem 1.15rem;
    font-size: 0.88rem;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.admin-table tbody tr {
    transition: background 0.18s ease;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.045);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Avatar Cells */
.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    font-weight: 800;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.admin-user-info {
    display: flex;
    flex-direction: column;
}

.admin-user-name {
    font-weight: 700;
    color: #fff;
    font-size: 0.88rem;
}

.admin-user-sub {
    font-size: 0.74rem;
    color: #94a3b8;
}

/* Live Broadcast Announcement Preview Box */
.admin-broadcast-preview {
    background: linear-gradient(135deg, rgba(20, 22, 38, 0.9), rgba(15, 16, 26, 0.95));
    border: 1px dashed rgba(139, 124, 246, 0.4);
    border-radius: 16px;
    padding: 1.1rem 1.35rem;
    margin-top: 1.2rem;
}

.admin-preview-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a78bfa;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.admin-preview-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.2));
    border: 1px solid rgba(139, 124, 246, 0.4);
    border-radius: 14px;
    padding: 0.85rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

.admin-preview-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #6366f1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

/* Suggestions Glass Cards */
.admin-sug-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 18px;
    padding: 1.35rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(14px);
    transition: all 0.22s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.admin-sug-card:hover {
    border-color: rgba(139, 124, 246, 0.35);
    transform: translateY(-2px);
}

.sug-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.sug-user {
    font-weight: 700;
    color: #a5b4fc;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sug-date {
    font-size: 0.76rem;
    color: #64748b;
}

.sug-text {
    font-size: 0.9rem;
    color: #f1f5f9;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    border-left: 3px solid #8b5cf6;
    margin-top: 0.5rem;
}

/* Dynamic Managed System Settings */
.admin-settings-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(139, 124, 246, 0.25);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(16px);
    margin-bottom: 1.8rem;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.admin-setting-item {
    background: rgba(12, 13, 22, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-setting-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.admin-setting-label-wrap i {
    font-size: 1.25rem;
}

.admin-setting-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.admin-setting-desc {
    display: block;
    font-size: 0.76rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

/* Custom Toggle Switch */
.admin-toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.admin-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: 0.25s ease;
    border-radius: 34px;
}

.admin-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #94a3b8;
    transition: 0.25s ease;
    border-radius: 50%;
}

.admin-toggle-switch input:checked + .admin-toggle-slider {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.admin-toggle-switch input:checked + .admin-toggle-slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* ==========================================================================
   UNIFIED DROPDOWN & MENU DESIGN SYSTEM (Based on Settings Dropdown)
   ========================================================================== */

/* Native Select Styling to match Settings Custom Select Trigger Button */
select,
.privacy-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: var(--bg-input, #0f1322) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23959db5' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 12px 12px !important;
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
    border-radius: var(--radius-md, 14px) !important;
    color: var(--text-primary, #ffffff) !important;
    font-family: inherit !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    padding: 0.45rem 2.2rem 0.45rem 0.85rem !important;
    cursor: pointer !important;
    transition: all 0.2s var(--ease) !important;
    outline: none !important;
}

select:hover,
.privacy-select:hover {
    border-color: var(--border-light, rgba(255, 255, 255, 0.14)) !important;
    background-color: var(--bg-elevated, #171d30) !important;
}

select:focus,
.privacy-select:focus {
    border-color: var(--accent, #6366f1) !important;
    box-shadow: 0 0 0 3px var(--accent-soft, rgba(99, 102, 241, 0.15)) !important;
}

select option {
    background-color: #101424 !important;
    color: #ffffff !important;
    padding: 0.6rem !important;
}

/* ==========================================================================
   iOS 26 ULTRA GLASSMORPHISM DESIGN ENGINE (Maximum Transparency & Roundings)
   ========================================================================== */

/* Multi-tiered Ultra-Translucent Frosted Glass Containers */
.modern-sidebar,
.sidebar,
.chat-topbar,
.composer,
.chat-info-card,
.auth-card,
.admin-card,
.pinned-banner,
.typing-indicator {
    background: rgba(10, 12, 24, 0.58) !important;
    backdrop-filter: blur(40px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(40px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: var(--radius-xl, 40px) !important;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1.5px 2px rgba(255, 255, 255, 0.3),
        inset 0 -1px 1px rgba(0, 0, 0, 0.1) !important;
}

/* Floating Glass Islands Padding & Margin */
.chat-topbar {
    border-radius: 28px !important;
    margin: 0.5rem 0.75rem 0.25rem 0.75rem !important;
}

.composer {
    border-radius: 36px !important;
    margin: 0.35rem 0.75rem 0.75rem 0.75rem !important;
}

/* Glass Floating Input Capsule */
.input-wrapper,
.search-input-wrapper,
.chat-search-bar {
    background: rgba(8, 12, 24, 0.52) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: var(--radius-full, 9999px) !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.input-wrapper:focus-within,
.search-input-wrapper:focus-within {
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(99, 102, 241, 0.25), 0 0 25px rgba(99, 102, 241, 0.35) !important;
}

/* Glass Chat Cards & Interactive Items */
.chat-item,
.contact-item,
.channel-item,
.search-result-item {
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    border-radius: 20px !important;
}

.chat-item:hover,
.contact-item:hover,
.channel-item:hover,
.search-result-item:hover {
    transform: translateY(-1.5px) scale(1.008) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
}

.chat-item.active,
.contact-item.active,
.channel-item.active {
    background: rgba(99, 102, 241, 0.2) !important;
    border: 1px solid rgba(99, 102, 241, 0.35) !important;
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.25), inset 0 1px 1.5px rgba(255, 255, 255, 0.3) !important;
}

/* Glass Message Bubbles */
.message-bubble {
    backdrop-filter: blur(24px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    border-radius: 26px !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2) !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease !important;
}

.message-wrapper.sent .message-bubble {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.75) 0%, rgba(129, 140, 248, 0.65) 100%) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.message-wrapper:not(.sent) .message-bubble {
    background: rgba(16, 22, 42, 0.5) !important;
}

/* Glass Action Buttons */
.btn-icon,
.btn-primary,
.btn-secondary {
    backdrop-filter: blur(20px) !important;
    border-radius: var(--radius-full, 9999px) !important;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%) !important;
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.4) !important;
}

.btn-primary:hover {
    transform: translateY(-1.5px) scale(1.025) !important;
    box-shadow: 0 10px 32px rgba(99, 102, 241, 0.55), inset 0 1px 1px rgba(255, 255, 255, 0.5) !important;
}

.btn-primary:active {
    transform: scale(0.96) !important;
/* Mobile Dock & Chat Display Rules */
@media (max-width: 768px) {
    .sidebar-dock,
    .modern-sidebar .sidebar-dock {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        pointer-events: none !important;
    }

    html.has-open-chat .modern-sidebar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .main-area {
        background: linear-gradient(180deg, rgba(5, 7, 17, 0.10), rgba(5, 7, 17, 0.26)) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}

/* Guaranteed Desktop PC Sidebar Dock Display Engine */
@media (min-width: 769px) {
    html.has-open-chat .modern-sidebar,
    .modern-sidebar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex-direction: column !important;
        height: calc(100vh - 24px) !important;
        max-height: calc(100vh - 24px) !important;
        margin: 12px 10px 12px 12px !important;
        overflow: hidden !important;
    }
    .modern-sidebar .sidebar-content {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        max-height: calc(100% - 120px) !important;
        overflow-y: auto !important;
    }
    html.has-open-chat .sidebar-dock,
    html.has-open-chat .modern-sidebar .sidebar-dock,
    .modern-sidebar .sidebar-dock {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        flex-shrink: 0 !important;
        margin-top: auto !important;
        padding: 10px 14px 12px !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
        background: rgba(14, 18, 34, 0.4) !important;
        backdrop-filter: blur(16px) !important;
        border-radius: 0 0 12px 12px !important;
        position: relative !important;
        z-index: 10 !important;
    }
    .modern-sidebar .sidebar-dock .dock-profile {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex: 1 !important;
    }
    .modern-sidebar .sidebar-dock .dock-actions {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* ==========================================================================
   iOS 26 SETTINGS — True Liquid Glassmorphism
   ========================================================================== */
/* ═══════════════════════════════════════
   SETTINGS MODAL — iOS 26 Liquid Glass
   ═══════════════════════════════════════ */
.modal-card-settings {
    max-width: 880px !important;
    max-height: 86vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background: rgba(10, 12, 24, 0.68) !important;
    backdrop-filter: blur(56px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(56px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 34px !important;
    box-shadow:
        0 40px 120px rgba(0, 0, 0, 0.65),
        inset 0 1.5px 2px rgba(255, 255, 255, 0.35),
        inset 0 -1px 1.5px rgba(0, 0, 0, 0.15),
        0 0 60px rgba(168, 85, 247, 0.18) !important;
    position: relative !important;
}
.modal-card-settings::after {
    content: "";
    position: absolute !important;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #d946ef);
    border-radius: 34px 34px 0 0;
    pointer-events: none;
}
.modal-card-settings .modal-header {
    padding: 18px 24px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    flex-shrink: 0 !important;
    background: rgba(8, 11, 24, 0.35) !important;
    backdrop-filter: blur(16px) !important;
}
.modal-card-settings .modal-header h3 {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em !important;
    color: #ffffff !important;
}
.modal-card-settings .modal-header h3 i {
    color: #c084fc !important;
    margin-right: 8px !important;
}

/* Settings Scroll */
.settings-content-scroll {
    background: transparent !important;
    padding: 20px 24px !important;
}

/* Settings Card = iOS Grouped Section */
.settings-card,
.pacc-card,
.privacy-item-card {
    background: rgba(10, 12, 24, 0.48) !important;
    backdrop-filter: blur(52px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(52px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 22px !important;
    box-shadow: inset 0 1.5px 2px rgba(255, 255, 255, 0.3), inset 0 -1px 1px rgba(0, 0, 0, 0.2), 0 8px 28px rgba(0, 0, 0, 0.25) !important;
    margin-bottom: 14px !important;
    overflow: hidden !important;
    padding: 0 !important;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.settings-card:hover {
    background: rgba(16, 20, 40, 0.55) !important;
    border-color: rgba(255, 255, 255, 0.22) !important;
    box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(168, 85, 247, 0.1) !important;
}

/* Card Section = content wrapper inside card */
.settings-card-section {
    padding: 0 !important;
}

/* Settings Inputs & Form Controls */
.settings-card input[type="text"],
.settings-card input[type="password"],
.settings-card input[type="email"],
.settings-card textarea,
.settings-card select {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 14px !important;
    color: #ffffff !important;
    padding: 0.65rem 0.9rem !important;
    font-size: 0.85rem !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.settings-card input:focus,
.settings-card textarea:focus,
.settings-card select:focus {
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 0 0 3.5px rgba(168, 85, 247, 0.2) !important;
}

/* Settings Action Buttons */
.settings-save-btn,
.settings-card .btn-primary {
    border-radius: 16px !important;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #d946ef 100%) !important;
    box-shadow: 0 8px 24px rgba(168, 85, 247, 0.45) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease !important;
}

.settings-save-btn:hover,
.settings-card .btn-primary:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 12px 32px rgba(168, 85, 247, 0.6) !important;
    opacity: 0.95 !important;
}

/* Page header */
.settings-page-header {
    margin-bottom: 16px !important;
    padding: 0 4px !important;
}
.settings-page-header h2 {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    letter-spacing: -0.02em !important;
    color: #ffffff !important;
    margin-bottom: 2px !important;
}
.settings-page-header p {
    font-size: 0.75rem !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Section header row (inside card) */
.settings-section-header {
    display: flex !important;
    align-items: flex-start !important;
    gap: 12px !important;
    padding: 14px 16px 10px !important;
    margin: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: transparent !important;
}
.settings-section-header i {
    background: rgba(168, 85, 247, 0.15) !important;
    border: 1px solid rgba(168, 85, 247, 0.28) !important;
    border-radius: 10px !important;
    color: #c084fc !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    font-size: 0.8rem !important;
}
.settings-section-header div {
    flex: 1 !important;
    min-width: 0 !important;
}
.settings-section-header span {
    font-size: 0.88rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    display: block !important;
}
.settings-section-header small {
    font-size: 0.72rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    display: block !important;
    margin-top: 2px !important;
}

/* Grouped Table Rows — all row types share the same layout */
.settings-toggle-row,
.settings-info-row,
.privacy-item,
.settings-slider-row,
.settings-avatar-section {
    padding: 12px 16px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
    transition: background 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
}

/* Last row in a section: no border */
.settings-card-section > :last-child,
.settings-card > :last-child {
    border-bottom: none !important;
}

/* Hover — no janky padding/margin changes */
.settings-toggle-row:hover,
.settings-info-row:hover,
.privacy-item:hover,
.settings-slider-row:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 0 !important;
    padding: 12px 16px !important;
    margin: 0 !important;
}

/* Toggle row specific */
.settings-toggle-row {
    cursor: pointer !important;
}
.settings-toggle-info {
    flex: 1 !important;
    min-width: 0 !important;
}
.settings-toggle-info span {
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    display: block !important;
}
.settings-toggle-info small {
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
    display: block !important;
    margin-top: 2px !important;
}

/* Info row specific */
.settings-info-row span:first-child {
    font-size: 0.84rem !important;
    color: var(--text-primary) !important;
    font-weight: 500 !important;
}
.settings-info-value {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    font-family: "SF Mono", Consolas, monospace !important;
    flex-shrink: 0 !important;
}

/* Privacy item row */
.privacy-item {
    cursor: default !important;
}
.privacy-item-info {
    flex: 1 !important;
    min-width: 0 !important;
}
.privacy-item-info span {
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    display: block !important;
}
.privacy-item-info small {
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
    display: block !important;
    margin-top: 2px !important;
}

/* Slider row */
.settings-slider-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}
.settings-slider-label {
    font-size: 0.72rem !important;
    color: var(--text-muted) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    font-weight: 500 !important;
}
.settings-slider-value {
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    min-width: 32px !important;
    text-align: right !important;
    flex-shrink: 0 !important;
}

/* Card divider = spacing between groups inside a card */
.settings-card-divider {
    height: 8px !important;
    background: transparent !important;
    margin: 0 !important;
    border: none !important;
}



#cover-style-picker > div,
#cover-pattern-picker > div {
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    transition: all 0.15s ease !important;
}
#cover-style-picker > div:hover,
#cover-pattern-picker > div:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ──────────────────────────────────────────────────────────────
   iOS 26 dropdown / context menu — final polish layer
   ────────────────────────────────────────────────────────────── */

/* Dropdown container */
.chat-dropdown,
.dropdown-menu,
.custom-privacy-menu,
.custom-select-menu,
.settings-dropdown-menu {
    background: linear-gradient(145deg, rgba(24, 28, 48, 0.78), rgba(9, 11, 22, 0.68)) !important;
    backdrop-filter: blur(58px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(58px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 20px !important;
    box-shadow:
        0 22px 64px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04) !important;
    padding: 8px !important;
    z-index: 10000 !important;
    transform-origin: top right;
    will-change: opacity, transform;
}

/* Pointer arrow (top-right triangle connecting to trigger button) */
.chat-dropdown::before {
    content: "";
    position: absolute;
    top: -5.5px;
    right: 16px;
    width: 11px;
    height: 11px;
    background: inherit;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-right-color: transparent;
    border-bottom-color: transparent;
    transform: rotate(45deg);
    z-index: -1;
    border-radius: 2px 0 0 0;
}

/* Open state + animation */
.chat-dropdown.open {
    display: flex;
    animation: ios26DropdownOpen 0.26s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

.context-menu,
.message-context-menu {
    animation: ios26ContextOpen 0.24s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

@keyframes ios26DropdownOpen {
    from { opacity: 0; transform: translateY(-8px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ios26ContextOpen {
    from { opacity: 0; transform: translateY(6px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Dropdown items base */
.chat-dropdown-item,
.context-menu-item,
.message-context-menu-item,
.dropdown-item,
.custom-privacy-option,
.custom-select-option,
.settings-dropdown-item {
    border-radius: 14px !important;
    transition:
        color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.22s ease,
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Icon containers (iOS 26 style rounded squares) */
.chat-dropdown-item i,
.context-menu-item i,
.message-context-menu-item i,
.dropdown-item i,
.custom-privacy-option i,
.custom-select-option i,
.settings-dropdown-item i {
    width: 30px !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.045) !important;
    flex-shrink: 0 !important;
    font-size: 0.82rem !important;
    color: rgba(255, 255, 255, 0.5) !important;
    transition:
        color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease !important;
}

/* Hover: item background, icon container highlight */
.chat-dropdown-item:hover,
.context-menu-item:hover,
.message-context-menu-item:hover,
.dropdown-item:hover,
.custom-privacy-option:hover,
.custom-select-option:hover,
.settings-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.075) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
    transform: translateX(3px) !important;
}

.chat-dropdown-item:hover i,
.context-menu-item:hover i,
.message-context-menu-item:hover i,
.dropdown-item:hover i,
.custom-privacy-option:hover i,
.custom-select-option:hover i,
.settings-dropdown-item:hover i {
    color: #c084fc !important;
    background: rgba(192, 132, 252, 0.12) !important;
    transform: scale(1.08) !important;
}

/* Active / Press State */
.chat-dropdown-item:active,
.context-menu-item:active,
.message-context-menu-item:active,
.dropdown-item:active,
.custom-privacy-option:active,
.custom-select-option:active {
    background: rgba(99, 102, 241, 0.15) !important;
    transform: scale(0.97) !important;
}

.chat-dropdown-item:active i,
.context-menu-item:active i,
.message-context-menu-item:active i,
.dropdown-item:active i,
.custom-privacy-option:active i,
.custom-select-option:active i {
    transform: scale(0.95) !important;
}

/* Selected State */
.chat-dropdown-item.selected,
.context-menu-item.selected,
.dropdown-item.selected,
.custom-privacy-option.selected,
.custom-select-option.selected {
    color: #c4b5fd !important;
    font-weight: 600 !important;
    background: rgba(99, 102, 241, 0.15) !important;
}

.chat-dropdown-item.selected i,
.context-menu-item.selected i,
.dropdown-item.selected i,
.custom-privacy-option.selected i,
.custom-select-option.selected i {
    color: #a78bfa !important;
    background: rgba(167, 139, 250, 0.15) !important;
}

/* Danger Action Item */
.chat-dropdown-item.danger,
.context-menu-item.danger,
.dropdown-item.danger,
.custom-privacy-option.danger,
.custom-select-option.danger {
    color: #f87171 !important;
}

.chat-dropdown-item.danger i,
.context-menu-item.danger i,
.dropdown-item.danger i,
.custom-privacy-option.danger i,
.custom-select-option.danger i {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.1) !important;
}

.chat-dropdown-item.danger:hover,
.context-menu-item.danger:hover,
.dropdown-item.danger:hover,
.custom-privacy-option.danger:hover,
.custom-select-option.danger:hover {
    background: rgba(248, 113, 113, 0.12) !important;
    color: #fca5a5 !important;
}

.chat-dropdown-item.danger:hover i,
.context-menu-item.danger:hover i,
.dropdown-item.danger:hover i,
.custom-privacy-option.danger:hover i,
.custom-select-option.danger:hover i {
    color: #fca5a5 !important;
    background: rgba(248, 113, 113, 0.18) !important;
}

/* Dividers */
.chat-dropdown-divider,
.context-menu-divider,
.dropdown-divider,
.custom-privacy-divider {
    height: 1px !important;
    border: none !important;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.06) 15%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.06) 85%,
        transparent
    ) !important;
    margin: 5px 10px !important;
}

/* ── Light theme override ── */

[data-theme="light"] .chat-dropdown,
[data-theme="light"] .context-menu,
[data-theme="light"] .message-context-menu,
[data-theme="light"] .dropdown-menu,
[data-theme="light"] .custom-privacy-menu,
[data-theme="light"] .custom-select-menu,
[data-theme="light"] .settings-dropdown-menu {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(241, 245, 255, 0.78)) !important;
    border-color: rgba(255, 255, 255, 0.92) !important;
    box-shadow:
        0 20px 54px rgba(30, 41, 59, 0.10),
        0 0 0 1px rgba(255, 255, 255, 0.96),
        inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

[data-theme="light"] .chat-dropdown::before {
    background: inherit;
    border-color: rgba(255, 255, 255, 0.92);
    border-right-color: transparent;
    border-bottom-color: transparent;
}

[data-theme="light"] .chat-dropdown-item i,
[data-theme="light"] .context-menu-item i,
[data-theme="light"] .message-context-menu-item i,
[data-theme="light"] .dropdown-item i,
[data-theme="light"] .custom-privacy-option i,
[data-theme="light"] .custom-select-option i,
[data-theme="light"] .settings-dropdown-item i {
    background: rgba(0, 0, 0, 0.03) !important;
    color: rgba(0, 0, 0, 0.35) !important;
}

[data-theme="light"] .chat-dropdown-item:hover,
[data-theme="light"] .context-menu-item:hover,
[data-theme="light"] .message-context-menu-item:hover,
[data-theme="light"] .dropdown-item:hover,
[data-theme="light"] .custom-privacy-option:hover,
[data-theme="light"] .custom-select-option:hover,
[data-theme="light"] .settings-dropdown-item:hover {
    background: rgba(0, 0, 0, 0.04) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .chat-dropdown-item:hover i,
[data-theme="light"] .context-menu-item:hover i,
[data-theme="light"] .message-context-menu-item:hover i,
[data-theme="light"] .dropdown-item:hover i,
[data-theme="light"] .custom-privacy-option:hover i,
[data-theme="light"] .custom-select-option:hover i,
[data-theme="light"] .settings-dropdown-item:hover i {
    color: #7c6ae0 !important;
    background: rgba(124, 106, 224, 0.1) !important;
}

[data-theme="light"] .chat-dropdown-item.danger,
[data-theme="light"] .context-menu-item.danger,
[data-theme="light"] .dropdown-item.danger,
[data-theme="light"] .custom-privacy-option.danger,
[data-theme="light"] .custom-select-option.danger {
    color: #d32f2f !important;
}

[data-theme="light"] .chat-dropdown-item.danger i,
[data-theme="light"] .context-menu-item.danger i,
[data-theme="light"] .dropdown-item.danger i,
[data-theme="light"] .custom-privacy-option.danger i,
[data-theme="light"] .custom-select-option.danger i {
    color: #d32f2f !important;
    background: rgba(211, 47, 47, 0.06) !important;
}

[data-theme="light"] .chat-dropdown-item.danger:hover,
[data-theme="light"] .context-menu-item.danger:hover,
[data-theme="light"] .dropdown-item.danger:hover,
[data-theme="light"] .custom-privacy-option.danger:hover,
[data-theme="light"] .custom-select-option.danger:hover {
    background: rgba(211, 47, 47, 0.06) !important;
    color: #b71c1c !important;
}

[data-theme="light"] .chat-dropdown-item.danger:hover i,
[data-theme="light"] .context-menu-item.danger:hover i,
[data-theme="light"] .dropdown-item.danger:hover i,
[data-theme="light"] .custom-privacy-option.danger:hover i,
[data-theme="light"] .custom-select-option.danger:hover i {
    color: #b71c1c !important;
    background: rgba(211, 47, 47, 0.1) !important;
}

[data-theme="light"] .chat-dropdown-divider,
[data-theme="light"] .context-menu-divider,
[data-theme="light"] .dropdown-divider,
[data-theme="light"] .custom-privacy-divider {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.06) 15%,
        rgba(0, 0, 0, 0.08) 50%,
        rgba(0, 0, 0, 0.06) 85%,
        transparent
    ) !important;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .chat-dropdown {
        min-width: 260px !important;
        max-width: calc(100vw - 32px) !important;
    }
    .chat-dropdown-item {
        padding: 14px 14px !important;
    }
}

@media (max-width: 480px) {
    .chat-dropdown {
        position: fixed;
        top: auto;
        bottom: 12px;
        left: 12px !important;
        right: 12px !important;
        min-width: unset !important;
        width: auto !important;
        border-radius: 24px !important;
        transform-origin: bottom center;
        box-shadow:
            0 -4px 40px rgba(0, 0, 0, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.15) !important;
    }
    .chat-dropdown::before {
        display: none;
    }
    @keyframes ios26DropdownOpen {
        from { opacity: 0; transform: translateY(30px) scale(0.92); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }
}

/* Chat rows stay clear: hover uses elevation and a hairline only. */
.chat-item {
    border: 1px solid transparent !important;
    transition:
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.18s ease,
        box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.chat-item:hover {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07) !important;
    transform: translateY(-1px) scale(1.006) !important;
    transition:
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.18s ease,
        box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.15s ease,
        backdrop-filter 0.15s ease !important;
}

.chat-item.active,
.chat-item.active:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.12)) !important;
    border-color: rgba(129, 140, 248, 0.3) !important;
    box-shadow:
        0 8px 24px rgba(99, 102, 241, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.13) !important;
}

[data-theme="light"] .chat-item:hover {
    border-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .chat-item.active,
[data-theme="light"] .chat-item.active:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.08)) !important;
    border-color: rgba(99, 102, 241, 0.22) !important;
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.12) !important;
}

/* ==========================================================================
   PROFILE / GROUP PROFILE — iOS 26 LIQUID GLASS
   ========================================================================== */
.up-overlay {
    padding: 28px;
    background:
        radial-gradient(circle at 18% 16%, rgba(99, 102, 241, 0.16), transparent 34%),
        radial-gradient(circle at 84% 82%, rgba(168, 85, 247, 0.12), transparent 32%),
        rgba(2, 4, 12, 0.72);
    backdrop-filter: blur(18px) saturate(135%);
    -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.up-modal {
    width: min(1080px, calc(100vw - 56px)) !important;
    max-width: 1080px !important;
    height: min(780px, calc(100dvh - 56px));
    max-height: 780px !important;
    padding: 0 !important;
    position: relative;
    overflow: hidden !important;
    border-radius: 36px !important;
    border: 1px solid rgba(255, 255, 255, 0.17) !important;
    background: rgba(8, 11, 23, 0.72) !important;
    backdrop-filter: blur(60px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(60px) saturate(190%) !important;
    box-shadow:
        0 44px 140px rgba(0, 0, 0, 0.7),
        0 0 80px rgba(99, 102, 241, 0.15),
        inset 0 1.5px 1px rgba(255, 255, 255, 0.28),
        inset 0 -1px 1px rgba(0, 0, 0, 0.28) !important;
}

.up-modal::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 24%),
        radial-gradient(circle at 70% 0%, rgba(129, 140, 248, 0.09), transparent 32%);
}

.up-close {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 15 !important;
    width: 42px;
    height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(10, 13, 26, 0.42);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        inset 0 1px 1px rgba(255, 255, 255, 0.22);
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), background 0.2s, border-color 0.2s;
}

.up-close:hover {
    transform: scale(1.07);
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(255, 255, 255, 0.32);
}

.up-close:active {
    transform: scale(0.92);
}

.up-scroll {
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.up-layout {
    display: grid;
    grid-template-columns: minmax(320px, 38%) minmax(0, 1fr);
    width: 100%;
    height: 100%;
    min-height: 0;
}

.up-identity-panel {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(6, 9, 20, 0.34);
}

.up-cover {
    position: absolute;
    inset: 0 0 auto;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(145deg, #7c3aed 0%, #6366f1 42%, #312e81 100%);
    transition: background 0.35s ease;
}

.up-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, transparent 24%, rgba(6, 9, 20, 0.2) 62%, rgba(6, 9, 20, 0.97) 100%),
        radial-gradient(circle at 50% -25%, rgba(255, 255, 255, 0.32), transparent 54%);
}

.up-cover-aurora {
    position: absolute;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    filter: blur(46px);
    opacity: 0.55;
    animation: upAuroraFloat 9s ease-in-out infinite alternate;
}

.up-cover-aurora.aurora-1 {
    top: -130px;
    left: -40px;
    background: rgba(255, 255, 255, 0.42);
}

.up-cover-aurora.aurora-2 {
    right: -100px;
    bottom: -150px;
    background: rgba(217, 70, 239, 0.55);
    animation-delay: -4s;
}

.up-cover-particles {
    position: absolute;
    inset: 0;
    opacity: 0.34;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,.85) 0 1px, transparent 1.5px),
        radial-gradient(circle at 72% 22%, rgba(255,255,255,.7) 0 1px, transparent 1.5px),
        radial-gradient(circle at 56% 68%, rgba(255,255,255,.55) 0 1px, transparent 1.5px);
    background-size: 78px 78px, 112px 112px, 94px 94px;
}

@keyframes upAuroraFloat {
    to { transform: translate3d(24px, 18px, 0) scale(1.1); }
}

.up-identity-content {
    position: relative;
    z-index: 2;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 134px 22px 24px;
}

.up-avatar-wrap {
    position: relative;
    width: 126px;
    height: 126px;
    margin: 0 auto 16px;
}

.up-avatar-ring {
    position: absolute;
    inset: -5px;
    border-radius: 38px;
    background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(165,180,252,.45) 38%, rgba(168,85,247,.7));
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 34px rgba(99, 102, 241, 0.28);
}

.up-avatar {
    position: absolute;
    inset: 1px;
    display: grid;
    place-items: center;
    border: 5px solid rgba(8, 11, 23, 0.9);
    border-radius: 34px;
    background: linear-gradient(145deg, #818cf8, #7c3aed 56%, #4f46e5);
    background-size: cover;
    background-position: center;
    color: #fff;
    font-size: 2.7rem;
    font-weight: 800;
    letter-spacing: -0.06em;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.28);
}

.up-online {
    position: absolute;
    right: -1px;
    bottom: 7px;
    width: 25px;
    height: 25px;
    border: 5px solid #090c19;
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 5px 16px rgba(0,0,0,.35);
}

.up-online.online {
    background: #34d399;
    box-shadow: 0 0 0 5px rgba(52,211,153,.12), 0 5px 16px rgba(0,0,0,.35);
}

.up-info {
    width: 100%;
    margin-bottom: 20px;
    text-align: center;
}

.up-profile-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 7px;
    padding: 5px 9px;
    border: 1px solid rgba(165,180,252,.18);
    border-radius: 999px;
    color: #c7d2fe;
    background: rgba(99,102,241,.11);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.up-name {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    color: var(--text-primary);
    font-size: clamp(1.45rem, 2.5vw, 2rem);
    font-weight: 780;
    line-height: 1.08;
    letter-spacing: -.045em;
    overflow-wrap: anywhere;
}

.up-name-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #c7d2fe;
    background: rgba(99,102,241,.14);
    border: 1px solid rgba(129,140,248,.18);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 0;
}

.up-status-text {
    min-height: 20px;
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: .84rem;
    font-weight: 550;
}

.up-status-text.online { color: #5ee0a4; }
.up-status-text.offline { color: var(--text-muted); }

.up-actions {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 9px;
    margin-bottom: 14px;
}

.up-action-btn {
    min-width: 0;
    min-height: 72px;
    padding: 10px 7px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 20px;
    color: var(--text-primary);
    background: rgba(255,255,255,.055);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.12), 0 8px 24px rgba(0,0,0,.13);
    font: inherit;
    font-size: .7rem;
    font-weight: 650;
    cursor: pointer;
    transition: transform .2s cubic-bezier(.16,1,.3,1), border-color .2s, background .2s;
}

.up-action-btn i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 11px;
    color: #c7d2fe;
    background: rgba(129,140,248,.13);
    font-size: .88rem;
}

.up-action-btn.primary {
    color: #fff;
    border-color: rgba(165,180,252,.32);
    background: linear-gradient(145deg, rgba(99,102,241,.88), rgba(124,58,237,.78));
    box-shadow: inset 0 1px 1px rgba(255,255,255,.3), 0 12px 28px rgba(79,70,229,.25);
}

.up-action-btn.primary i { color: #fff; background: rgba(255,255,255,.16); }
.up-action-btn.danger i { color: #fca5a5; background: rgba(239,68,68,.1); }
.up-action-btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.22); background-color: rgba(255,255,255,.09); }
.up-action-btn:active { transform: scale(.96); }

.up-card {
    width: 100%;
    margin: 0 0 12px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 22px;
    background: rgba(255,255,255,.045);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.1), 0 12px 32px rgba(0,0,0,.12);
}

.up-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 9px;
    color: var(--text-muted);
    font-size: .67rem;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.up-card-title i { color: #a5b4fc; }

.up-detail-row {
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: 11px;
    padding: 11px 10px;
    border-radius: 15px;
}

.up-detail-row + .up-detail-row { border-top: 1px solid rgba(255,255,255,.07); }

.up-detail-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #c7d2fe;
    background: linear-gradient(145deg, rgba(129,140,248,.2), rgba(139,92,246,.1));
    box-shadow: inset 0 1px 1px rgba(255,255,255,.1);
    font-size: .78rem;
}

.up-detail-content { flex: 1; min-width: 0; }
.up-detail-label { margin-bottom: 2px; color: var(--text-muted); font-size: .66rem; font-weight: 620; }
.up-detail-value { color: var(--text-primary); font-size: .82rem; line-height: 1.38; overflow-wrap: anywhere; }

.up-copy-btn {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 11px;
    color: var(--text-muted);
    background: rgba(255,255,255,.06);
    cursor: pointer;
    transition: color .2s, background .2s, transform .2s;
}

.up-copy-btn:hover { color: #c7d2fe; background: rgba(129,140,248,.15); transform: scale(1.05); }

.up-social { display: none; }
.up-social a {
    width: 100%;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 15px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: .8rem;
    transition: background .2s, transform .2s;
}
.up-social a + a { border-top: 1px solid rgba(255,255,255,.07); }
.up-social a > i:first-child { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 12px; color: #c7d2fe; background: rgba(129,140,248,.14); }
.up-social a:hover { background: rgba(255,255,255,.06); transform: translateX(2px); }
.up-social-arrow { color: var(--text-muted); font-size: .68rem; }

.up-explorer {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 30px 30px 24px;
    background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 32%);
}

.up-explorer-header {
    min-height: 68px;
    padding-right: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.up-section-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: #a5b4fc;
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.up-explorer-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 750;
    letter-spacing: -.035em;
}

.up-private-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid rgba(52,211,153,.16);
    border-radius: 999px;
    color: #6ee7b7;
    background: rgba(16,185,129,.08);
    font-size: .67rem;
    font-weight: 650;
    white-space: nowrap;
}

.up-tabs-wrap {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.up-tabs {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
    margin: 10px 0 18px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(255,255,255,.045);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.08);
}

.up-tab {
    min-width: 0;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border: 0;
    border-radius: 14px;
    color: var(--text-muted);
    background: transparent;
    font: inherit;
    font-size: .78rem;
    font-weight: 670;
    cursor: pointer;
    transition: color .2s, background .2s, box-shadow .2s, transform .2s;
}

.up-tab.active {
    color: #fff;
    background: linear-gradient(145deg, rgba(99,102,241,.9), rgba(124,58,237,.75));
    box-shadow: inset 0 1px 1px rgba(255,255,255,.26), 0 7px 18px rgba(79,70,229,.22);
}

.up-tab:active { transform: scale(.97); }

.up-tab-count {
    min-width: 21px;
    height: 21px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border-radius: 999px;
    color: inherit;
    background: rgba(255,255,255,.1);
    font-size: .64rem;
}

.up-tab.active .up-tab-count { background: rgba(255,255,255,.18); }

.up-tab-pane {
    display: none;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.up-tab-pane.active { display: block; animation: upPaneIn .25s cubic-bezier(.16,1,.3,1); }

@keyframes upPaneIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: none; }
}

.up-media-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
}

.up-media-grid > .media-thumb,
.up-media-grid > .media-thumb-video {
    width: 100%;
    aspect-ratio: 1;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(255,255,255,.05);
    box-shadow: 0 10px 30px rgba(0,0,0,.16), inset 0 1px 1px rgba(255,255,255,.1);
    cursor: pointer;
    object-fit: cover;
    transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .2s, box-shadow .2s;
}

.up-media-grid > .media-thumb:hover,
.up-media-grid > .media-thumb-video:hover {
    transform: translateY(-3px) scale(1.015);
    border-color: rgba(165,180,252,.3);
    box-shadow: 0 16px 38px rgba(0,0,0,.25), 0 0 22px rgba(99,102,241,.12);
}

.up-media-grid .media-thumb-video { position: relative; }
.up-media-grid .media-thumb-video .media-thumb { width: 100%; height: 100%; border: 0; border-radius: 0; object-fit: cover; }

.up-media-empty {
    grid-column: 1 / -1;
    min-height: 310px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 32px;
    border: 1px dashed rgba(165,180,252,.16);
    border-radius: 24px;
    color: var(--text-muted);
    background: radial-gradient(circle at 50% 35%, rgba(99,102,241,.1), transparent 45%), rgba(255,255,255,.025);
    text-align: center;
}

.up-media-empty i { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 22px; color: #a5b4fc; background: rgba(99,102,241,.12); font-size: 1.4rem; }
.up-media-empty span { color: var(--text-primary); font-size: .94rem; font-weight: 700; }
.up-media-empty small { max-width: 260px; font-size: .74rem; line-height: 1.45; }

.up-members-add {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 8px 8px 13px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 18px;
    background: rgba(255,255,255,.045);
}

.up-members-add > i { color: #a5b4fc; font-size: .8rem; }
.up-members-add input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--text-primary); background: transparent; font: inherit; font-size: .8rem; }
.up-members-add input::placeholder { color: var(--text-muted); }

.up-member-add-btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid rgba(165,180,252,.25);
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #6366f1, #7c3aed);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.22);
    font: inherit;
    font-size: .7rem;
    font-weight: 680;
    cursor: pointer;
}

.up-members-list { width: 100%; display: flex; flex-direction: column; gap: 7px; }
.up-member-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 11px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 17px;
    background: rgba(255,255,255,.035);
    cursor: pointer;
    transition: transform .2s, border-color .2s, background .2s;
}
.up-member-row:hover { transform: translateY(-1px); border-color: rgba(165,180,252,.2); background: rgba(255,255,255,.06); }
.up-member-avatar { flex: 0 0 43px; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(145deg,#818cf8,#7c3aed); background-size: cover; background-position: center; font-weight: 750; }
.up-member-info { flex: 1; min-width: 0; }
.up-member-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-primary); font-size: .82rem; font-weight: 650; }
.up-member-role { padding: 3px 7px; border-radius: 999px; color: #c7d2fe; background: rgba(99,102,241,.12); font-size: .58rem; }
.up-member-role.creator { color: #fde68a; background: rgba(245,158,11,.1); }
.up-member-actions button { width: 34px; height: 34px; padding: 0; border-radius: 11px; }

.up-modal.is-loading .up-info,
.up-modal.is-loading .up-card {
    opacity: .62;
}

[data-theme="light"] .up-overlay {
    background: rgba(226, 232, 240, .68);
}
[data-theme="light"] .up-modal {
    background: rgba(246, 248, 255, .78) !important;
    border-color: rgba(255,255,255,.86) !important;
    box-shadow: 0 36px 110px rgba(51,65,85,.25), inset 0 1px 1px rgba(255,255,255,.95) !important;
}
[data-theme="light"] .up-identity-panel { background: rgba(255,255,255,.22); border-right-color: rgba(15,23,42,.08); }
[data-theme="light"] .up-cover::after { background: linear-gradient(180deg, transparent 28%, rgba(246,248,255,.18) 62%, rgba(246,248,255,.97) 100%); }
[data-theme="light"] .up-avatar { border-color: rgba(246,248,255,.95); }
[data-theme="light"] .up-online { border-color: #f6f8ff; }
[data-theme="light"] .up-card,
[data-theme="light"] .up-actions .up-action-btn:not(.primary),
[data-theme="light"] .up-tabs,
[data-theme="light"] .up-members-add,
[data-theme="light"] .up-member-row { background: rgba(255,255,255,.55); border-color: rgba(15,23,42,.08); box-shadow: inset 0 1px 1px rgba(255,255,255,.9), 0 8px 24px rgba(51,65,85,.06); }
[data-theme="light"] .up-detail-row + .up-detail-row,
[data-theme="light"] .up-social a + a { border-top-color: rgba(15,23,42,.07); }
[data-theme="light"] .up-close { color: #172033; background: rgba(255,255,255,.55); border-color: rgba(255,255,255,.85); }

@media (max-width: 768px) {
    .up-overlay {
        align-items: flex-end;
        padding: 0;
        background: rgba(2,4,12,.58);
    }

    .up-modal {
        width: 100% !important;
        max-width: none !important;
        height: calc(100dvh - 8px);
        max-height: calc(100dvh - 8px) !important;
        border-width: 1px 0 0 !important;
        border-radius: 30px 30px 0 0 !important;
        transform: translateY(42px) scale(.985) !important;
    }

    .up-overlay.active .up-modal { transform: translateY(0) scale(1) !important; }

    .up-close {
        position: fixed;
        top: calc(20px + env(safe-area-inset-top));
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .up-scroll {
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .up-layout {
        display: block;
        height: auto;
        min-height: 100%;
    }

    .up-identity-panel {
        width: 100%;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }

    .up-cover { height: 224px; }

    .up-identity-content {
        height: auto;
        overflow: visible;
        padding: calc(119px + env(safe-area-inset-top)) 14px 18px;
    }

    .up-avatar-wrap {
        width: 116px;
        height: 116px;
        margin-bottom: 14px;
    }

    .up-avatar-ring { border-radius: 36px; }
    .up-avatar { border-radius: 32px; font-size: 2.45rem; }
    .up-name { font-size: 1.65rem; }
    .up-info { margin-bottom: 17px; }
    .up-actions { gap: 8px; margin-bottom: 12px; }
    .up-action-btn { min-height: 68px; border-radius: 19px; }
    .up-card { border-radius: 21px; }

    .up-explorer {
        width: 100%;
        min-height: 420px;
        padding: 22px 14px calc(28px + env(safe-area-inset-bottom));
        overflow: visible;
    }

    .up-explorer-header {
        min-height: 52px;
        padding: 0 2px;
        align-items: flex-start;
    }

    .up-explorer-header h3 { font-size: 1.16rem; }
    .up-private-pill { padding: 6px 8px; font-size: .6rem; }
    .up-tabs { position: sticky; top: 8px; z-index: 8; margin: 14px 0; backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); background: rgba(13,16,30,.72); }
    .up-tab-pane { overflow: visible; }
    .up-media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .up-media-grid > .media-thumb,
    .up-media-grid > .media-thumb-video { border-radius: 14px; }
    .up-media-empty { min-height: 250px; border-radius: 21px; }
    .up-member-add-btn span { display: none; }
    .up-member-add-btn { width: 38px; justify-content: center; padding: 8px; }
}

@media (max-width: 390px) {
    .up-identity-content { padding-left: 10px; padding-right: 10px; }
    .up-explorer { padding-left: 10px; padding-right: 10px; }
    .up-action-btn { font-size: .64rem; }
    .up-private-pill span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .up-cover-aurora,
    .up-tab-pane.active { animation: none !important; }
}

/* ==========================================================================
   OWN PROFILE SETTINGS — iOS 26 PROFILE STUDIO
   ========================================================================== */
@supports selector(:--xssm-own-profile-redesign-disabled) {
.modal-card-settings {
    width: min(1180px, calc(100vw - 48px)) !important;
    max-width: 1180px !important;
    height: min(860px, calc(100dvh - 48px)) !important;
    max-height: 860px !important;
}

.settings-content-scroll {
    min-width: 0;
    width: 100%;
}

#stab-profile {
    width: 100%;
    max-width: none !important;
}

#stab-profile.active {
    display: block;
}

.profile-settings-header {
    width: 100%;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 0 18px !important;
    padding: 20px 22px !important;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 24px;
    background:
        radial-gradient(circle at 12% 0%, rgba(129,140,248,.19), transparent 38%),
        radial-gradient(circle at 90% 130%, rgba(217,70,239,.14), transparent 40%),
        rgba(255,255,255,.04);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.13), 0 14px 36px rgba(0,0,0,.13);
}

.profile-settings-header::after {
    content: "";
    position: absolute;
    width: 190px;
    height: 190px;
    top: -120px;
    right: 12%;
    border-radius: 50%;
    background: rgba(99,102,241,.16);
    filter: blur(46px);
    pointer-events: none;
}

.profile-settings-header > div {
    min-width: 0;
    position: relative;
    z-index: 1;
}

.profile-settings-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: #a5b4fc;
    font-size: .64rem;
    font-weight: 780;
    letter-spacing: .09em;
    text-transform: uppercase;
}

#stab-profile .profile-settings-header h2 {
    margin: 0 0 3px !important;
    color: var(--text-primary) !important;
    font-size: clamp(1.45rem, 2vw, 1.8rem) !important;
    font-weight: 790 !important;
    letter-spacing: -.045em !important;
}

#stab-profile .profile-settings-header p {
    margin: 0;
    color: var(--text-muted) !important;
    font-size: .78rem !important;
}

.profile-settings-secure {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    position: relative;
    z-index: 1;
    padding: 8px 11px;
    border: 1px solid rgba(52,211,153,.19);
    border-radius: 999px;
    color: #6ee7b7;
    background: rgba(16,185,129,.085);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.08);
    font-size: .68rem;
    font-weight: 680;
}

.profile-settings-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
}

#stab-profile .settings-card,
#stab-profile .sacc-card {
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    border-radius: 24px !important;
    border: 1px solid rgba(255,255,255,.13) !important;
    background: rgba(8,11,24,.42) !important;
    backdrop-filter: blur(46px) saturate(185%) !important;
    -webkit-backdrop-filter: blur(46px) saturate(185%) !important;
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,.14),
        inset 0 -1px 1px rgba(0,0,0,.18),
        0 14px 38px rgba(0,0,0,.14) !important;
}

#stab-profile .profile-identity-card,
#stab-profile .profile-social-card,
#stab-profile #settings-accs-card {
    grid-column: 1 / -1;
}

#stab-profile .profile-identity-card {
    overflow: hidden !important;
}

#stab-profile .profile-cover-preview {
    width: 100% !important;
    height: 178px !important;
    padding: 22px 26px !important;
    align-items: flex-end !important;
    border-radius: 23px 23px 0 0 !important;
    isolation: isolate;
}

#stab-profile .profile-cover-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.08), transparent 42%, rgba(3,5,14,.48)),
        radial-gradient(circle at 80% 10%, rgba(255,255,255,.22), transparent 34%);
    pointer-events: none;
}

#stab-profile #cover-preview-avatar {
    width: 72px !important;
    height: 72px !important;
    border: 3px solid rgba(255,255,255,.55);
    border-radius: 23px !important;
    font-size: 1.8rem !important;
    box-shadow: 0 15px 35px rgba(0,0,0,.3), inset 0 1px 1px rgba(255,255,255,.3) !important;
}

#stab-profile #cover-preview-name {
    font-size: 1.05rem !important;
    font-weight: 760 !important;
    letter-spacing: -.025em;
}

#stab-profile .prof-av-section {
    position: relative;
    min-height: 72px;
    padding: 0 24px 18px !important;
}

#stab-profile .prof-av-row {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

#stab-profile .prof-av-floating {
    width: 102px !important;
    height: 102px !important;
    flex: 0 0 102px;
    margin-top: -43px;
    position: relative;
    z-index: 3;
    border: 5px solid rgba(10,13,27,.94);
    border-radius: 31px !important;
    background: linear-gradient(145deg,#818cf8,#7c3aed);
    box-shadow: 0 18px 44px rgba(0,0,0,.32), 0 0 0 1px rgba(255,255,255,.16);
}

#stab-profile .prof-av-floating img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 25px !important;
}

#stab-profile .settings-avatar-edit {
    right: -5px;
    bottom: -5px;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(10,13,27,.94);
    border-radius: 12px;
    background: linear-gradient(145deg,#6366f1,#9333ea);
    box-shadow: 0 7px 18px rgba(0,0,0,.28);
}

#stab-profile .prof-av-text {
    min-width: 0;
    padding-bottom: 8px;
}

#stab-profile .prof-av-name {
    color: var(--text-primary);
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: -.025em;
    overflow-wrap: anywhere;
}

#stab-profile .settings-card-section {
    width: 100%;
    padding: 18px 20px !important;
}

#stab-profile .settings-section-header {
    width: 100%;
    padding: 0 0 14px !important;
    margin: 0 0 16px !important;
}

#stab-profile .settings-section-header > i {
    width: 38px !important;
    height: 38px !important;
    border-radius: 13px !important;
    background: linear-gradient(145deg,rgba(99,102,241,.22),rgba(168,85,247,.12)) !important;
    border-color: rgba(165,180,252,.18) !important;
    color: #c7d2fe !important;
}

#stab-profile .settings-form-grid {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px !important;
    margin: 0 !important;
}

#stab-profile .profile-identity-card .settings-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#stab-profile .settings-field {
    width: 100%;
    min-width: 0;
    gap: 7px;
}

#stab-profile .settings-field label {
    padding-left: 4px;
    color: color-mix(in srgb, var(--text-primary) 57%, transparent);
    font-size: .65rem;
    letter-spacing: .075em;
}

#stab-profile .settings-input-wrap {
    width: 100%;
    min-width: 0;
    min-height: 49px;
    padding: 0 13px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 16px !important;
    background: rgba(255,255,255,.045) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.05), inset 0 2px 8px rgba(0,0,0,.12) !important;
}

#stab-profile .settings-input-wrap:focus-within {
    border-color: rgba(129,140,248,.48) !important;
    background: rgba(99,102,241,.07) !important;
    box-shadow: 0 0 0 4px rgba(99,102,241,.12), inset 0 1px 1px rgba(255,255,255,.07) !important;
}

#stab-profile .settings-input-wrap .input {
    width: 100% !important;
    min-width: 0;
    height: 47px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

#stab-profile .settings-textarea {
    width: 100% !important;
    min-height: 126px;
    resize: vertical;
    padding: 13px 14px !important;
    border: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 17px !important;
    background: rgba(255,255,255,.045) !important;
    box-shadow: inset 0 2px 9px rgba(0,0,0,.12) !important;
}

.profile-field-counter {
    align-self: flex-end;
    margin-top: -2px;
    padding-right: 4px;
    color: var(--text-muted);
    font-size: .62rem;
    font-variant-numeric: tabular-nums;
}

.profile-copy-id {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 11px;
    color: #a5b4fc;
    background: rgba(99,102,241,.12);
    cursor: pointer;
    transition: transform .2s, background .2s;
}

.profile-copy-id:hover { transform: scale(1.06); background: rgba(99,102,241,.2); }

#stab-profile .profile-bio-card,
#stab-profile .profile-cover-card {
    height: 100%;
}

#stab-profile .profile-cover-controls {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px !important;
    margin-top: 0 !important;
}

#stab-profile .profile-cover-control {
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 18px;
    background: rgba(255,255,255,.025);
}

#stab-profile .profile-cover-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 2px 10px;
    color: color-mix(in srgb,var(--text-primary) 70%,transparent);
    font-size: .64rem;
    font-weight: 760;
    letter-spacing: .055em;
    text-transform: uppercase;
}

#stab-profile .profile-cover-label small {
    color: var(--text-muted);
    font-size: .54rem;
    font-weight: 560;
    letter-spacing: 0;
    text-transform: none;
}

#stab-profile .profile-cover-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid rgba(165,180,252,.12);
    border-radius: 15px;
    color: color-mix(in srgb,var(--text-primary) 52%,transparent);
    background: rgba(99,102,241,.055);
    font-size: .61rem;
    line-height: 1.45;
}

#stab-profile .profile-cover-note i { margin-top: 2px; color: #c4b5fd; }

#stab-profile #cover-style-picker {
    grid-template-columns: repeat(5, minmax(34px, 1fr)) !important;
    gap: 8px !important;
}

#stab-profile #cover-pattern-picker {
    grid-template-columns: repeat(3, minmax(38px, 1fr)) !important;
    gap: 8px !important;
}

#stab-profile .cover-color-opt,
#stab-profile .cover-pattern-opt {
    position: relative;
    min-height: 42px;
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 13px !important;
    color: var(--text-secondary);
    cursor: pointer;
    overflow: hidden;
    transition: transform .18s ease,border-color .18s ease,box-shadow .18s ease;
}

#stab-profile .cover-color-opt:hover,
#stab-profile .cover-pattern-opt:hover { transform: translateY(-2px);border-color:rgba(255,255,255,.22); }
#stab-profile .cover-color-opt.active,
#stab-profile .cover-pattern-opt.active { box-shadow:0 0 0 3px rgba(165,180,252,.13),inset 0 1px 0 rgba(255,255,255,.2); }
#stab-profile .cover-pattern-opt { display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background:rgba(255,255,255,.035); }
#stab-profile .cover-pattern-opt span { font-size:.55rem; }

#stab-profile #social-links-list {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px !important;
}

#stab-profile #social-links-list > div {
    width: 100%;
    min-width: 0;
    padding: 7px;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 16px;
    background: rgba(255,255,255,.035);
}

#stab-profile .profile-social-row {
    display: grid !important;
    grid-template-columns: 34px minmax(0,.75fr) minmax(0,1.4fr) 32px;
    align-items: center !important;
    gap: 7px !important;
}

#stab-profile .profile-social-row-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #c7d2fe;
    background: linear-gradient(145deg,rgba(99,102,241,.2),rgba(168,85,247,.09));
}

#stab-profile .profile-social-row .remove-social-link {
    width: 32px;
    height: 32px;
    min-width: 32px !important;
    border-radius: 10px;
}

#stab-profile #social-links-list input {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid rgba(255,255,255,.085);
    border-radius: 12px !important;
    outline: none;
    color: var(--text-primary);
    background: rgba(4,7,17,.24);
    font: inherit;
    font-size: .66rem;
    transition: border-color .18s ease,box-shadow .18s ease,background .18s ease;
}

#stab-profile #social-links-list input:focus {
    border-color: rgba(129,140,248,.4);
    background: rgba(99,102,241,.06);
    box-shadow: 0 0 0 3px rgba(99,102,241,.09);
}

#stab-profile #add-social-link-btn {
    width: 100%;
    min-height: 44px;
    margin-top: 12px !important;
    border-radius: 14px !important;
}

#stab-profile #save-profile-btn {
    width: 100% !important;
    min-height: 54px;
    margin-top: 16px;
    border-radius: 18px !important;
    position: sticky;
    bottom: 0;
    z-index: 8;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

#stab-profile .profile-save-action { grid-column: 1 / -1; }

[data-theme="light"] #stab-profile .settings-card,
[data-theme="light"] #stab-profile .sacc-card {
    background: rgba(255,255,255,.62) !important;
    border-color: rgba(255,255,255,.9) !important;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.95), 0 12px 34px rgba(51,65,85,.08) !important;
}

[data-theme="light"] #stab-profile .settings-input-wrap,
[data-theme="light"] #stab-profile .settings-textarea,
[data-theme="light"] #stab-profile #social-links-list > div {
    background: rgba(255,255,255,.58) !important;
    border-color: rgba(15,23,42,.09) !important;
}

[data-theme="light"] #stab-profile .profile-cover-control { border-color:rgba(15,23,42,.08);background:rgba(255,255,255,.42); }
[data-theme="light"] #stab-profile .profile-cover-note { border-color:rgba(79,70,229,.1);background:rgba(99,102,241,.05); }
[data-theme="light"] #stab-profile #social-links-list input { border-color:rgba(15,23,42,.08);background:rgba(255,255,255,.72); }

@media (max-width: 900px) {
    #stab-profile .profile-identity-card .settings-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    #settings-modal {
        align-items: flex-end;
        padding: 0 !important;
    }

    .modal-card-settings {
        width: 100% !important;
        max-width: none !important;
        height: calc(100dvh - 6px) !important;
        max-height: calc(100dvh - 6px) !important;
        border-width: 1px 0 0 !important;
        border-radius: 28px 28px 0 0 !important;
    }

    .modal-card-settings .modal-header {
        min-height: 58px;
        padding: calc(12px + env(safe-area-inset-top)) 14px 12px !important;
    }

    .settings-content-scroll {
        width: 100% !important;
        padding: 10px 10px calc(22px + env(safe-area-inset-bottom)) !important;
    }

    .settings-mobile-nav {
        width: 100%;
        margin-bottom: 10px !important;
    }

    .settings-mobile-dropdown,
    .settings-dropdown-btn {
        width: 100%;
    }

    .profile-settings-header {
        min-height: 106px;
        margin-bottom: 10px !important;
        padding: 17px 16px !important;
        border-radius: 22px;
    }

    .profile-settings-secure {
        padding: 7px 9px;
        font-size: .6rem;
    }

    .profile-settings-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    #stab-profile .profile-identity-card,
    #stab-profile .profile-social-card,
    #stab-profile #settings-accs-card {
        grid-column: auto;
    }

    #stab-profile .settings-card,
    #stab-profile .sacc-card {
        border-radius: 22px !important;
    }

    #stab-profile .profile-cover-preview {
        height: 156px !important;
        padding: 18px !important;
        border-radius: 21px 21px 0 0 !important;
    }

    #stab-profile #cover-preview-avatar {
        width: 60px !important;
        height: 60px !important;
        border-radius: 19px !important;
        font-size: 1.5rem !important;
    }

    #stab-profile .prof-av-section {
        padding: 0 14px 15px !important;
    }

    #stab-profile .prof-av-floating {
        width: 88px !important;
        height: 88px !important;
        flex-basis: 88px;
        border-radius: 27px !important;
    }

    #stab-profile .prof-av-floating img { border-radius: 21px !important; }
    #stab-profile .settings-card-section { padding: 15px 14px !important; }
    #stab-profile .settings-form-grid,
    #stab-profile .profile-identity-card .settings-form-grid,
    #stab-profile .profile-cover-controls,
    #stab-profile #social-links-list {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    #stab-profile .settings-input-wrap,
    #stab-profile .settings-textarea,
    #stab-profile #add-social-link-btn,
    #stab-profile #save-profile-btn {
        width: 100% !important;
    }

    #stab-profile .profile-social-row {
        grid-template-columns: 32px minmax(0,.7fr) minmax(0,1.25fr) 30px !important;
    }

    #stab-profile #cover-style-picker { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
    #stab-profile #cover-pattern-picker { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    #stab-profile #save-profile-btn { position: static; margin-top: 10px; }
}
}}