:root {
    --bg-main: #1e1f22;
    --bg-chat: #313338;
    --bg-panel: #2b2d31;
    --bg-hover: #35373c;
    --bg-active: #404249;
    --text-main: #f2f3f5;
    --text-muted: #aeb5bf;
    --brand: #5865f2;
    --border: #26282c;
    --online: #3aba7c;
    --away: #dba63b;
    --offline: #616775;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 15px;
    background: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #2c3357 transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #2c3357;
    border-radius: 8px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #3b4676;
}

.app {
    display: grid;
    grid-template-columns: 72px 260px minmax(0, 1fr) 220px;
    height: 100dvh;
    width: 100vw;
}

.app > * {
    min-width: 0;
    min-height: 0;
}

.guilds,
.channels,
.users {
    overflow-y: auto;
}

.guilds {
    background: #1a1b1e;
    padding: 10px 8px 16px;
    border-right: 1px solid #111214;
    overflow-x: hidden;
}

.guilds-header {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
    letter-spacing: 0.08em;
    margin: 2px 0 12px;
}

.guild-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 0;
    background: #313338;
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-radius 170ms ease, background 170ms ease, transform 170ms ease;
}

.guild-icon:hover,
.guild-icon.active {
    background: var(--brand);
    border-radius: 16px;
    transform: translateY(-1px);
}

.channels,
.users {
    background: var(--bg-panel);
    padding: 16px 10px;
}

.channels {
    border-right: 1px solid #232428;
}

.users {
    border-left: 1px solid #232428;
}

.panel-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.panel-title-spaced {
    margin-top: 18px;
}

.channel-group {
    margin-bottom: 20px;
}

.channel-group-title {
    font-size: 12px;
    color: #cad0db;
    margin-bottom: 6px;
}

.channel-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: #b5bac1;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 500;
    margin-bottom: 4px;
    cursor: pointer;
}

.channel-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.channel-item.active {
    background: var(--bg-active);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px #4a4d55;
}

.chat {
    background: var(--bg-chat);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: #2f3136;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logout-button {
    border: 1px solid #444953;
    border-radius: 8px;
    background: #25282e;
    color: #e6e9ef;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    cursor: pointer;
}

.header-logout-button:hover {
    background: #30343b;
}

.chat-title {
    font-size: 17px;
    line-height: 1.2;
}

.chat-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
}

.primary-action {
    border: 0;
    border-radius: 8px;
    background: #2f9f67;
    color: #f5fff9;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
}

.primary-action:hover {
    background: #2a8f5d;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    min-height: 0;
}

.message {
    display: flex;
    gap: 12px;
    padding: 2px 8px;
    margin: 0 -8px 2px;
    border-radius: 6px;
}

.message:hover {
    background: #2e3035;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.message .avatar {
    cursor: pointer;
}

.customer-avatar {
    background: #6674bb;
}

.staff-avatar {
    background: #49a070;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.message-content {
    min-width: 0;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.message-author {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.message-author-link {
    cursor: pointer;
}

.message-author-link:hover {
    text-decoration: underline;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border-radius: 5px;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.role-badge-app {
    background: #5865f2;
}

.role-badge-tcs {
    background: #3a3f50;
}

.user-card-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(4, 8, 22, 0.45);
    z-index: 80;
}

.user-card-overlay[hidden] {
    display: none !important;
}

.user-card {
    --user-card-banner-height: 88px;
    width: min(320px, 92vw);
    min-height: 250px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #2b3357;
    background: #1a213e;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
    position: relative;
}

.user-card-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #4a2550;
    background: #331b37;
    color: #f1ddff;
    cursor: pointer;
    z-index: 1;
}

.user-card-banner {
    height: var(--user-card-banner-height);
    background: linear-gradient(125deg, #6f8fff 0%, #5f78df 52%, #4f67c5 100%);
}

.user-card-separator {
    position: relative;
    height: 0;
}

.user-card-body {
    position: relative;
    padding: 0 18px 18px;
}

.user-card-avatar {
    width: 96px;
    height: 96px;
    margin-top: -48px;
    border-radius: 50%;
    border: 5px solid #1a213e;
    background: #2a3462;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}

.user-card-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-card-nick {
    margin-top: 10px;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 800;
    color: #ffffff;
}

.user-card-username-row {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
}

.user-card-username {
    font-size: 17px;
    color: #f1f4ff;
    line-height: 1.15;
}

#user-card-badge-slot {
    position: absolute;
    top: 6px;
    right: 18px;
    z-index: 2;
    pointer-events: none;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-content p {
    color: #dbdee1;
    line-height: 1.45;
    font-size: 13px;
}

.message-extra {
    margin-top: 6px;
    display: grid;
    gap: 6px;
}

.embed-card {
    border-left: 3px solid #5865f2;
    background: #262930;
    border-radius: 6px;
    padding: 8px 10px;
    max-width: min(680px, 100%);
}

.embed-title {
    color: #8ea1ff;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
}

.embed-title:hover {
    text-decoration: underline;
}

.embed-description {
    margin-top: 4px;
    color: #cfd4e0;
    white-space: pre-wrap;
    line-height: 1.4;
    font-size: 13px;
}

.embed-link {
    color: #8ea1ff;
    text-decoration: none;
    font-size: 13px;
    word-break: break-word;
}

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

.attachment-link {
    color: #8ea1ff;
    text-decoration: none;
    font-size: 13px;
    word-break: break-word;
}

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

.attachment-image {
    max-width: min(560px, 100%);
    max-height: 360px;
    border-radius: 8px;
    border: 1px solid #3f424a;
    background: #1f2126;
}

.message-input {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border);
    background: #2f3136;
}

.message-input input,
.message-input textarea {
    width: 100%;
    border: 1px solid #3a3d44;
    background: #383a40;
    color: var(--text-main);
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
}

.message-input input:focus,
.message-input textarea:focus {
    border-color: #7a88ff;
}

.message-input button {
    border: 0;
    border-radius: 10px;
    padding: 0 16px;
    background: var(--brand);
    color: #f8f9ff;
    font-weight: 600;
    cursor: pointer;
}

.message-input button:hover {
    background: #4458c8;
}

.user-list {
    list-style: none;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    color: #dbdee1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
}

.user-item-empty {
    cursor: default;
}

.user-item:hover {
    background: var(--bg-hover);
}

.user-item-avatar-wrap {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 28px;
}

.user-item-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-item-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2e3863;
    color: #e8ecff;
    font-size: 12px;
    font-weight: 700;
}

.user-item-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
    align-self: center;
}

