/* ==========================================================================
   Nebula Chat — Discord-inspired UI
   ========================================================================== */

:root {
    --bg: #1e1f22;
    --bg-deep: #151619;
    --sidebar: #2b2d31;
    --sidebar-deep: #232428;
    --panel: #313338;
    --panel-raised: #383a40;
    --panel-soft: #3a3c42;
    --input: #1e1f22;
    --text: #f2f3f5;
    --text-soft: #dbdee1;
    --muted: #b5bac1;
    --faint: #949ba4;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .12);
    --blurple: #5865f2;
    --blurple-hover: #4752c4;
    --blurple-soft: rgba(88, 101, 242, .16);
    --green: #23a55a;
    --green-soft: rgba(35, 165, 90, .15);
    --yellow: #f0b232;
    --red: #f23f43;
    --red-soft: rgba(242, 63, 67, .13);
    --pink: #eb459e;
    --shadow: 0 18px 55px rgba(0, 0, 0, .35);
    --radius: 12px;
    --font: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
    --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.modal-open {
    overflow: hidden;
}

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

button {
    cursor: pointer;
}

a {
    color: var(--blurple);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4,
p {
    margin: 0;
}

svg {
    fill: currentColor;
    display: block;
}

code {
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .3);
    color: #c9cdfb;
    font-family: var(--mono);
    font-size: .9em;
}

.hidden {
    display: none !important;
}

.mobile-only,
.menu-toggle {
    display: none !important;
}

[hidden] {
    display: none !important;
}

::selection {
    background: rgba(88, 101, 242, .45);
    color: #fff;
}

/* Scrollbars ------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: #1a1b1e transparent;
}

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

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

*::-webkit-scrollbar-thumb {
    background: #1a1b1e;
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: #111214;
    background-clip: content-box;
}

/* Boot ------------------------------------------------------------------- */
.noscript-note {
    position: relative;
    z-index: 500;
    padding: 12px 18px;
    background: #7a2e31;
    color: #fff;
    font-size: 13px;
    text-align: center;
}

.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background:
        radial-gradient(ellipse at 30% 15%, rgba(88, 101, 242, .18), transparent 48%),
        radial-gradient(ellipse at 80% 85%, rgba(235, 69, 158, .10), transparent 45%),
        var(--bg-deep);
    transition: opacity .3s ease, visibility .3s ease;
}

.boot-screen.is-done {
    opacity: 0;
    visibility: hidden;
}

.boot-logo {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: linear-gradient(145deg, #7a86ff, #5865f2 55%, #4752c4);
    color: #fff;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.04em;
    box-shadow: 0 12px 40px rgba(88, 101, 242, .4);
}

.boot-screen p {
    color: var(--faint);
    font-size: 13px;
    letter-spacing: .04em;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, .13);
    border-top-color: var(--blurple);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Brand ------------------------------------------------------------------ */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #7a86ff, #5865f2 58%, #4752c4);
    color: #fff;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.04em;
    box-shadow: 0 5px 16px rgba(88, 101, 242, .28);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
    min-width: 0;
}

.brand-text strong {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .01em;
}

.brand-text small {
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .22em;
}

.brand-large .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    font-size: 24px;
}

.brand-large .brand-text strong {
    font-size: 20px;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--panel-raised);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background .16s ease, border-color .16s ease, transform .16s ease, color .16s ease;
}

.btn:hover {
    background: #43454c;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--blurple);
    color: #fff;
    box-shadow: 0 4px 16px rgba(88, 101, 242, .22);
}

.btn-primary:hover {
    background: var(--blurple-hover);
}

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

.btn-ghost:hover {
    background: rgba(255, 255, 255, .06);
}

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-danger:hover {
    background: #d83c3f;
}

.btn-small {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 7px;
}

.btn-block {
    width: 100%;
    min-height: 44px;
    font-size: 15px;
}

.icon-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transition: background .15s ease, color .15s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .07);
    color: var(--text);
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.icon-btn.small {
    width: 28px;
    height: 28px;
    font-size: 18px;
}

