:root {
    --bg: #0b1020;
    --bg-2: #090d1a;
    --surface: rgba(255, 255, 255, 0.06);
    --surface-2: rgba(255, 255, 255, 0.10);
    --stroke: rgba(255, 255, 255, 0.12);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.62);
    --accent: #ffd54f;
    --accent-2: #7c5cff;
    --accent-text: #161616;
    --danger: #ff6b6b;
    --ok: #2ee59d;
    --shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
    --radius: 16px;
    --radius-sm: 12px;
    --ring: 0 0 0 3px rgba(124, 92, 255, 0.25);
    --content-max: 1120px;
    --toolbar-h: 56px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: linear-gradient(180deg, var(--bg), var(--bg-2));
    color: var(--text);
    font-family: Inter, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Reduce/disable mobile zoom gestures */
html {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

input, textarea, button, a, label, select {
    touch-action: manipulation;
}

/* Fixed gradient layer to prevent "jumping" on scroll */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(1200px 800px at 20% 0%, rgba(124, 92, 255, 0.22), transparent 55%),
        radial-gradient(1100px 780px at 80% 10%, rgba(255, 213, 79, 0.14), transparent 55%),
        linear-gradient(180deg, var(--bg), var(--bg-2));
    transform: translateZ(0);
    will-change: transform;
}

.app-shell {
    min-height: 100dvh;
}

.screen {
    display: none;
    min-height: 100dvh;
}

.screen.active {
    display: block;
}

.login-wrap {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(520px, 100%);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.05));
    border: 1px solid var(--stroke);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    padding: 26px;
    backdrop-filter: blur(10px);
}

.brand {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.92);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(255, 213, 79, 0.65));
    box-shadow: 0 10px 30px rgba(124, 92, 255, 0.22);
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    object-fit: contain;
}

.brand-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.15;
}

.brand-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
}

.login-footnote {
    margin-top: 14px;
    font-size: 12px;
}

.layout {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
}

.field {
    width: 100%;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    padding: 14px;
    margin-bottom: 12px;
    outline: none;
}

.field::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.field:focus {
    border-color: rgba(124, 92, 255, 0.6);
    box-shadow: var(--ring);
}

.area {
    min-height: 120px;
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.06s ease, filter 0.2s ease, opacity 0.2s ease;
}

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

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), rgba(255, 213, 79, 0.75));
    color: var(--accent-text);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

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

.row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.avatar-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.avatar-preview {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
    display: grid;
    place-items: center;
}

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

.avatar-preview-placeholder {
    font-weight: 900;
    font-size: 14px;
    color: rgba(255,255,255,0.92);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.75), rgba(255, 213, 79, 0.35));
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
}

.avatar-actions {
    display: grid;
    gap: 8px;
}

.avatar-advanced {
    margin: 6px 0 12px;
}

.avatar-advanced summary {
    cursor: pointer;
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 56px;
    background: rgba(10, 14, 28, 0.75);
    color: var(--text);
    border-bottom: 1px solid var(--stroke);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.toolbar-title {
    flex: 1;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    user-select: none;
}

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.06s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.10);
}

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

.icon-btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.badge {
    position: absolute;
    right: -2px;
    top: -2px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #d32f2f;
    color: #fff;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    padding: 0 4px;
}

.hidden {
    display: none !important;
}

.drawer {
    position: fixed;
    top: 56px;
    left: -280px;
    width: 260px;
    height: calc(100dvh - 56px);
    z-index: 50;
    background: rgba(12, 16, 32, 0.82);
    border-right: 1px solid var(--stroke);
    transition: left 0.2s ease;
    padding: 14px 12px;
    backdrop-filter: blur(10px);
}

.drawer.open {
    left: 0;
}

.drawer-overlay {
    position: fixed;
    inset: 56px 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 45;
    display: none;
}

.drawer-overlay.show {
    display: block;
}

.nav-head {
    padding: 6px 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 10px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-mark {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.92);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(255, 213, 79, 0.65));
}

.nav-logo {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    object-fit: contain;
}

.nav-title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.nav-subtitle {
    margin-top: 6px;
    font-size: 12px;
}

.drawer-item {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    border-radius: 14px;
    padding: 11px 12px;
    margin-bottom: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.drawer-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.drawer-item:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.drawer-item.active {
    background: rgba(124, 92, 255, 0.18);
    border-color: rgba(124, 92, 255, 0.38);
}

.content {
    padding: 18px 14px 24px;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.hello-block {
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(255, 213, 79, 0.18));
    padding: 18px;
    margin-bottom: 14px;
}

.hello-title {
    font-size: 24px;
    font-weight: 700;
}

.hello-name {
    margin-top: 6px;
    font-size: 18px;
}

.hello-nickname {
    margin-top: 4px;
    font-size: 14px;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
}

.list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.list-item {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
}

.list-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.admin-users-toolbar {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-users-status {
    font-size: 12px;
}

.segmented {
    display: inline-grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.05);
}

.seg-btn {
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 12px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    font-size: 12px;
    opacity: 0.78;
}

.seg-btn.is-active {
    opacity: 1;
    background: rgba(124, 92, 255, 0.18);
    border-color: rgba(124, 92, 255, 0.35);
}

.admin-user-card {
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.06);
}

