:root {
    --bg-app: #202225;
    --bg-rail: #191b1f;
    --bg-sidebar: #24272c;
    --bg-main: #2b2f35;
    --bg-surface: #30343b;
    --bg-surface-hover: #373c44;
    --bg-input: #1f2227;
    --line-soft: #3b4048;
    --line-strong: #4a505a;
    --text-main: #f1f3f5;
    --text-muted: #b8bec8;
    --text-dim: #858d9a;
    --pastel-lavender: #b8a7e8;
    --pastel-sky: #9fc7e8;
    --pastel-sage: #9dccb5;
    --pastel-peach: #e8b69f;
    --danger: #e69aa5;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-main);
    background: var(--bg-app);
}

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

a:hover {
    color: var(--text-main);
}

img {
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

.app-body {
    display: flex;
    flex-direction: column;
}

.page-host {
    width: 100%;
}

.page-host-standard {
    min-height: calc(100vh - 64px);
    padding: 24px;
}

.page-host-chat {
    min-height: 100vh;
    padding: 0;
}

.topbar {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    background: var(--bg-rail);
    border-bottom: 1px solid var(--line-soft);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark,
.server-pill {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--pastel-lavender);
    color: #181a1f;
    font-weight: 800;
}

.brand-lockup strong {
    display: block;
    line-height: 1.1;
}

.brand-lockup small {
    display: block;
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.2;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 0.58rem 0.9rem;
    font-weight: 700;
    line-height: 1.1;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn:hover,
.btn:focus {
    color: var(--text-main);
}

.btn-primary {
    background: var(--pastel-lavender);
    border-color: var(--pastel-lavender);
    color: #17191e;
}

.btn-primary:hover,
.btn-primary:focus {
    background: #c5b6ef;
    border-color: #c5b6ef;
    color: #17191e;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--line-soft);
}

.btn-ghost:hover,
.btn-ghost:focus {
    background: var(--bg-surface-hover);
    border-color: var(--line-strong);
    color: var(--text-main);
}

.btn-danger-soft {
    background: rgba(230, 154, 165, 0.12);
    color: #f1c6cc;
    border-color: rgba(230, 154, 165, 0.4);
}

.btn-danger-soft:hover,
.btn-danger-soft:focus {
    background: rgba(230, 154, 165, 0.18);
    color: #ffe1e5;
}

.btn-sm {
    min-height: 32px;
    padding: 0.45rem 0.7rem;
    font-size: 0.86rem;
}

.btn-lg {
    min-height: 44px;
    padding: 0.72rem 1rem;
}

.w-100 {
    width: 100%;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.muted-copy,
.attachment-label,
.request-id,
.profile-inline span,
.section-heading,
.dm-meta span,
.voice-room-meta span {
    color: var(--text-muted);
}

.landing-shell,
.auth-page {
    min-height: calc(100vh - 112px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-hero {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) 280px;
    gap: 16px;
}

.hero-copy,
.hero-panel,
.auth-card,
.panel-surface {
    background: var(--bg-sidebar);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.hero-copy {
    padding: 28px;
}

.hero-copy h1,
.auth-card h1,
.server-overview h2,
.chat-header h1 {
    margin: 0;
    font-weight: 800;
    letter-spacing: 0;
}

.hero-copy h1 {
    max-width: 720px;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.02;
}

.hero-copy .muted-copy {
    max-width: 640px;
    margin: 14px 0 0;
    line-height: 1.65;
}

.hero-panel {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.stat-card {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--bg-surface);
}

.stat-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.stat-card strong {
    font-size: 1.9rem;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.auth-card {
    width: min(420px, 100%);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.auth-card-wide {
    width: min(620px, 100%);
}

.auth-card h1 {
    font-size: 1.65rem;
}

.auth-card .muted-copy {
    margin: 8px 0 0;
}

.auth-form {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.auth-form-grid {
    grid-template-columns: 1fr 1fr;
}

.form-span-2 {
    grid-column: 1 / -1;
}

.form-field {
    display: grid;
    gap: 7px;
}

.form-field label,
.check-row {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.form-control,
.status-select,
.composer-input {
    width: 100%;
    min-height: 42px;
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 0.7rem 0.78rem;
}

.form-control:focus,
.status-select:focus,
.composer-input:focus {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--pastel-sky);
    box-shadow: 0 0 0 0.15rem rgba(159, 199, 232, 0.16);
}

.form-control::placeholder,
.composer-input::placeholder {
    color: var(--text-dim);
}

.form-control[type="file"] {
    padding: 0.55rem 0.7rem;
}

.validation-summary-errors,
.text-danger {
    color: #f0b6be !important;
    font-size: 0.88rem;
}

.auth-footer {
    margin: 18px 0 0;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--pastel-sky);
    font-weight: 700;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    accent-color: var(--pastel-lavender);
}

.success-banner {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: rgba(157, 204, 181, 0.13);
    color: #cfe9dc;
    border: 1px solid rgba(157, 204, 181, 0.28);
}

.profile-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-top: 16px;
    border-radius: var(--radius);
    background: var(--bg-surface);
}

.profile-preview-avatar,
.avatar {
    border-radius: var(--radius);
    object-fit: cover;
    background: var(--bg-input);
}

.profile-preview-avatar,
.avatar-lg {
    width: 56px;
    height: 56px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
}

.discord-shell {
    display: grid;
    grid-template-columns: 72px 252px minmax(0, 1fr) 280px;
    min-height: 100vh;
    background: var(--bg-main);
}

.server-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    background: var(--bg-rail);
    border-right: 1px solid #15171a;
}

.server-rail .server-pill {
    width: 48px;
    height: 48px;
}

.sidebar-left,
.sidebar-right {
    min-height: 0;
    overflow-y: auto;
    background: var(--bg-sidebar);
}

.sidebar-left {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line-soft);
}

.sidebar-right {
    border-left: 1px solid var(--line-soft);
}

.server-overview {
    padding: 16px;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    border-radius: 0;
    background: transparent;
}

.server-overview h2 {
    font-size: 1.05rem;
}

.sidebar-section,
.current-user-card,
.voice-control-panel {
    padding: 14px;
}

.sidebar-section.panel-surface,
.current-user-card.panel-surface,
.voice-control-panel.panel-surface {
    border: 0;
    border-radius: 0;
    background: transparent;
}

.channel-tile,
.dm-tile,
.voice-room-tile,
.member-tile,
.notification-tile {
    width: 100%;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
}

.channel-tile,
.dm-tile,
.voice-room-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    text-align: left;
}

.channel-tile:hover,
.dm-tile:hover,
.voice-room-tile:hover,
.member-tile:hover,
.notification-tile:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.channel-tile.active,
.dm-tile.active,
.voice-room-tile.active {
    background: var(--bg-surface);
    color: var(--text-main);
}

.channel-prefix {
    width: 20px;
    color: var(--text-dim);
    font-weight: 800;
    text-align: center;
}

.stack-list {
    display: grid;
    gap: 4px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.count-badge {
    min-width: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    text-align: center;
    background: var(--pastel-peach);
    color: #1b1b1f;
    font-size: 0.75rem;
    font-weight: 800;
}

.mini-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    margin-bottom: 10px;
}

.chat-main {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    overflow: hidden;
    background: var(--bg-main);
    border: 0;
    border-radius: 0;
}

.chat-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--bg-main);
}

.chat-header h1 {
    font-size: 1.08rem;
}

.chat-header .muted-copy,
.chat-header .eyebrow {
    display: none;
}

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

.status-select {
    width: auto;
    min-width: 142px;
}

.message-list {
    min-height: 0;
    overflow-y: auto;
    display: grid;
    align-content: start;
    gap: 2px;
    padding: 14px 18px 10px;
}

.message-empty,
.list-empty {
    padding: 12px;
    border-radius: var(--radius);
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
}

.message-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 8px 6px;
    border-radius: var(--radius);
}

