/* ===================================================================
   NOVAX — main stylesheet
   =================================================================== */

:root {
    /* Brand */
    --novax-1: #7c5cff;
    --novax-2: #4d8dff;
    --novax-3: #ff6cd1;
    --novax-grad: linear-gradient(135deg, #7c5cff 0%, #4d8dff 50%, #36e0ff 100%);
    --novax-grad-soft: linear-gradient(135deg, rgba(124, 92, 255, .25), rgba(54, 224, 255, .25));

    /* Spacing */
    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    --t-fast: 120ms;
    --t-med:  220ms;
    --t-slow: 380ms;
    --ease:   cubic-bezier(.4, .14, .3, 1);

    --shadow-sm: 0 4px 16px rgba(8, 4, 32, .25);
    --shadow-md: 0 12px 32px rgba(8, 4, 32, .35);
    --shadow-lg: 0 24px 60px rgba(8, 4, 32, .45);
}

[data-theme="dark"] {
    --bg-0: #0a0817;
    --bg-1: #0f0c22;
    --bg-2: #15122c;
    --bg-3: #1c1838;
    --bg-rail: #08071b;

    --fg:        #ecebff;
    --fg-muted:  rgba(236, 235, 255, .68);
    --fg-faint:  rgba(236, 235, 255, .42);

    --border:        rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .14);

    --glass-bg:      rgba(20, 16, 48, .55);
    --glass-bg-hi:   rgba(28, 22, 60, .65);
    --glass-border:  rgba(255, 255, 255, .08);
    --glass-blur:    18px;

    --input-bg:      rgba(255, 255, 255, .03);
    --input-border:  rgba(255, 255, 255, .08);
    --input-border-focus: var(--novax-1);
    --hover-bg:      rgba(255, 255, 255, .04);
    --active-bg:     rgba(124, 92, 255, .18);
    --active-border: rgba(124, 92, 255, .55);

    --danger: #ff6480;
    --success: #43e2a0;
}

[data-theme="light"] {
    --bg-0: #f5f4fb;
    --bg-1: #ffffff;
    --bg-2: #f0eef9;
    --bg-3: #e7e3f5;
    --bg-rail: #efedf8;

    --fg:        #1b163a;
    --fg-muted:  rgba(27, 22, 58, .68);
    --fg-faint:  rgba(27, 22, 58, .48);

    --border:        rgba(27, 22, 58, .08);
    --border-strong: rgba(27, 22, 58, .14);

    --glass-bg:      rgba(255, 255, 255, .72);
    --glass-bg-hi:   rgba(255, 255, 255, .85);
    --glass-border:  rgba(27, 22, 58, .07);
    --glass-blur:    14px;

    --input-bg:      rgba(255, 255, 255, .9);
    --input-border:  rgba(27, 22, 58, .12);
    --input-border-focus: var(--novax-1);
    --hover-bg:      rgba(27, 22, 58, .04);
    --active-bg:     rgba(124, 92, 255, .12);
    --active-border: rgba(124, 92, 255, .5);

    --danger: #d93658;
    --success: #1e9966;
}

/* ===== Reset ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body {
    min-height: 100vh;
    font-family: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont,
                 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--fg);
    background: var(--bg-0);
    line-height: 1.55;
    overflow-x: hidden;
}
body::before {
    content: "";
    position: fixed; inset: -200px;
    background:
        radial-gradient(closest-side, rgba(124, 92, 255, .14), transparent 70%) 14% 18% / 56% 56% no-repeat,
        radial-gradient(closest-side, rgba(54, 224, 255, .12),  transparent 70%) 86% 22% / 50% 50% no-repeat,
        radial-gradient(closest-side, rgba(255, 108, 209, .10), transparent 70%) 50% 90% / 60% 60% no-repeat;
    z-index: -1;
    pointer-events: none;
    filter: blur(40px);
}
[data-theme="light"] body::before { opacity: .55; }

img, svg { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: var(--novax-2); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { list-style: none; padding: 0; margin: 0; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ===== Brand mark ================================================ */
.brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--fg); font-weight: 600;
    text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand--center { justify-content: center; margin-bottom: 22px; }