.status-dot.online {
    background: var(--online);
}

.status-dot.away {
    background: var(--away);
}

.status-dot.offline {
    background: var(--offline);
}

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

.logout-form {
    margin-bottom: 12px;
}

.logout-button {
    width: 100%;
    border: 1px solid #434750;
    border-radius: 8px;
    background: #25272c;
    color: #dcdee2;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.logout-button:hover {
    background: #2f3238;
}

/* Discord-like app skin */
body {
    background:
        radial-gradient(circle at 18% 14%, rgba(80, 99, 255, 0.22) 0%, rgba(80, 99, 255, 0) 42%),
        radial-gradient(circle at 88% 86%, rgba(51, 96, 255, 0.17) 0%, rgba(51, 96, 255, 0) 40%),
        #090d1a;
}

.app {
    height: calc(100dvh - 20px);
    width: calc(100vw - 20px);
    margin: 10px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #242a48;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
    grid-template-columns: 72px 280px minmax(0, 1fr) 270px;
}

.guilds {
    background: linear-gradient(180deg, #0f1428 0%, #0b1020 100%);
    border-right: 1px solid #1d2544;
    padding: 10px 10px 14px;
}

.guilds-header {
    display: none;
}

#guild-list {
    display: grid;
    gap: 10px;
}

.guild-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: #1a2140;
    border: 1px solid #263157;
}

.guild-icon:hover,
.guild-icon.active {
    background: #3342b6;
    border-color: #4657de;
    border-radius: 14px;
}

.channels {
    background: linear-gradient(180deg, #12192e 0%, #111729 100%);
    border-right: 1px solid #1d2544;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.channel-serverbar {
    height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    font-size: 19px;
    font-weight: 800;
    border-bottom: 1px solid #1c2442;
    background: #141c34;
}

.channel-serverbar-logo {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

.panel-title {
    padding: 16px 14px 8px;
    margin: 0;
    color: #8d97bc;
}

.channel-list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 10px;
}

.channel-item {
    margin: 0 8px 4px;
    border-radius: 8px;
    color: #aeb6d0;
    font-size: 13px;
    line-height: 1.2;
}

.chat {
    background:
        radial-gradient(circle at 25% 50%, rgba(50, 72, 196, 0.2) 0%, rgba(50, 72, 196, 0) 56%),
        #0d1122;
}

.chat-header {
    height: 52px;
    padding: 0 14px;
    background: rgba(11, 15, 29, 0.85);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid #1b2240;
}

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

.chat-header-right {
    display: flex;
    align-items: center;
}

.chat-channel-hash {
    color: #7f88aa;
    font-size: 24px;
    font-weight: 700;
}

.chat-title {
    font-size: 17px;
}

.chat-subtitle {
    margin-top: 0;
    color: #909aba;
    font-size: 12px;
}

.chat-search {
    width: 290px;
    border: 1px solid #242d52;
    border-radius: 8px;
    background: #0f152b;
    color: #cdd4ee;
    padding: 8px 11px;
    outline: none;
}

.chat-search:focus {
    border-color: #4f63e4;
}

.message-list {
    padding: 14px 22px;
}

.message:hover {
    background: #171d35;
}

.message-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0d1230;
    border-top: 1px solid #1f284c;
    padding: 10px 12px;
}