/* Forms ------------------------------------------------------------------ */
.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.field > span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    outline: none;
    background: var(--input);
    color: var(--text);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
    height: 42px;
    padding: 0 12px;
}

textarea {
    padding: 11px 12px;
    resize: vertical;
    min-height: 88px;
    line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
    color: #6d6f78;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--blurple);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, .18);
}

input[type="color"] {
    width: 48px;
    height: 38px;
    padding: 3px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--input);
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blurple);
    cursor: pointer;
}

.form-error {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(242, 63, 67, .25);
    border-radius: 8px;
    background: var(--red-soft);
    color: #ffb3b5;
    font-size: 13px;
}

.form-note {
    color: var(--faint);
    font-size: 12px;
    line-height: 1.6;
}

/* Authentication --------------------------------------------------------- */
.auth-shell {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px 28px;
    background:
        radial-gradient(ellipse at 12% 12%, rgba(88, 101, 242, .13), transparent 43%),
        radial-gradient(ellipse at 93% 82%, rgba(235, 69, 158, .08), transparent 40%),
        #17181b;
}

.auth-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.auth-glow-a {
    width: 380px;
    height: 380px;
    top: -160px;
    left: 18%;
    background: rgba(88, 101, 242, .2);
}

.auth-glow-b {
    width: 320px;
    height: 320px;
    right: 8%;
    bottom: -150px;
    background: rgba(235, 69, 158, .12);
}

.auth-layout {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, 440px);
    align-items: center;
    gap: clamp(40px, 7vw, 100px);
}

.auth-hero {
    position: relative;
    padding: 20px 0 150px;
    animation: fade-up .55s ease both;
}

.auth-hero h1 {
    margin-top: 38px;
    font-size: clamp(38px, 4.6vw, 60px);
    line-height: 1.12;
    letter-spacing: -.035em;
    font-weight: 800;
}

.auth-hero h1 span {
    background: linear-gradient(100deg, #aab2ff, #5865f2 45%, #eb459e);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-lead {
    max-width: 470px;
    margin-top: 22px;
    color: var(--faint);
    font-size: 15px;
    line-height: 1.75;
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 26px;
}

.feature-pills span {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, .025);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .02em;
}

.auth-art {
    position: absolute;
    left: 40px;
    bottom: 0;
    width: 260px;
    height: 150px;
    pointer-events: none;
    opacity: .8;
}

.orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
}

.orbit-one {
    width: 210px;
    height: 210px;
    left: 20px;
    top: -36px;
    border-color: rgba(88, 101, 242, .28);
    animation: orbit-spin 24s linear infinite;
}

.orbit-two {
    width: 138px;
    height: 138px;
    left: 56px;
    top: 0;
    border-color: rgba(235, 69, 158, .22);
    animation: orbit-spin 18s linear infinite reverse;
}

.orbit-core {
    position: absolute;
    left: 95px;
    top: 38px;
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #7c87ff, #4c57c8);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    box-shadow: 0 0 45px rgba(88, 101, 242, .45);
}

@keyframes orbit-spin {
    to { transform: rotate(360deg); }
}

.auth-card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(43, 45, 49, .82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    animation: pop-in .45s ease both;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 24px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .22);
}

.auth-tab {
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--faint);
    font-size: 13.5px;
    font-weight: 700;
    transition: background .16s ease, color .16s ease;
}

.auth-tab:hover {
    color: var(--text-soft);
}

.auth-tab.active {
    background: var(--panel-raised);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-heading {
    margin-bottom: 2px;
}

.form-heading h2 {
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.form-heading p {
    margin-top: 5px;
    color: var(--faint);
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.auth-footnote {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: #777c85;
    font-size: 11.5px;
    line-height: 1.7;
}

/* App shell -------------------------------------------------------------- */
.app {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr) 252px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--panel);
}

/* Sidebar ---------------------------------------------------------------- */
.sidebar {
    z-index: 40;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--sidebar);
    border-right: 1px solid rgba(0, 0, 0, .18);
}

.server-head {
    height: 58px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px 0 14px;
    border-bottom: 1px solid rgba(0, 0, 0, .22);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .02);
}