.brand__mark {
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--novax-grad);
    box-shadow: 0 4px 16px rgba(124, 92, 255, .35);
    position: relative;
    flex-shrink: 0;
}
.brand__mark::after {
    content: "";
    position: absolute; inset: 4px;
    border: 2px solid rgba(255,255,255,.85);
    border-radius: 6px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
.brand__name {
    font-weight: 700; letter-spacing: .12em;
    background: var(--novax-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ===== Buttons =================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    color: var(--fg);
    cursor: pointer;
    font-weight: 500;
    line-height: 1;
    transition: transform var(--t-fast) var(--ease),
                background var(--t-med) var(--ease),
                border-color var(--t-med) var(--ease),
                box-shadow var(--t-med) var(--ease);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .35);
}

.btn--primary {
    background: var(--novax-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(124, 92, 255, .35);
}
.btn--primary:hover { box-shadow: 0 12px 28px rgba(124, 92, 255, .45); }

.btn--ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--fg);
}
.btn--ghost:hover { background: var(--hover-bg); }

.btn--danger {
    background: rgba(255, 100, 128, .12);
    color: var(--danger);
    border-color: rgba(255, 100, 128, .25);
}
.btn--danger:hover { background: rgba(255, 100, 128, .2); }

.btn--lg { padding: 14px 24px; font-size: 1.02rem; border-radius: 14px; }
.btn--block { width: 100%; }

/* Icon buttons */
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--fg-muted);
    cursor: pointer;
    text-decoration: none;
    font-size: 16px;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--hover-bg); color: var(--fg); }
.icon-btn--sm { width: 28px; height: 28px; font-size: 14px; }

/* ===== Glass surfaces ============================================ */
.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    box-shadow: var(--shadow-md);
    border-radius: var(--r-lg);
}

.glass-bottom {
    background: var(--glass-bg);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

/* ===== Form primitives =========================================== */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: .85rem; font-weight: 500; color: var(--fg-muted); }
.field__hint  { font-size: .78rem; color: var(--fg-faint); }
.field__input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--fg);
    font: inherit;
    transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.field__input:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 4px rgba(124, 92, 255, .18);
}
.field__input:disabled { opacity: .55; cursor: not-allowed; }
textarea.field__input { resize: vertical; min-height: 84px; line-height: 1.5; }
.field__input--color { padding: 4px; height: 42px; }
.check {
    display: inline-flex; gap: 8px; align-items: center;
    color: var(--fg-muted); font-size: .92rem;
    cursor: pointer; user-select: none;
}
.check input { accent-color: var(--novax-1); }
.form__row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.form__msg {
    margin: 4px 0 0;
    min-height: 1.2em;
    font-size: .88rem;
    color: var(--danger);
}
.form__msg.is-success { color: var(--success); }

/* ===== Toasts ==================================================== */
.toasts {
    position: fixed;
    top: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 10px;
    z-index: 200;
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--glass-bg-hi);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-md);
    color: var(--fg);
    font-size: .92rem;
    max-width: 320px;
    transform: translateX(120%);
    animation: toast-in var(--t-med) var(--ease) forwards;
}
.toast.is-leaving { animation: toast-out var(--t-med) var(--ease) forwards; }
.toast--error   { border-left: 3px solid var(--danger);  }
.toast--success { border-left: 3px solid var(--success); }
@keyframes toast-in  { to { transform: translateX(0); } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }

