:root {
    --bg: #080b12;
    --panel: #0d111b;
    --panel-soft: #111724;

    --border: rgba(255,255,255,.075);

    --text: #f4f6fb;
    --muted: #7f899e;
    --muted-light: #adb5c7;

    --accent: #8295ff;
    --accent-soft: rgba(130,149,255,.14);

    --green: #5dd39e;
    --red: #ff747c;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    background:
        radial-gradient(
            circle at top,
            #11182b,
            var(--bg) 42%
        );

    color: var(--text);

    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}


/* LOGIN */

.login-screen {
    min-height: 100%;

    display: grid;
    place-items: center;

    padding: 24px;
}

.login-card {
    width: min(400px, 100%);

    padding: 40px;

    border: 1px solid var(--border);
    border-radius: 26px;

    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.055),
            rgba(255,255,255,.018)
        );

    box-shadow:
        0 35px 100px rgba(0,0,0,.35);
}

.logo {
    width: 48px;
    height: 48px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 15px;

    background: var(--accent-soft);

    font-weight: 700;
}

.eyebrow {
    margin-top: 35px;

    color: var(--accent);

    font-size: 10px;
    font-weight: 700;

    letter-spacing: .18em;
}

.login-card h1 {
    margin: 7px 0;

    font-size: 42px;
    letter-spacing: -.05em;
}

.login-card p {
    margin: 0 0 32px;

    color: var(--muted);

    line-height: 1.6;
}

.login-card label {
    display: block;

    margin-bottom: 9px;

    color: var(--muted-light);

    font-size: 12px;
}

.login-card input {
    width: 100%;

    padding: 13px 14px;

    border: 1px solid var(--border);
    border-radius: 12px;

    outline: none;

    background:
        rgba(255,255,255,.035);

    color: var(--text);
}

.login-card input:focus {
    border-color:
        rgba(130,149,255,.55);
}

.login-card form button {
    width: 100%;

    margin-top: 12px;
    padding: 13px;

    border:
        1px solid
        rgba(130,149,255,.35);

    border-radius: 12px;

    background: var(--accent-soft);

    color: #d5dcff;

    font-weight: 650;
}

.login-card form button:hover {
    background:
        rgba(130,149,255,.22);
}

.back-link {
    display: block;

    margin-top: 25px;

    color: var(--muted);
    text-decoration: none;

    font-size: 11px;
}


/* APP */

.app {
    height: 100vh;

    display: grid;
    grid-template-columns: 270px 1fr;
}


/* SIDEBAR */

.sidebar {
    min-height: 0;

    display: flex;
    flex-direction: column;

    border-right:
        1px solid var(--border);

    background:
        linear-gradient(
            160deg,
            #101624,
            #090d15
        );
}

.brand {
    padding: 23px;

    display: flex;
    align-items: center;
    gap: 11px;

    border-bottom:
        1px solid var(--border);
}

.brand-logo {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--accent-soft);

    font-weight: 700;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 13px;
}

.brand span {
    margin-top: 3px;

    color: var(--muted);

    font-size: 10px;
}

.channels,
.online-section {
    padding: 23px;
}

.section-label {
    color: var(--muted);

    font-size: 9px;
    font-weight: 700;

    letter-spacing: .16em;
}

.channel {
    width: 100%;

    margin-top: 10px;
    padding: 10px 12px;

    display: flex;
    gap: 9px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: transparent;

    color: var(--muted-light);

    text-align: left;
}

.channel.active {
    border-color: var(--border);

    background:
        rgba(255,255,255,.04);

    color: var(--text);
}

.online-section {
    min-height: 0;

    padding-top: 5px;

    overflow-y: auto;
}

.section-title {
    display: flex;
    justify-content: space-between;
}

.online-count {
    color: var(--muted);

    font-size: 10px;
}

.users {
    margin-top: 12px;

    display: grid;
    gap: 4px;
}

.user {
    padding: 7px 3px;

    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--muted-light);

    font-size: 11px;
}

.user-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--green);

    box-shadow:
        0 0 10px
        rgba(93,211,158,.45);
}

.sidebar footer {
    margin-top: auto;
    padding: 17px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-top:
        1px solid var(--border);
}

.current-user {
    display: flex;
    align-items: center;
    gap: 9px;

    overflow: hidden;

    color: var(--muted-light);

    font-size: 11px;
}

.logout-button {
    width: 31px;
    height: 31px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background:
        rgba(255,255,255,.03);

    color: var(--muted);
}


/* CHAT */

.chat {
    min-width: 0;
    min-height: 0;

    display: grid;
    grid-template-rows: auto 1fr auto;
}

.chat-header {
    min-height: 77px;

    padding: 0 28px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom:
        1px solid var(--border);

    background:
        rgba(8,11,18,.7);

    backdrop-filter: blur(14px);
}

.chat-title {
    font-size: 15px;
    font-weight: 650;
}

.chat-subtitle {
    margin-top: 4px;

    color: var(--muted);

    font-size: 10px;
}

.connection {
    display: flex;
    align-items: center;
    gap: 7px;

    color: var(--muted);

    font-size: 10px;
}

.connection span {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: #d5b765;
}

.connection.online span {
    background: var(--green);
}

.connection.offline span {
    background: var(--red);
}


/* MESSAGES */

.messages {
    min-height: 0;

    padding: 25px 28px 35px;

    overflow-y: auto;
}

.message {
    max-width: 760px;

    margin-bottom: 23px;

    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: 12px;

    background:
        rgba(255,255,255,.04);

    color: #cbd2e0;

    font-size: 12px;
    font-weight: 650;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.message-user {
    font-size: 12px;
    font-weight: 650;
}

.message-time {
    color: var(--muted);

    font-size: 9px;
}

.message-text {
    margin-top: 6px;

    color: #cdd3df;

    font-size: 13px;
    line-height: 1.55;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.empty {
    height: 100%;

    display: grid;
    place-items: center;

    color: var(--muted);

    font-size: 12px;
}


/* COMPOSER */

.composer {
    margin: 0 28px 25px;

    padding: 8px;

    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 8px;

    border: 1px solid var(--border);
    border-radius: 16px;

    background:
        rgba(255,255,255,.035);
}

.composer:focus-within {
    border-color:
        rgba(130,149,255,.4);
}

.composer textarea {
    max-height: 150px;

    padding: 8px;

    resize: none;

    border: 0;
    outline: 0;

    background: transparent;

    color: var(--text);
}

.composer button {
    width: 38px;
    height: 38px;

    border:
        1px solid
        rgba(130,149,255,.35);

    border-radius: 11px;

    background: var(--accent-soft);

    color: #dbe0ff;

    font-size: 17px;
}


/* MOBILE */

@media (max-width: 700px) {

    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .chat-header {
        min-height: 65px;

        padding: 0 17px;
    }

    .messages {
        padding: 20px 17px 30px;
    }

    .composer {
        margin:
            0 12px
            calc(12px + env(safe-area-inset-bottom));
    }

    .login-card {
        padding: 30px;
    }
}