.server-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.sidebar-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 8px 18px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px 7px 10px;
    color: var(--faint);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.room-row {
    position: relative;
    display: flex;
    min-width: 0;
}

.room-row .room-item {
    flex: 1 1 auto;
    min-width: 0;
}

.room-delete {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #7d828b;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity .12s ease, background .12s ease, color .12s ease;
}

.room-row:hover .room-delete,
.room-delete:focus-visible {
    opacity: 1;
}

.room-delete:hover {
    background: var(--red-soft);
    color: #ff9a9c;
}

.room-row.with-action:hover .room-count,
.room-row.with-action:focus-within .room-count {
    opacity: 0;
}

.room-count {
    transition: opacity .12s ease;
}

.room-item {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--faint);
    text-align: left;
    transition: background .13s ease, color .13s ease;
}

.room-item:hover {
    background: rgba(255, 255, 255, .045);
    color: var(--text-soft);
}

.room-item.active {
    background: rgba(255, 255, 255, .08);
    color: var(--text);
}

.room-item .room-hash {
    width: 16px;
    flex: 0 0 auto;
    color: #80848e;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

.room-item.active .room-hash {
    color: var(--text-soft);
}

.room-item .room-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.room-item .room-count {
    flex: 0 0 auto;
    color: #6d7078;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

.sidebar-empty {
    padding: 14px 10px;
    color: #6f737c;
    font-size: 12px;
    line-height: 1.6;
}

.user-bar {
    flex: 0 0 auto;
    height: 62px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--sidebar-deep);
    border-top: 1px solid rgba(0, 0, 0, .18);
}

.user-identity {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 6px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    text-align: left;
}

.user-identity:hover {
    background: rgba(255, 255, 255, .05);
}

.avatar {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: var(--blurple);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    user-select: none;
    text-transform: uppercase;
}

.avatar-small {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.avatar-tiny {
    width: 25px;
    height: 25px;
    font-size: 10.5px;
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.25;
}

.user-meta strong {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta small {
    overflow: hidden;
    margin-top: 2px;
    color: var(--faint);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.role-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px rgba(35, 165, 90, .13);
}

.sidebar-backdrop {
    display: none;
}

/* Chat ------------------------------------------------------------------- */
.chat-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: var(--panel);
}

.topbar {
    height: 58px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .02);
}

.room-heading {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.room-heading .hash {
    color: #80848e;
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
}

.room-heading h1 {
    overflow: hidden;
    max-width: 100%;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.01em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-meta {
    overflow: hidden;
    margin-left: 4px;
    color: #777c85;
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

#toggle-members-btn {
    display: none;
}

/* Messages --------------------------------------------------------------- */
.message-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 20px 8px;
    scroll-behavior: auto;
}

.channel-intro {
    max-width: 880px;
    margin: 18px auto 12px;
    padding: 0 8px 18px;
    border-bottom: 1px solid var(--line);
}

.channel-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 50%;
    background: var(--blurple-soft);
    color: #b9c0ff;
    font-size: 30px;
    font-weight: 500;
}

.channel-intro h2 {
    font-size: 27px;
    font-weight: 800;
    letter-spacing: -.025em;
}

.channel-intro p {
    margin-top: 6px;
    color: var(--faint);
    font-size: 13.5px;
    line-height: 1.65;
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 4px 0 14px;
}

.message-list {
    max-width: 960px;
    margin: 0 auto;
}

.message {
    position: relative;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 13px;
    padding: 7px 10px;
    border-radius: 7px;
    transition: background .12s ease;
}

.message:hover {
    background: rgba(0, 0, 0, .07);
}

.message.grouped {
    margin-top: -3px;
    padding-top: 2px;
    padding-bottom: 2px;
}

.message.grouped .message-avatar {
    visibility: hidden;
    height: 0;
}

.message-avatar {
    width: 42px;
    height: 42px;
    margin-top: 2px;
    border-radius: 50%;
    font-size: 16px;
}

.message-body {
    min-width: 0;
    padding-top: 1px;
}

.message-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 22px;
}

.message.grouped .message-head {
    display: none;
}