/* ===== Modals ==================================================== */
.modal {
    position: fixed; inset: 0;
    display: none;
    align-items: center; justify-content: center;
    z-index: 150;
    padding: 16px;
}
.modal.is-open { display: flex; }
.modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(8, 4, 32, .55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fade-in var(--t-med) var(--ease);
}
.modal__panel {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 22px 22px 18px;
    animation: pop-in var(--t-med) var(--ease);
}
.modal__head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px;
}
.modal__head h2 { margin: 0; font-size: 1.2rem; font-weight: 600; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
    from { opacity: 0; transform: translateY(18px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ===== Avatars =================================================== */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--novax-grad);
    color: #fff;
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: .92rem;
    overflow: hidden;
    position: relative;
    box-shadow: 0 6px 18px rgba(124, 92, 255, .24);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar--md { width: 44px; height: 44px; }
.avatar--lg { width: 64px; height: 64px; font-size: 1.1rem; }
.avatar--xl { width: 96px; height: 96px; font-size: 1.6rem; box-shadow: 0 14px 30px rgba(124, 92, 255, .35); }
.avatar__placeholder { font-weight: 700; }

/* Online indicator */
.status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--fg-faint);
    display: inline-block;
    border: 2px solid var(--bg-0);
}
.status-dot--online { background: var(--success); }
.status-dot--idle { background: #f0b400; }

/* ===== Decorative orbs =========================================== */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    animation: float 14s ease-in-out infinite;
}
.orb--purple { width: 380px; height: 380px; background: #7c5cff; top: -60px; left: -60px; }
.orb--blue   { width: 320px; height: 320px; background: #4d8dff; bottom: -40px; right: -60px; animation-delay: -4s; }
.orb--pink   { width: 300px; height: 300px; background: #ff6cd1; top: 40%; right: 12%; animation-delay: -7s; }
@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(20px, -28px); }
}

/* ===================================================================
   Landing page
   =================================================================== */
.landing { position: relative; min-height: 100vh; padding: 0 28px 80px; max-width: 1240px; margin: 0 auto; overflow: hidden; }
.landing__bg {
    position: absolute; inset: 0; pointer-events: none; z-index: -1;
}
.landing__nav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 26px 0;
}
.landing__nav-actions { display: flex; gap: 10px; }

.landing__hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 48px;
    align-items: center;
    padding: 70px 0 90px;
}
.hero__badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--novax-grad-soft);
    border: 1px solid rgba(124, 92, 255, .25);
    color: var(--fg-muted);
    font-size: .8rem; letter-spacing: .04em;
    margin-bottom: 22px;
}
.hero__title {
    font-size: clamp(2.4rem, 5vw, 4rem);
    line-height: 1.04;
    font-weight: 700;
    margin: 0 0 22px;
    letter-spacing: -0.02em;
}
.grad-text {
    background: var(--novax-grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero__lede {
    font-size: 1.12rem;
    color: var(--fg-muted);
    margin: 0 0 32px;
    max-width: 540px;
}
.hero__cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.hero__bullets { display: flex; flex-direction: column; gap: 8px; color: var(--fg-muted); font-size: .96rem; }
.hero__bullets .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--novax-grad);
    display: inline-block; margin-right: 10px;
    box-shadow: 0 0 12px rgba(124, 92, 255, .65);
}