.admin-user-card.marked {
    border-color: rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.10);
}

.admin-user-head {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 10px;
    align-items: start;
}

.admin-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.10);
}

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

.admin-user-title {
    font-weight: 900;
}

.admin-user-sub {
    margin-top: 2px;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.25;
}

.admin-user-note {
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
}

.admin-user-last {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}

.admin-user-badge {
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 900;
    color: #fff;
    background: #d32f2f;
    display: grid;
    place-items: center;
    margin-top: 4px;
}

.admin-user-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.admin-user-actions .btn {
    padding: 8px 10px;
    font-size: 12px;
}

.admin-user-expand {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(12, 16, 32, 0.55);
    color: var(--text);
    cursor: pointer;
}

.admin-user-spoiler {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-user-spoiler-title {
    font-size: 12px;
    color: rgba(255,255,255,0.70);
    margin-bottom: 8px;
}

.admin-chat-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
}

.admin-chat-check input {
    width: 16px;
    height: 16px;
}

.admin-chat-check.disabled {
    opacity: 0.7;
}

.admin-tags-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 12px;
    align-items: start;
}

.admin-tags-left {
    display: grid;
    gap: 10px;
}

.admin-tags-detail {
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.05);
    padding: 12px;
}

.admin-tags-rooms-title {
    font-weight: 900;
    margin-bottom: 10px;
}

.admin-tag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: rgba(255,255,255,0.06);
    cursor: pointer;
}

.admin-tag-row.is-active {
    border-color: rgba(124, 92, 255, 0.35);
    background: rgba(124, 92, 255, 0.14);
}

.admin-tag-name {
    font-weight: 900;
}

.admin-tag-actions {
    display: inline-flex;
    gap: 8px;
}

.admin-tag-actions .btn {
    padding: 8px 10px;
    font-size: 12px;
}

.admin-tags-rooms-list {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

@media (max-width: 980px) {
    .admin-tags-grid {
        grid-template-columns: 1fr;
    }
}

.small {
    font-size: 12px;
}

.muted {
    color: var(--muted);
}

.chat-header {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 8px;
}

.chat-messages {
    min-height: 52dvh;
    max-height: 52dvh;
    overflow: auto;
    padding: 8px 0;
}

.msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 16px;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.msg.in {
    background: rgba(255, 255, 255, 0.06);
}

.msg.out {
    background: rgba(46, 229, 157, 0.14);
    margin-left: auto;
}

.chat-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.error-text {
    margin: 8px 0 0;
    color: var(--danger);
}

/* Chat (Telegram-like) */
.panel-full {
    max-width: none !important;
    margin: 0 !important;
}

.panel-full .chat-shell {
    height: calc(100dvh - var(--toolbar-h) - 32px);
}

.chat-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: min(72dvh, 720px);
}

.chat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.05);
}

.chat-title {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.chat-status {
    margin-top: 3px;
    font-size: 12px;
}

.chat-users-indicator {
    font-size: 12px;
    color: var(--ok);
    user-select: none;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(46, 229, 157, 0.10);
    border: 1px solid rgba(46, 229, 157, 0.20);
}

.chat-stage {
    position: relative;
    flex: 1;
    border: 1px solid var(--stroke);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

#chat-messages.chat-messages {
    max-height: none;
    min-height: 0;
    height: 100%;
    padding: 10px 8px 12px;
    overflow: auto;
}

.chat-fab {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid var(--stroke);
    background: rgba(12, 16, 32, 0.85);
    color: var(--text);
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.chat-fab:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.chat-reply {
    display: grid;
    grid-template-columns: 3px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.05);
}

.chat-reply-bar {
    height: 100%;
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.9);
}

.chat-reply-user {
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.90);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-reply-text {
    font-size: 12px;
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-input {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 10px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.05);
}

.chat-input-field.field {
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.06);
}

.chat-send {
    height: 44px;
    padding: 0 14px;
}

.chat-recording {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

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

.chat-recording-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4d4d;
    box-shadow: 0 0 0 6px rgba(255, 77, 77, 0.12);
}

.chat-recording-timer {
    font-weight: 900;
}

.chat-recording-actions {
    display: inline-flex;
    gap: 8px;
}