.author {
    color: var(--text);
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -.005em;
}

.title-badge {
    display: inline-block;
    max-width: 160px;
    overflow: hidden;
    padding: 1px 6px;
    border: 1px solid rgba(88, 101, 242, .35);
    border-radius: 4px;
    background: rgba(88, 101, 242, .15);
    color: #b9c0ff;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .03em;
    text-overflow: ellipsis;
    vertical-align: 1px;
    white-space: nowrap;
}

.title-badge.role-admin {
    border-color: rgba(240, 178, 50, .4);
    background: rgba(240, 178, 50, .12);
    color: #f5cd77;
}

.message-time {
    color: #7c818a;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.msg-delete {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    margin-left: 2px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #8a8f98;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity .12s ease, background .12s ease, color .12s ease;
}

.message:hover .msg-delete,
.msg-delete:focus-visible {
    opacity: 1;
}

.msg-delete:hover {
    background: var(--red-soft);
    color: #ff9a9c;
}

.message-text {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 14.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message.grouped .message-text {
    margin-top: 0;
}

.empty-state {
    max-width: 420px;
    margin: 16vh auto 0;
    padding: 20px;
    color: var(--faint);
    text-align: center;
}

.empty-icon {
    width: 60px;
    height: 60px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
    color: #8f95a0;
    font-size: 28px;
}

.empty-state h3 {
    color: var(--text-soft);
    font-size: 18px;
}

.empty-state p {
    margin-top: 6px;
    font-size: 13px;
}

/* Composer --------------------------------------------------------------- */
.composer {
    flex: 0 0 auto;
    padding: 8px 20px 18px;
}

.composer-box {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 9px 10px 9px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--panel-raised);
    transition: border-color .16s ease, box-shadow .16s ease;
}

.composer-box:focus-within {
    border-color: rgba(88, 101, 242, .55);
    box-shadow: 0 0 0 1px rgba(88, 101, 242, .12);
}

.composer-box textarea {
    flex: 1 1 auto;
    min-height: 24px;
    max-height: 170px;
    padding: 3px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    resize: none;
    color: var(--text);
    line-height: 1.5;
}

.composer-box textarea:focus {
    border: 0;
    box-shadow: none;
}

.composer-side {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-count {
    color: #777c85;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.char-count.warn {
    color: var(--yellow);
}

.char-count.danger {
    color: var(--red);
}

.send-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: var(--blurple);
    color: #fff;
    transition: background .15s ease, transform .15s ease, opacity .15s ease;
}

.send-btn svg {
    width: 17px;
    height: 17px;
    margin-right: 1px;
}

.send-btn:hover {
    background: var(--blurple-hover);
}

.send-btn:active {
    transform: scale(.94);
}

.send-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.composer-hint {
    max-width: 960px;
    margin: 6px auto 0;
    color: #6b6f78;
    font-size: 10.5px;
    text-align: right;
}

.composer-hint strong {
    color: #848993;
    font-weight: 600;
}

/* Members ---------------------------------------------------------------- */
.members-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--sidebar);
    border-left: 1px solid rgba(0, 0, 0, .16);
}

.members-head {
    height: 58px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 15px;
    border-bottom: 1px solid rgba(0, 0, 0, .2);
    color: var(--faint);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.members-head .icon-btn {
    margin-left: auto;
}

.count-pill {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
}

.member-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 9px 20px;
}

.member-group-title {
    padding: 14px 8px 6px;
    color: #777c85;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.member-group:first-child .member-group-title {
    padding-top: 2px;
}

.member-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    text-align: left;
}

.member-item:hover {
    background: rgba(255, 255, 255, .045);
    color: var(--text-soft);
}

.member-avatar-wrap {
    position: relative;
    flex: 0 0 auto;
}

.member-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
    filter: saturate(.9);
}

.member-item.offline .member-avatar {
    opacity: .42;
    filter: grayscale(.55);
}

.online-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 10px;
    height: 10px;
    border: 2px solid var(--sidebar);
    border-radius: 50%;
    background: var(--green);
}

.member-item.offline .online-dot {
    background: #747f8d;
}