.message-card:hover {
    background: rgba(255, 255, 255, 0.025);
}

.message-bubble {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.message-card.own .message-meta strong {
    color: var(--pastel-sky);
}

.message-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.message-meta strong {
    font-size: 0.95rem;
}

.message-time,
.message-edited,
.read-badge {
    color: var(--text-dim);
    font-size: 0.76rem;
}

.message-body {
    color: #e8ebef;
    line-height: 1.5;
    word-break: break-word;
}

.message-deleted {
    color: var(--text-dim);
    font-style: italic;
}

.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.message-actions button {
    min-height: 28px;
    background: var(--bg-surface);
    color: var(--text-muted);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.55rem;
    font-size: 0.8rem;
}

.message-actions button:hover {
    background: var(--bg-surface-hover);
    color: var(--text-main);
}

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: min(420px, 100%);
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    background: var(--bg-surface);
    border: 1px solid var(--line-soft);
}

.message-attachment img {
    width: 180px;
    border-radius: var(--radius);
    display: block;
}

.mention {
    color: #d8d1f5;
    background: rgba(184, 167, 232, 0.18);
    padding: 0 0.24rem;
    border-radius: 4px;
    font-weight: 700;
}

.typing-indicator {
    min-height: 24px;
    color: var(--text-muted);
    padding: 0 18px 6px;
    font-size: 0.88rem;
}