.message-input input,
.message-input textarea {
    flex: 1 1 auto;
    min-width: 0;
    background: #101738;
    border-color: #29335c;
    height: 38px;
    border-radius: 10px;
    padding: 0 12px;
}

.message-input textarea {
    height: auto;
    min-height: 38px;
    max-height: 132px;
    padding: 9px 12px;
    line-height: 1.35;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
}

.send-button {
    flex: 0 0 66px;
    min-width: 66px;
    max-width: 66px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #5865f2;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.send-button:hover:not(:disabled) {
    background: #4752c4;
}

.send-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.users {
    background: linear-gradient(180deg, #11182f 0%, #10172c 100%);
    border-left: 1px solid #1d2544;
}

.user-item:hover {
    background: #19223f;
}

.sidebar-footer {
    margin-top: auto;
    position: sticky;
    bottom: 0;
    border-top: 1px solid #1d2544;
    padding: 10px;
    background: #121a31;
    z-index: 2;
}

.sidebar-connection-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-connection-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #dce2fb;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-logout-form {
    margin-top: 8px;
}

.sidebar-logout-button {
    width: 100%;
    border: 1px solid #374067;
    border-radius: 8px;
    background: #1a2342;
    color: #dce2fb;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.sidebar-logout-button:hover {
    background: #202b4f;
}

.login-wrap {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 12% 18%, rgba(88, 101, 242, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 88% 80%, rgba(45, 139, 255, 0.16) 0%, transparent 42%),
        #1d1f24;
    padding: 28px;
}

.login-shell {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    background: #2b2d31;
    border: 1px solid #3a3d44;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

.login-hero {
    position: relative;
    padding: 34px 30px;
    background:
        linear-gradient(135deg, #2b3d83 0%, #2a2f57 36%, #262a34 100%);
    border-right: 1px solid #30354f;
}

.login-logo-block {
    position: relative;
    z-index: 2;
}

.login-logo {
    width: 68px;
    height: 68px;
    border-radius: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 24px rgba(8, 8, 20, 0.3);
}

.login-kicker {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #b9c7ff;
    margin-bottom: 10px;
}

.login-hero h1 {
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: #ffffff;
}

.login-subtitle {
    color: #d2d9f8;
    max-width: 35ch;
    font-size: 15px;
    line-height: 1.5;
}

.login-hero-glow {
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(88, 101, 242, 0.45) 0%, rgba(88, 101, 242, 0) 70%);
}

.login-brand-bottom {
    position: absolute;
    left: 30px;
    bottom: 24px;
    z-index: 2;
    margin: 0;
    padding: 0;
}

.login-card {
    padding: 34px 30px;
    background: #2b2d31;
}

.login-card h2 {
    font-size: 30px;
    line-height: 1.15;
    margin-bottom: 8px;
}

.login-card-subtitle {
    color: #b7bec9;
    margin-bottom: 18px;
    line-height: 1.45;
}

.login-error {
    border: 1px solid #6c3b3b;
    background: #3f2626;
    color: #ffd8d8;
    border-radius: 8px;
    padding: 9px 10px;
    margin-bottom: 12px;
    font-size: 14px;
}

.login-form {
    display: grid;
    gap: 11px;
}

.login-form label {
    font-size: 13px;
    color: #d2d7df;
    font-weight: 600;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    border: 1px solid #424752;
    background: #1f2126;
    color: #f1f2f5;
    border-radius: 8px;
    padding: 11px 12px;
    font-size: 14px;
    outline: none;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: #707fff;
}

.login-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 8px;
    color: #c5cbd4;
}

.login-check input {
    width: 14px;
    height: 14px;
}

.login-form button {
    border: 0;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    padding: 11px 12px;
    cursor: pointer;
}

.login-form button:hover {
    background: #4b59df;
}

@media (max-width: 860px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-hero {
        border-right: 0;
        border-bottom: 1px solid #343851;
    }

    .login-hero h1 {
        font-size: 29px;
    }

    .login-card h2 {
        font-size: 26px;
    }
}

@media (max-width: 1100px) {
    .app {
        grid-template-columns: 76px 230px 1fr;
    }

    .users {
        display: none;
    }
}

@media (max-width: 820px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .guilds,
    .users {
        display: none;
    }

    .channels {
        border-bottom: 1px solid var(--border);
        padding-bottom: 10px;
        max-height: 220px;
    }

    .chat-header {
        padding: 12px;
    }

    .message-list {
        padding: 12px;
    }

    .message-input {
        padding: 10px 12px 12px;
    }
}