.member-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.member-name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-title {
    overflow: hidden;
    margin-top: 1px;
    color: #777c85;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-role {
    margin-left: auto;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(240, 178, 50, .12);
    color: #e7bd68;
    font-size: 8.5px;
    font-weight: 800;
    letter-spacing: .04em;
}

.member-role.mod {
    background: rgba(35, 165, 90, .12);
    color: #6fd394;
}

.members-foot {
    flex: 0 0 auto;
    padding: 12px 15px;
    border-top: 1px solid rgba(0, 0, 0, .16);
    color: #686d76;
    font-size: 10px;
}

/* Modal ------------------------------------------------------------------ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(0, 0, 0, .62);
    backdrop-filter: blur(3px);
    animation: modal-fade .16s ease both;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    width: min(460px, 100%);
    max-height: calc(100vh - 44px);
    max-height: calc(100dvh - 44px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel);
    box-shadow: 0 25px 80px rgba(0, 0, 0, .5);
    animation: pop-in .18s ease both;
}

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

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 0;
}

.modal-head h2 {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.015em;
}

.modal-head p {
    margin-top: 5px;
    color: var(--faint);
    font-size: 12.5px;
    line-height: 1.55;
}

.modal-body {
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    padding: 0 22px 20px;
}

.modal-foot .danger-zone {
    margin-right: auto;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.color-field {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.color-field .field {
    flex: 1 1 auto;
}

.color-swatch {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--blurple);
}

.input-help {
    color: #777c85;
    font-size: 11px;
    line-height: 1.55;
}

.perm-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--input);
    color: var(--muted);
    font-size: 11.5px;
    cursor: pointer;
}

.perm-check input:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.perm-check:has(input:disabled) {
    opacity: .65;
}

.confirm-body {
    padding: 4px 22px 20px;
    color: var(--muted);
    font-size: 13.5px;
    line-height: 1.7;
}

/* Toast ------------------------------------------------------------------ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 200;
    max-width: min(440px, calc(100vw - 32px));
    padding: 11px 17px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #111214;
    color: var(--text-soft);
    font-size: 13px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, .4);
    transform: translateX(-50%);
    animation: toast-in .2s ease both;
}

.toast.success {
    border-color: rgba(35, 165, 90, .35);
    color: #9ce7b5;
}

.toast.error {
    border-color: rgba(242, 63, 67, .38);
    color: #ffb3b5;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-body {
    min-height: 100dvh;
    background:
        radial-gradient(ellipse at 10% 0%, rgba(88, 101, 242, .07), transparent 40%),
        var(--bg-deep);
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 28px;
    background: rgba(30, 31, 34, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.admin-topbar .brand:hover {
    text-decoration: none;
}

.admin-crumb {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-muted);
    font-size: 14px;
}

.admin-crumb strong {
    color: var(--text-primary);
    font-weight: 600;
}

.crumb-sep {
    color: #4e5158;
}

.admin-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.admin-self {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.admin-main {
    width: min(1280px, calc(100% - 56px));
    margin: 0 auto;
    padding: 40px 0 70px;
}

.admin-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    padding: 8px 0 32px;
}

.eyebrow {
    margin-bottom: 9px;
    color: #7c86ff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .2em;
}

.admin-hero h1 {
    font-size: clamp(30px, 3.6vw, 44px);
    font-weight: 800;
    letter-spacing: -.035em;
}

.admin-hero > div > p:not(.eyebrow) {
    max-width: 580px;
    margin-top: 10px;
    color: var(--faint);
    font-size: 13.5px;
    line-height: 1.7;
}

.stat-grid {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.stat-card {
    min-width: 106px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .025);
}

.stat-card span {
    display: block;
    color: #777c85;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    margin-top: 3px;
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.03em;
}

.admin-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 18px;
    padding-bottom: 1px;
    border-bottom: 1px solid var(--line);
}

.admin-tab {
    position: relative;
    padding: 11px 16px;
    border: 0;
    border-radius: 7px 7px 0 0;
    background: transparent;
    color: var(--faint);
    font-size: 13px;
    font-weight: 700;
}

.admin-tab:hover {
    background: rgba(255, 255, 255, .03);
    color: var(--text-soft);
}

.admin-tab.active {
    color: var(--text);
}

.admin-tab.active::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: -1px;
    left: 10px;
    height: 2px;
    border-radius: 2px;
    background: var(--blurple);
}

.admin-panel {
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(43, 45, 49, .72);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .12);
    animation: fade-up .2s ease both;
}

.panel-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin-bottom: 18px;
}

.panel-toolbar h2 {
    font-size: 16px;
    font-weight: 800;
}

.panel-toolbar p {
    margin-top: 4px;
    color: var(--faint);
    font-size: 12px;
}

.search-box {
    width: min(270px, 100%);
    height: 38px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--input);
    color: #6d7078;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.search-box:focus-within {
    border-color: var(--blurple);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, .14);
}

.search-box input[type="search"] {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 12.5px;
}

.search-box input[type="search"]:focus {
    box-shadow: none;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.select {
    width: auto;
    min-width: 145px;
    height: 38px;
    border: 1px solid var(--line);
    background: var(--input);
    font-size: 12.5px;
}

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

.inline-form input {
    width: 220px;
    height: 38px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.data-table th {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    background: rgba(0, 0, 0, .16);
    color: #7e838c;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table td {
    padding: 11px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .045);
    color: var(--muted);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, .022);
}

.align-right {
    text-align: right !important;
}

.table-loading {
    padding: 30px 12px !important;
    color: #777c85 !important;
    text-align: center;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 165px;
}

.table-avatar {
    width: 33px;
    height: 33px;
    font-size: 12px;
}

.table-name {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.table-name strong {
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 700;
}

.table-name small {
    margin-top: 2px;
    color: #737881;
    font-family: var(--mono);
    font-size: 10px;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(148, 155, 164, .12);
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.role-pill.admin {
    background: rgba(240, 178, 50, .12);
    color: #eac36d;
}

.role-pill.moderator {
    background: rgba(35, 165, 90, .12);
    color: #75d799;
}

.perm-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.perm-pill {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: #8c929b;
    font-size: 9px;
    white-space: nowrap;
}

.perm-pill.on {
    border-color: rgba(88, 101, 242, .3);
    background: rgba(88, 101, 242, .1);
    color: #aeb5ff;
}

.perm-pill.off {
    opacity: .55;
}

.number-cell {
    font-variant-numeric: tabular-nums;
}

.date-cell {
    color: #7a7f88 !important;
    font-size: 11px;
    white-space: nowrap;
}

.action-row {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.action-btn {
    min-height: 26px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(255, 255, 255, .06);
    color: var(--text);
}

.action-btn.danger:hover {
    border-color: rgba(242, 63, 67, .3);
    background: var(--red-soft);
    color: #ff9a9c;
}

.admin-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 11px;
}

.admin-room-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(0, 0, 0, .12);
    transition: border-color .15s ease, background .15s ease;
}

.admin-room-card:hover {
    border-color: var(--line-strong);
    background: rgba(0, 0, 0, .16);
}

.admin-room-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.admin-room-hash {
    color: #7c86ff;
    font-size: 20px;
    line-height: 1;
}

.admin-room-name {
    flex: 1 1 auto;
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-room-card p {
    margin-top: 7px;
    color: #777c85;
    font-size: 11px;
    line-height: 1.55;
}

.admin-room-stats {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
    color: #7a7f88;
    font-size: 10.5px;
}

.admin-room-actions {
    display: flex;
    gap: 5px;
    margin-top: 12px;
}

.admin-message-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.admin-message-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 11px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(0, 0, 0, .1);
}

.admin-message-card:hover {
    border-color: var(--line-strong);
}

.admin-message-body {
    min-width: 0;
}

.admin-message-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 7px;
}

.admin-message-head strong {
    color: var(--text-soft);
    font-size: 12px;
}

.admin-message-head span {
    color: #737881;
    font-size: 10px;
}

.admin-message-text {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.admin-message-actions {
    display: flex;
    align-items: flex-start;
}

.room-tag {
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(88, 101, 242, .1);
    color: #9da6ff;
    font-size: 9.5px;
    font-weight: 700;
}

.admin-empty {
    padding: 45px 20px;
    color: #777c85;
    font-size: 13px;
    text-align: center;
}

/* Responsive ------------------------------------------------------------- */
@media (max-width: 1120px) {
    .app {
        grid-template-columns: 246px minmax(0, 1fr) 224px;
    }

    .auth-layout {
        gap: 48px;
    }

    .admin-main {
        width: calc(100% - 36px);
    }
}