.composer {
    display: grid;
    gap: 8px;
    padding: 12px 18px 18px;
}

.composer-tools {
    display: flex;
    justify-content: flex-end;
}

.composer-input {
    min-height: 88px;
    resize: vertical;
}

.composer-footer,
.voice-actions,
.profile-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.profile-inline {
    justify-content: flex-start;
}

.member-tile,
.notification-tile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}

.member-status,
.dm-status {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

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

.status-idle {
    background: var(--pastel-peach);
}

.status-donotdisturb {
    background: var(--danger);
}

.status-offline {
    background: #68707c;
}

.notification-tile {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
}

.notification-unread {
    background: rgba(184, 167, 232, 0.1);
    color: var(--text-main);
}

.notification-tile p,
.notification-tile strong,
.notification-tile small {
    margin: 0;
}

.remote-audio-host {
    display: none;
}

.voice-room-meta,
.dm-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.voice-room-meta {
    flex: 1;
}

.voice-room-meta strong,
.dm-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-room-members {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.voice-room-member {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}

.current-user-card {
    display: grid;
    gap: 12px;
    border-top: 1px solid var(--line-soft) !important;
}

.voice-control-panel {
    display: grid;
    gap: 10px;
}

.toast-stack {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1080;
    display: grid;
    gap: 8px;
}

.live-toast {
    padding: 10px 12px;
    border-radius: var(--radius);
    background: #323740;
    color: var(--text-main);
    border: 1px solid var(--line-soft);
    box-shadow: var(--shadow-soft);
}

.live-toast-error {
    border-color: rgba(230, 154, 165, 0.45);
    color: #f4c8ce;
}

@media (max-width: 1180px) {
    .discord-shell {
        grid-template-columns: 72px 244px minmax(0, 1fr);
    }

    .sidebar-right {
        display: none;
    }
}

@media (max-width: 900px) {
    .landing-hero,
    .auth-form-grid {
        grid-template-columns: 1fr;
    }

    .discord-shell {
        grid-template-columns: 64px minmax(0, 1fr);
    }

    .sidebar-left {
        display: none;
    }
}

@media (max-width: 720px) {
    .topbar {
        height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 14px;
    }

    .page-host-standard {
        min-height: auto;
        padding: 14px;
    }

    .landing-shell,
    .auth-page {
        min-height: calc(100vh - 120px);
    }

    .hero-copy,
    .auth-card {
        padding: 18px;
    }

    .chat-header,
    .composer-footer,
    .voice-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-header-actions {
        justify-content: space-between;
    }

    .status-select {
        flex: 1;
    }

    .message-list {
        padding-inline: 12px;
    }

    .composer {
        padding-inline: 12px;
    }
}