.hero__preview { position: relative; }
.preview-window {
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-lg);
    transform: rotate(.4deg);
}
.preview-window__bar {
    display: flex; gap: 6px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, .15);
    border-bottom: 1px solid var(--glass-border);
}
.preview-window__bar span {
    width: 12px; height: 12px; border-radius: 50%;
    background: rgba(255,255,255,.18);
}
.preview-window__bar span:nth-child(1) { background: #ff6480; }
.preview-window__bar span:nth-child(2) { background: #f0b400; }
.preview-window__bar span:nth-child(3) { background: #43e2a0; }
.preview-window__body {
    display: grid;
    grid-template-columns: 64px 200px 1fr;
    min-height: 360px;
    background: var(--bg-1);
}
.preview-sidebar {
    background: var(--bg-rail);
    padding: 14px 0;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.preview-server {
    width: 38px; height: 38px; border-radius: 12px;
    background: rgba(255,255,255,.06);
    transition: border-radius var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.preview-server:hover { border-radius: 22%; transform: translateX(2px); }
.preview-server--active {
    background: var(--novax-grad);
    border-radius: 22%;
}
.preview-server--add {
    color: var(--success);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.preview-channels {
    padding: 16px;
    border-right: 1px solid var(--border);
    background: var(--bg-2);
    color: var(--fg-muted);
    font-size: .9rem;
}
.preview-channel-title { color: var(--fg-faint); font-size: .76rem; letter-spacing: .12em; margin-bottom: 10px; text-transform: uppercase; }
.preview-channel { padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.preview-channel--active { background: var(--active-bg); color: var(--fg); }
.preview-chat {
    padding: 18px;
    display: flex; flex-direction: column; gap: 14px;
}
.preview-msg { display: flex; gap: 10px; }
.preview-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--novax-grad);
}
.preview-avatar--alt { background: linear-gradient(135deg, #ff6cd1, #f0b400); }
.preview-avatar--me { background: linear-gradient(135deg, #43e2a0, #36e0ff); }
.preview-author { font-size: .82rem; color: var(--fg-muted); margin-bottom: 4px; }
.muted { color: var(--fg-faint); }
.preview-bubble {
    background: rgba(255,255,255,.05);
    padding: 8px 12px; border-radius: 10px;
    font-size: .92rem;
    margin-bottom: 4px;
    max-width: 360px;
}
.preview-bubble--me {
    background: var(--novax-grad-soft);
    border: 1px solid rgba(124, 92, 255, .35);
}

.landing__features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 80px;
}
.feature {
    padding: 22px;
    border-radius: var(--r-lg);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease);
}
.feature:hover { transform: translateY(-4px); border-color: var(--active-border); }
.feature h3 { margin: 14px 0 6px; font-size: 1.05rem; }
.feature p  { color: var(--fg-muted); margin: 0; font-size: .94rem; }
.feature__icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; color: #fff;
}
.feature__icon--purple { background: linear-gradient(135deg, #7c5cff, #4d8dff); }
.feature__icon--blue   { background: linear-gradient(135deg, #36e0ff, #4d8dff); }
.feature__icon--pink   { background: linear-gradient(135deg, #ff6cd1, #f0b400); }
.feature__icon--cyan   { background: linear-gradient(135deg, #36e0ff, #43e2a0); }

.landing__footer {
    border-top: 1px solid var(--border);
    padding-top: 22px;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
    color: var(--fg-faint); font-size: .9rem;
}

@media (max-width: 880px) {
    .landing__hero { grid-template-columns: 1fr; padding-top: 48px; }
    .hero__preview { display: none; }
}

/* ===================================================================
   Auth pages (login / register)
   =================================================================== */
.auth {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
    position: relative;
}
.auth__bg { position: absolute; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }

.auth-card {
    width: 100%; max-width: 440px;
    padding: 30px 28px;
    border-radius: var(--r-xl);
    animation: pop-in var(--t-slow) var(--ease);
}
.auth-card__title { margin: 8px 0 4px; font-size: 1.6rem; font-weight: 600; }
.auth-card__sub   { margin: 0 0 22px; color: var(--fg-muted); font-size: .96rem; }
.auth-card__alt   { margin: 18px 0 0; text-align: center; color: var(--fg-muted); font-size: .92rem; }
.auth-card__alt a { font-weight: 500; }

/* ===================================================================
   App layout (chat)
   =================================================================== */
.app {
    height: 100vh;
    display: grid;
    grid-template-columns: 76px 280px 1fr 240px;
    background: var(--bg-1);
}
.app[data-loading="true"] .chat__body,
.app[data-loading="true"] .composer { opacity: .55; }

/* ----- Server rail ----- */
.server-rail {
    background: var(--bg-rail);
    padding: 14px 0;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
}
.server-rail__home,
.server-rail__btn,
.server-icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    color: var(--fg-muted);
    cursor: pointer; border: 1px solid transparent;
    text-decoration: none;
    font-weight: 600;
    flex-shrink: 0;
    transition: border-radius var(--t-med) var(--ease),
                background var(--t-med) var(--ease),
                transform var(--t-fast) var(--ease);
    position: relative;
}
.server-rail__home:hover,
.server-rail__btn:hover,
.server-icon:hover {
    border-radius: 22%;
    background: var(--hover-bg);
    color: var(--fg);
    text-decoration: none;
}
.server-rail__home {
    background: var(--novax-grad);
    color: #fff;
}
.server-rail__home-mark {
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 4px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
.server-rail__divider {
    width: 32px; height: 2px; border-radius: 1px;
    background: var(--border-strong);
    margin: 4px 0;
}
.server-rail__list { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; }
.server-icon {
    overflow: hidden;
    background: var(--bg-3);
    color: var(--fg);
}
.server-icon img { width: 100%; height: 100%; object-fit: cover; }
.server-icon--active { border-radius: 22%; box-shadow: 0 0 0 2px var(--novax-1); }
.server-icon::before {
    content: "";
    position: absolute; left: -8px; top: 50%;
    width: 4px; height: 0;
    background: #fff; border-radius: 0 3px 3px 0;
    transform: translateY(-50%);
    transition: height var(--t-med) var(--ease);
}
.server-icon--active::before, .server-icon:hover::before { height: 24px; }
.server-rail__btn--add { color: var(--success); }
.server-rail__btn--explore { color: var(--novax-2); }

/* ----- Channel bar ----- */
.channel-bar {
    background: var(--bg-2);
    border-radius: 0;
    border: 0;
    border-right: 1px solid var(--border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.channel-bar__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}
.channel-bar__section { padding: 12px 8px; flex: 1; overflow-y: auto; }
.channel-bar__section[hidden] { display: none; }
.channel-bar__section-h {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 8px;
    color: var(--fg-faint);
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .12em;
    margin-bottom: 4px;
}
.link { color: var(--novax-2); font-size: .76rem; }

.channel-list, .dm-list { display: flex; flex-direction: column; gap: 2px; }
.channel-item, .dm-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    color: var(--fg-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
    font-size: .94rem;
}
.channel-item:hover, .dm-item:hover { background: var(--hover-bg); color: var(--fg); text-decoration: none; }
.channel-item.is-active, .dm-item.is-active { background: var(--active-bg); color: var(--fg); }
.channel-item__hash { color: var(--fg-faint); }

.channel-bar__user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, .12);
}
.channel-bar__user-info { flex: 1; min-width: 0; }
.channel-bar__user-name { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.channel-bar__user-status {
    font-size: .76rem; color: var(--fg-muted);
    display: flex; align-items: center; gap: 6px;
}

/* ----- Chat panel ----- */
.chat {
    display: flex; flex-direction: column;
    background: var(--bg-1);
    overflow: hidden;
}
.chat__header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
}
.chat__menu { display: none; }
.chat__title { display: flex; gap: 6px; align-items: center; font-weight: 600; font-size: 1.02rem; }
.chat__hash { color: var(--fg-faint); }
.chat__topic { color: var(--fg-muted); font-size: .9rem; padding-left: 14px; border-left: 1px solid var(--border); }
.chat__actions { margin-left: auto; display: flex; gap: 4px; }

.chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 14px;
    scroll-behavior: smooth;
    transition: opacity var(--t-med) var(--ease);
}
.chat__placeholder {
    height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 10px;
    color: var(--fg-muted);
}
.chat__placeholder-mark {
    width: 80px; height: 80px;
    border-radius: 22%;
    background: var(--novax-grad);
    box-shadow: 0 14px 40px rgba(124, 92, 255, .4);
    margin-bottom: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 28px;
    position: relative;
}
.chat__placeholder-mark::after {
    content: "";
    position: absolute; inset: 14px;
    border: 2px solid #fff;
    border-radius: 9px;
    clip-path: polygon(0 0, 100% 0, 0 100%);
}
.chat__placeholder h2 { margin: 8px 0 0; color: var(--fg); }
.chat__placeholder-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }

.messages { display: flex; flex-direction: column; gap: 18px; }
.message-group {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 12px;
    animation: msg-in var(--t-med) var(--ease);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message-group__author {
    font-weight: 600;
    margin: 0 0 4px;
    font-size: .96rem;
    display: flex; gap: 8px; align-items: baseline;
}
.message-group__author time { color: var(--fg-faint); font-size: .76rem; font-weight: 400; }
.message {
    padding: 4px 12px;
    margin-left: -12px;
    border-radius: 8px;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    color: var(--fg);
    transition: background var(--t-fast) var(--ease);
    position: relative;
}
.message:hover { background: var(--hover-bg); }
.message__actions {
    position: absolute;
    top: -8px; right: 8px;
    display: none;
    gap: 4px;
    background: var(--glass-bg-hi);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}
.message:hover .message__actions { display: flex; }

.typing {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 8px;
    color: var(--fg-faint); font-size: .82rem; font-style: italic;
}
.typing span {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--fg-faint);
    animation: bounce 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-4px); }
}

/* ----- Composer ----- */
.composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 18px 18px;
    background: var(--bg-1);
    border-top: 1px solid var(--border);
}
.composer textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--fg);
    resize: none;
    line-height: 1.5;
    max-height: 160px;
    font: inherit;
    transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.composer textarea:focus {
    outline: none;
    border-color: var(--input-border-focus);
    box-shadow: 0 0 0 4px rgba(124, 92, 255, .18);
}
.composer__send {
    width: 46px; height: 46px;
    border-radius: 14px;
    border: 0;
    cursor: pointer;
    background: var(--novax-grad);
    color: #fff;
    box-shadow: 0 6px 18px rgba(124, 92, 255, .4);
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease);
    align-self: end;
}
.composer__send:hover { transform: translateY(-2px); }
.composer__send:active { transform: translateY(0); }

/* ----- Members panel ----- */
.members {
    background: var(--bg-2);
    border: 0; border-left: 1px solid var(--border);
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.members__header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--fg-muted);
}
.members__list { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.member {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px; border-radius: 10px;
    transition: background var(--t-fast) var(--ease);
}
.member:hover { background: var(--hover-bg); }
.member__name { font-size: .92rem; font-weight: 500; }
.member__role { font-size: .72rem; color: var(--fg-faint); }
.member__avatar { position: relative; }
.member__avatar .status-dot {
    position: absolute;
    right: -2px; bottom: -2px;
}

/* ===================================================================
   Settings layout
   =================================================================== */
.settings, .friends {
    height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--bg-1);
}
.settings__nav, .friends__nav {
    background: var(--bg-2);
    padding: 22px 16px;
    border-right: 1px solid var(--border);
    border-radius: 0; border: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: none;
    display: flex; flex-direction: column; gap: 6px;
    overflow-y: auto;
}
.settings__nav .brand,
.friends__nav .brand { margin-bottom: 12px; }

.settings__nav-item, .friends__nav-item {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--fg-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.settings__nav-item:hover, .friends__nav-item:hover { background: var(--hover-bg); color: var(--fg); text-decoration: none; }
.settings__nav-item.is-active, .friends__nav-item.is-active {
    background: var(--active-bg); color: var(--fg);
    box-shadow: inset 3px 0 0 var(--novax-1);
}
.settings__nav .btn, .friends__nav .btn { margin-top: auto; }

.settings__content, .friends__content {
    overflow-y: auto;
    padding: 36px 32px;
    max-width: 980px;
    width: 100%;
}
.settings-panel, .friends-tab { animation: pop-in var(--t-med) var(--ease); }
.settings-panel__head { margin-bottom: 22px; }
.settings-panel__head h2 { margin: 0 0 4px; font-size: 1.6rem; }
.settings-panel__head p  { margin: 0; color: var(--fg-muted); }

.settings-card {
    padding: 26px;
    border-radius: var(--r-lg);
    margin-bottom: 22px;
}
.settings-card .form + .form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.settings-card__hint { color: var(--fg-muted); font-size: .9rem; margin-top: 14px; }

.profile-preview {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 22px;
}
.profile-preview__name  { font-size: 1.2rem; font-weight: 600; }
.profile-preview__handle { color: var(--fg-faint); font-size: .9rem; margin-top: 2px; }
.profile-preview__bio   { margin-top: 8px; color: var(--fg-muted); }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.theme-tile {
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color var(--t-med) var(--ease), transform var(--t-fast) var(--ease);
}
.theme-tile:hover { transform: translateY(-2px); border-color: var(--active-border); }
.theme-tile.is-active { border-color: var(--novax-1); box-shadow: 0 0 0 3px rgba(124, 92, 255, .25); }
.theme-tile__preview {
    display: block;
    height: 78px;
    border-radius: 10px;
    margin-bottom: 10px;
}
.theme-tile--dark .theme-tile__preview {
    background: linear-gradient(135deg, #0a0817, #1c1838);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.theme-tile--light .theme-tile__preview {
    background: linear-gradient(135deg, #ffffff, #efedf8);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.theme-tile__label { font-weight: 600; }

.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-list__empty {
    padding: 22px;
    text-align: center; color: var(--fg-faint);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}
.notif {
    display: flex; gap: 12px; align-items: center;
    padding: 12px;
    border-radius: var(--r-md);
    background: rgba(255,255,255,.02);
    border: 1px solid var(--border);
}
.notif--unread { border-left: 3px solid var(--novax-1); }
.notif__type {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    background: var(--novax-grad-soft);
    color: var(--novax-1);
    font-weight: 600;
}
.notif__time { color: var(--fg-faint); font-size: .8rem; }

/* ===================================================================
   Friends page
   =================================================================== */
.friends__head { margin-bottom: 18px; }
.friends__head h2 { margin: 0 0 4px; }
.friends__head p  { margin: 0; color: var(--fg-muted); }

.friend-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: var(--r-md);
    background: rgba(255,255,255,.02);
    border: 1px solid var(--border);
    transition: border-color var(--t-med) var(--ease);
}
.friend-card:hover { border-color: var(--active-border); }
.friend-card + .friend-card { margin-top: 10px; }
.friend-card__name { font-weight: 600; }
.friend-card__sub  { color: var(--fg-muted); font-size: .86rem; }
.friend-card__actions { display: flex; gap: 8px; }
.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--fg-faint);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}

/* ===================================================================
   Responsive
   =================================================================== */
@media (max-width: 1100px) {
    .app { grid-template-columns: 72px 260px 1fr; }
    .members { display: none; }
    .members.is-open { display: flex; }
}
@media (max-width: 760px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }
    .server-rail, .channel-bar { display: none; }
    .app.show-rail .server-rail { display: flex; position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; }
    .app.show-channels .channel-bar { display: flex; position: fixed; left: 0; top: 0; bottom: 0; width: min(82vw, 320px); z-index: 31; }
    .chat__menu { display: inline-flex; }
    .composer { padding: 10px 12px 14px; }

    .settings, .friends { grid-template-columns: 1fr; }
    .settings__nav, .friends__nav {
        flex-direction: row; flex-wrap: wrap;
        padding: 10px;
        gap: 6px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 5;
    }
    .settings__nav .brand, .friends__nav .brand { width: 100%; }
    .settings__nav .btn, .friends__nav .btn { flex: 1; }
}