.chat-item {
    display: flex;
    gap: 8px;
    margin: 6px 2px;
}

.chat-item.right {
    justify-content: flex-end;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex: 0 0 auto;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

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

.chat-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.75), rgba(255, 213, 79, 0.35));
}

.chat-bubble {
    position: relative;
    max-width: min(78%, 760px);
    min-width: 64px;
    border-radius: 18px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.06);
}

.chat-bubble--has-reply {
    padding-right: 40px;
}

.chat-item.right .chat-bubble {
    background: rgba(46, 229, 157, 0.14);
    border-color: rgba(46, 229, 157, 0.20);
}

.chat-bubble.quoted-me {
    border-color: rgba(255, 213, 79, 0.35);
    box-shadow: 0 0 0 3px rgba(255, 213, 79, 0.08) inset;
}

.chat-user {
    font-size: 13px;
    font-weight: 800;
    color: rgba(255, 213, 79, 0.95);
    margin-bottom: 2px;
}

.chat-user-meta {
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.25;
    color: rgba(255,255,255,0.62);
    white-space: pre-wrap;
    cursor: copy;
    user-select: none;
}

.chat-user-meta:hover {
    color: rgba(255,255,255,0.78);
}

.chat-meta {
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    font-size: 11px;
    color: var(--muted);
}

.chat-edited {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.55);
}

.chat-text {
    font-size: 16px;
    line-height: 1.35;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-text a {
    color: rgba(255, 213, 79, 0.95);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-quote {
    margin: 4px 0 8px;
    display: grid;
    grid-template-columns: 3px 1fr;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
}

.chat-quote-bar {
    border-radius: 999px;
    background: rgba(124, 92, 255, 0.9);
}

.chat-quote-user {
    font-size: 12px;
    font-weight: 800;
    color: rgba(255, 213, 79, 0.95);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-quote-text {
    font-size: 12px;
    margin-top: 2px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chat-quote--clickable {
    cursor: pointer;
}

.chat-quote--clickable:hover {
    background: rgba(255, 255, 255, 0.09);
}

.chat-reply-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    margin: 0;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s ease;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.92);
}

.chat-item:hover .chat-reply-btn,
.chat-reply-btn:focus-visible {
    opacity: 1;
}

@media (hover: none) {
    .chat-item .chat-reply-btn {
        opacity: 0.55;
    }
}

.chat-item-highlight {
    outline: 2px solid rgba(255, 213, 79, 0.8);
    outline-offset: 3px;
    border-radius: 22px;
    transition: outline-color 0.2s ease;
}

.chat-system {
    margin: 10px 0;
    display: flex;
    justify-content: center;
}

.chat-system .chat-system-text {
    font-size: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    border-radius: 999px;
}

.chat-image-wrap {
    margin-top: 8px;
}

.chat-image {
    display: block;
    max-width: 100%;
    width: min(520px, 100%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    cursor: zoom-in;
}

.chat-item.right .chat-image {
    border-color: rgba(46, 229, 157, 0.20);
}

.chat-voice {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.06);
}

.chat-item.right .chat-voice {
    border-color: rgba(46, 229, 157, 0.20);
    background: rgba(46, 229, 157, 0.12);
}

.chat-voice-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(12, 16, 32, 0.65);
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
}

.chat-voice-btn:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.chat-voice-duration {
    font-size: 14px;
    color: var(--text);
    user-select: none;
}

/* Desktop layout: sidebar always visible */
@media (min-width: 980px) {
    .layout {
        grid-template-columns: 280px 1fr;
        grid-template-rows: 56px 1fr;
        grid-template-areas:
            "toolbar toolbar"
            "drawer content";
    }

    .toolbar {
        grid-area: toolbar;
        padding: 0 18px;
    }

    #toolbar-menu {
        display: none;
    }

    .drawer {
        grid-area: drawer;
        position: sticky;
        top: 56px;
        left: 0;
        height: calc(100dvh - 56px);
        border-right: 1px solid var(--stroke);
        border-bottom: 0;
    }

    .drawer,
    .drawer.open {
        left: 0;
    }

    .drawer-overlay {
        display: none !important;
    }

    .content {
        grid-area: content;
        padding: 22px 22px 28px;
    }

    .panel {
        max-width: var(--content-max);
        margin: 0 auto;
    }

    /* Chat should be full-width/full-height on desktop */
    #panel-chat.panel-full {
        max-width: none;
        margin: 0;
    }

    #panel-chat.panel-full .chat-shell {
        height: calc(100dvh - var(--toolbar-h) - 44px);
    }
}

/* Small screens: keep things roomy */
@media (max-width: 420px) {
    .login-card {
        padding: 18px;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