@media (max-width: 980px) {
    .app {
        grid-template-columns: 246px minmax(0, 1fr);
    }

    .members-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 70;
        width: 260px;
        border-left: 1px solid var(--line);
        box-shadow: -20px 0 50px rgba(0, 0, 0, .3);
        transform: translateX(105%);
        transition: transform .22s ease;
    }

    .members-panel.is-open {
        transform: translateX(0);
    }

    .mobile-only {
        display: inline-grid !important;
    }

    #toggle-members-btn {
        display: inline-flex;
    }
}

@media (max-width: 860px) {
    .auth-layout {
        grid-template-columns: 1fr;
        max-width: 450px;
    }

    .auth-hero {
        padding: 0;
    }

    .auth-hero h1 {
        margin-top: 20px;
        font-size: 34px;
    }

    .auth-lead,
    .feature-pills,
    .auth-art {
        display: none;
    }

    .auth-shell {
        padding: 28px 18px;
    }

    .admin-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 22px;
    }

    .panel-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 13px;
    }

    .toolbar-actions {
        justify-content: flex-start;
    }

    .inline-form {
        width: 100%;
    }

    .inline-form input {
        flex: 1 1 auto;
        width: auto;
    }
}

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

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 80;
        width: min(286px, 84vw);
        box-shadow: 20px 0 55px rgba(0, 0, 0, .4);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-grid !important;
    }

    .room-delete {
        opacity: .5;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 75;
        display: block;
        background: rgba(0, 0, 0, .55);
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
    }

    .sidebar-backdrop.show {
        opacity: 1;
        visibility: visible;
    }

    .topbar {
        padding: 0 11px;
        gap: 8px;
    }

    .room-meta {
        display: none;
    }

    .message-scroll {
        padding: 14px 8px 6px;
    }

    .message {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 10px;
        padding: 6px 8px;
    }

    .message-avatar {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .composer {
        padding: 8px 10px 12px;
    }

    .composer-hint {
        display: none;
    }

    .channel-intro {
        margin-top: 6px;
    }

    .channel-intro h2 {
        font-size: 23px;
    }

    .admin-topbar {
        padding: 0 15px;
        gap: 12px;
    }

    .admin-crumb {
        display: none;
    }

    .admin-self {
        display: none;
    }

    .admin-main {
        width: calc(100% - 24px);
        padding-top: 24px;
    }

    .admin-panel {
        padding: 15px;
    }

    .stat-card {
        min-width: 88px;
        padding: 11px 12px;
    }

    .stat-card strong {
        font-size: 20px;
    }

    .admin-tabs {
        overflow-x: auto;
    }

    .admin-tab {
        white-space: nowrap;
    }

    .data-table {
        min-width: 760px;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .search-box {
        flex: 1 1 180px;
        width: auto;
    }
}

@media (max-width: 520px) {
    .auth-card {
        padding: 20px;
    }

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

    .form-grid,
    .field-row {
        grid-template-columns: 1fr;
    }

    .auth-shell {
        align-items: flex-start;
        padding-top: 20px;
    }

    .admin-top-actions .btn {
        padding: 6px 9px;
        font-size: 11.5px;
    }

    .admin-hero h1 {
        font-size: 28px;
    }

    .stat-grid {
        width: 100%;
    }

    .stat-card {
        flex: 1 1 0;
    }

    .admin-room-grid {
        grid-template-columns: 1fr;
    }

    .admin-message-card {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .admin-message-actions {
        grid-column: 2;
    }

    .toast {
        bottom: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .001ms !important;
    }
}
