html,
body.chat-page {
    height: 100%;
    min-height: 100%;
}

/* Premium dark chat redesign */
body.chat-page {
    --chat-bg: #071019;
    --chat-surface: rgba(8, 16, 25, 0.76);
    --chat-surface-strong: rgba(10, 19, 30, 0.92);
    --chat-border: rgba(133, 161, 185, 0.13);
    --chat-border-strong: rgba(133, 161, 185, 0.2);
    --chat-text: #eff6fd;
    --chat-muted: #8ea4ba;
    --chat-muted-strong: #bfd0e0;
    --chat-accent: #82b6ff;
    --chat-accent-soft: rgba(130, 182, 255, 0.14);
    --chat-success: #58d0b3;
    /* Option-surface design foundation: one shared system for every menu,
       sheet, action row and selection bar. */
    --chat-radius-sheet: 20px;
    --chat-radius-menu: 16px;
    --chat-radius-row: 12px;
    --chat-radius-pill: 999px;
    --chat-hairline: var(--chat-border);
    --chat-menu-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.72);
    --chat-row-min: 44px;
    --chat-row-hover: var(--chat-control-bg-hover);
    --chat-row-gap: 0.16rem;
    --chat-shell-gradient:
        radial-gradient(circle at 18% 12%, rgba(93, 159, 255, 0.16), transparent 28%),
        radial-gradient(circle at 82% 0%, rgba(70, 206, 192, 0.12), transparent 20%),
        radial-gradient(circle at 50% 110%, rgba(33, 54, 91, 0.42), transparent 42%),
        linear-gradient(180deg, #091420 0%, #060d15 48%, #050a11 100%);
    --chat-header-bg: linear-gradient(180deg, rgba(13, 23, 35, 0.94), rgba(9, 17, 27, 0.9));
    --chat-pane-bg: linear-gradient(180deg, rgba(12, 21, 32, 0.94), rgba(8, 15, 24, 0.92));
    --chat-pane-bg-strong: linear-gradient(180deg, rgba(13, 22, 34, 0.98), rgba(8, 15, 24, 0.96));
    --chat-control-bg: rgba(16, 28, 42, 0.86);
    --chat-control-bg-hover: rgba(22, 37, 54, 0.96);
    --chat-list-active-bg: linear-gradient(180deg, rgba(130, 182, 255, 0.14), rgba(82, 221, 204, 0.08));
    --chat-stream-bg: rgba(8, 14, 22, 0.96);
    --chat-stream-pattern: rgba(137, 160, 185, 0.08);
    --chat-bubble: linear-gradient(180deg, rgba(15, 24, 36, 0.98), rgba(11, 19, 29, 0.98));
    --chat-bubble-me: linear-gradient(180deg, rgba(22, 53, 66, 0.98), rgba(16, 38, 51, 0.98));
    --chat-composer-bg: rgba(8, 16, 25, 0.92);
    --chat-input-bg: rgba(14, 25, 37, 0.96);
    --chat-chip-bg: rgba(18, 30, 45, 0.92);
    --chat-overlay-bg: rgba(3, 8, 14, 0.62);
    --chat-sheet-bg: rgba(9, 17, 27, 0.98);
    --chat-modal-bg: rgba(8, 16, 25, 0.98);
    --chat-toast-bg: rgba(8, 15, 23, 0.96);
    --chat-top-chrome-color: rgba(9, 17, 27, 0.98);
    --chat-statusbar-color: #08111b;
    background-color: var(--chat-statusbar-color);
    color: var(--chat-text);
}

html[data-theme="dark"] body.chat-page {
    --chat-top-chrome-color: rgba(9, 17, 27, 0.98);
    --chat-statusbar-color: #08111b;
}

body.chat-page .background-overlay {
    background: var(--chat-shell-gradient);
}

.chat-app {
    position: relative;
    width: min(1540px, calc(100% - 2rem));
    max-width: 1540px;
    padding: calc(1rem + env(safe-area-inset-top, 0px)) 0.9rem calc(1rem + var(--chat-shell-offset));
    gap: 0.9rem;
    contain: layout paint style;
}

.chat-app::before {
    content: "";
    position: absolute;
    top: 3.5rem;
    left: 50%;
    width: min(760px, 76vw);
    height: 280px;
    transform: translateX(-50%);
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 40%, rgba(113, 164, 255, 0.18), transparent 54%),
        radial-gradient(circle at 62% 52%, rgba(77, 214, 188, 0.1), transparent 48%);
    filter: blur(42px);
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
}

.chat-app > * {
    position: relative;
    z-index: 1;
}

.chat-app__header,
.chat-login-panel,
.chat-stage {
    border-radius: 30px;
    border: 1px solid var(--chat-border);
    background: var(--chat-pane-bg);
    box-shadow:
        0 30px 80px -48px rgba(0, 0, 0, 0.82),
        inset 0 1px 0 rgba(255, 255, 255, 0.04),
        inset 0 -1px 0 rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(24px);
}

.chat-app__header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--chat-header-bg);
}

.chat-app__identity h1 {
    margin: 0;
    font-family: var(--font-accent);
    font-size: clamp(1.1rem, 1.4vw, 1.45rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.chat-app__identity p {
    margin: 0.24rem 0 0;
    color: var(--chat-muted);
    font-size: 0.8rem;
    line-height: 1.8;
    max-width: 42rem;
}

.chat-app__actions {
    gap: 0.52rem;
}

.chat-back,
.chat-top-btn,
.chat-sheet-close,
.conversation-pane__icon-btn,
.conversation-pane__close,
.thread-head__mobile-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    border: 1px solid var(--chat-border);
    background: rgba(18, 31, 46, 0.8);
    color: var(--chat-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.chat-back:hover,
.chat-back:focus-visible,
.chat-top-btn:hover,
.chat-top-btn:focus-visible,
.chat-sheet-close:hover,
.chat-sheet-close:focus-visible,
.conversation-pane__icon-btn:hover,
.conversation-pane__icon-btn:focus-visible,
.conversation-pane__close:hover,
.conversation-pane__close:focus-visible,
.thread-head__mobile-btn:hover,
.thread-head__mobile-btn:focus-visible {
    border-color: var(--chat-border-strong);
    background: rgba(23, 39, 58, 0.96);
    box-shadow:
        0 14px 28px -20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.chat-top-btn-text {
    width: auto;
    min-width: 78px;
    padding-inline: 0.95rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 820;
}

#account-btn {
    width: 44px;
    min-width: 44px;
    border-radius: 16px;
}

.chat-connection {
    min-height: 40px;
    padding: 0.46rem 0.88rem;
    border-radius: 999px;
    border-color: var(--chat-border);
    background: rgba(14, 25, 37, 0.86);
    color: var(--chat-muted);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-stage {
    gap: 0.9rem;
    padding: 0.95rem;
    grid-template-columns: minmax(310px, 360px) minmax(0, 1fr);
    background: linear-gradient(180deg, rgba(11, 19, 29, 0.92), rgba(7, 13, 21, 0.96));
}

.conversation-pane,
.thread-pane {
    border-radius: 26px;
    border: 1px solid var(--chat-border);
    background: var(--chat-pane-bg-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.conversation-pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-login-panel {
    width: min(520px, 100%);
    padding: 1.35rem;
    background: linear-gradient(180deg, rgba(12, 21, 33, 0.96), rgba(8, 15, 24, 0.96));
}

.chat-login-kicker {
    min-height: 30px;
    padding: 0.32rem 0.78rem;
    background: rgba(130, 182, 255, 0.12);
    color: var(--chat-accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chat-login-title {
    font-family: var(--font-accent);
    font-size: 1.42rem;
    line-height: 1.5;
}

.chat-login-text,
.login-feedback,
.composer-storage-note {
    color: var(--chat-muted);
}

.chat-login-btn {
    min-height: 50px;
    border-radius: 18px;
    background: linear-gradient(135deg, #7cb0ff 0%, #4fd6ca 100%);
    color: #08111a;
    font-weight: 880;
    box-shadow: 0 20px 36px -24px rgba(79, 214, 202, 0.42);
}

.chat-secondary-link {
    min-height: 46px;
    border-radius: 16px;
    border-color: var(--chat-border);
    background: rgba(18, 31, 46, 0.8);
}

.conversation-pane__header,
.thread-head {
    padding: 1rem 1rem 0.88rem;
    border-bottom: 1px solid var(--chat-border);
    background: linear-gradient(180deg, rgba(13, 23, 35, 0.96), rgba(9, 17, 27, 0.9));
    backdrop-filter: blur(24px);
}

.conversation-pane__header h2,
.thread-head__copy strong,
.conversation-item__title {
    font-family: var(--font-accent);
    letter-spacing: -0.02em;
    text-align: center;
}

.conversation-pane__header h2 {
    font-size: 1rem;
    font-weight: 760;
}

.conversation-pane__header p,
.thread-head__copy span {
    color: var(--chat-muted);
}

.conversation-pane__header-actions {
    gap: 0.34rem;
    padding: 0.28rem;
    border-radius: 18px;
    border: 1px solid rgba(133, 161, 185, 0.1);
    background: rgba(11, 21, 33, 0.72);
}

.conversation-search-wrap {
    padding: 0.88rem 1rem 0.6rem;
}

.conversation-search-wrap input,
.chat-modal__fields input,
.chat-modal__fields textarea,
#edit-text {
    min-height: 48px;
    border-radius: 18px;
    border: 1px solid var(--chat-border);
    background: rgba(11, 21, 32, 0.9);
    color: var(--chat-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.conversation-search-wrap input::placeholder,
.composer-entry textarea::placeholder,
.chat-modal__fields input::placeholder,
.chat-modal__fields textarea::placeholder,
#edit-text::placeholder {
    color: color-mix(in srgb, var(--chat-muted) 88%, transparent);
}

.conversation-filter-tabs {
    gap: 0.42rem;
    padding: 0 1rem 0.75rem;
}

.conversation-filter-tab {
    min-height: 36px;
    padding-inline: 0.95rem;
    border-radius: 999px;
    border-color: rgba(133, 161, 185, 0.16);
    background: rgba(15, 26, 39, 0.76);
    color: var(--chat-muted);
    font-size: 0.7rem;
}

.conversation-filter-tab.is-active {
    border-color: rgba(130, 182, 255, 0.3);
    background: linear-gradient(180deg, rgba(130, 182, 255, 0.2), rgba(79, 214, 202, 0.08));
    color: var(--chat-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.conversation-manage-bar,
.conversation-empty,
.conversation-archive-toggle,
.chat-pinned-strip,
.chat-mute-strip {
    border-radius: 18px;
}

.conversation-manage-bar,
.conversation-empty {
    margin-inline: 1rem;
}

.conversation-empty {
    padding: 0.8rem 0.95rem;
    border: 1px dashed rgba(133, 161, 185, 0.18);
    background: rgba(12, 22, 34, 0.46);
    font-size: 0.76rem;
}

.conversation-list {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 0.72rem 0.8rem;
    gap: 0.34rem;
}

.conversation-item__main {
    min-height: 80px;
    padding: 0.8rem 0.82rem;
    border-radius: 22px;
    background: rgba(12, 22, 34, 0.42);
    border: 1px solid transparent;
}

.conversation-item__main::before {
    inset-inline-start: 0.36rem;
    inset-block: 12px;
    width: 4px;
    border-radius: 999px;
    background: linear-gradient(180deg, #82b6ff 0%, #4fd6ca 100%);
}

.conversation-item__main:hover,
.conversation-item__main:focus-visible {
    background: rgba(15, 28, 42, 0.88);
    border-color: rgba(133, 161, 185, 0.16);
}

.conversation-item.is-active .conversation-item__main {
    background: var(--chat-list-active-bg);
    border-color: rgba(130, 182, 255, 0.26);
    box-shadow: 0 20px 40px -30px rgba(0, 0, 0, 0.62);
}

.conversation-item__avatar,
.thread-head__avatar {
    border-radius: 18px;
    box-shadow:
        0 16px 28px -20px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.conversation-item__avatar {
    width: 48px;
    height: 48px;
    font-size: 0.84rem;
}

.conversation-item__kind {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 12px;
    background: rgba(130, 182, 255, 0.14);
    border-color: rgba(130, 182, 255, 0.18);
}

.conversation-item__title {
    font-size: 0.84rem;
    font-weight: 840;
}

.conversation-item__subtitle,
.conversation-item__preview,
.conversation-item__time {
    color: var(--chat-muted);
}

.conversation-item__preview {
    font-size: 0.71rem;
    line-height: 1.55;
}

.conversation-badge,
.conversation-item__unread {
    min-height: 21px;
    padding-inline: 0.42rem;
    border-radius: 999px;
}

.conversation-badge {
    background: rgba(82, 221, 204, 0.12);
    color: var(--chat-success);
}

.thread-pane {
    display: grid;
    background: var(--chat-pane-bg-strong);
}

.thread-placeholder {
    padding: clamp(1.2rem, 3vw, 2rem);
    background:
        radial-gradient(circle at 50% 18%, rgba(130, 182, 255, 0.09), transparent 30%),
        radial-gradient(circle at 18% 80%, rgba(79, 214, 202, 0.08), transparent 22%),
        linear-gradient(180deg, rgba(11, 19, 29, 0.96), rgba(8, 15, 24, 0.98));
}

.thread-placeholder__shell {
    width: min(760px, 100%);
    margin: auto;
    display: grid;
    gap: 0.95rem;
    padding: clamp(1.35rem, 3vw, 2.2rem);
    border-radius: 28px;
    border: 1px solid rgba(133, 161, 185, 0.14);
    background: rgba(11, 20, 30, 0.84);
    box-shadow:
        0 34px 70px -42px rgba(0, 0, 0, 0.78),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.thread-placeholder__eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 30px;
    padding: 0.32rem 0.8rem;
    border-radius: 999px;
    background: rgba(130, 182, 255, 0.1);
    color: var(--chat-accent);
    font-size: 0.72rem;
    font-weight: 820;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.thread-placeholder strong {
    font-family: var(--font-accent);
    font-size: clamp(1.55rem, 2.4vw, 2.3rem);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -0.04em;
}

.thread-placeholder__lead,
.thread-placeholder > span {
    font-size: 0.92rem;
    line-height: 1.95;
    color: var(--chat-muted);
}

.thread-placeholder__stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.72rem;
}

.thread-placeholder__stat {
    display: grid;
    gap: 0.24rem;
    padding: 0.9rem 0.95rem;
    border-radius: 20px;
    border: 1px solid rgba(133, 161, 185, 0.12);
    background: rgba(15, 26, 38, 0.88);
}

.thread-placeholder__stat b {
    font-size: 1.06rem;
    font-weight: 840;
    color: var(--chat-text);
}

.thread-placeholder__stat span {
    color: var(--chat-muted);
    font-size: 0.74rem;
    line-height: 1.7;
}

.thread-placeholder__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.78rem;
}

.thread-placeholder__action {
    display: grid;
    gap: 0.28rem;
    min-height: 168px;
    padding: 1rem;
    border-radius: 22px;
    border: 1px solid rgba(133, 161, 185, 0.12);
    background:
        linear-gradient(180deg, rgba(17, 29, 43, 0.96), rgba(12, 22, 34, 0.94)),
        radial-gradient(circle at top left, rgba(130, 182, 255, 0.1), transparent 36%);
    color: var(--chat-text);
    text-align: start;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.thread-placeholder__action:hover,
.thread-placeholder__action:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(130, 182, 255, 0.24);
    box-shadow: 0 22px 44px -34px rgba(0, 0, 0, 0.76);
}

.thread-placeholder__action:disabled {
    opacity: 0.56;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.thread-placeholder__action-kicker {
    color: var(--chat-accent);
    font-size: 0.68rem;
    font-weight: 820;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.thread-placeholder__action strong {
    font-size: 1rem;
    line-height: 1.4;
}

.thread-placeholder__action span:last-child {
    color: var(--chat-muted);
    font-size: 0.76rem;
    line-height: 1.85;
}

.thread-head {
    padding: 0.95rem 1.08rem 0.88rem;
}

.thread-head__identity {
    gap: 0.72rem;
}

.thread-head__avatar {
    width: 52px;
    height: 52px;
    font-size: 0.9rem;
}

.thread-head__copy strong {
    font-size: 1rem;
    font-weight: 820;
}

.thread-head__copy span {
    font-size: 0.76rem;
    line-height: 1.7;
}

.thread-head__actions {
    gap: 0.34rem;
}

.thread-banner-stack {
    padding: 0.8rem 1rem 0;
    gap: 0.5rem;
}

.chat-mute-strip {
    padding: 0.72rem 0.86rem;
    background: rgba(239, 124, 136, 0.08);
    border: 1px solid rgba(239, 124, 136, 0.14);
}

.chat-pinned-strip {
    padding: 0.75rem 0.86rem;
    background: rgba(15, 26, 39, 0.9);
    border-color: rgba(130, 182, 255, 0.14);
}

.chat-pinned-strip__copy strong {
    font-size: 0.74rem;
}

.thread-stream,
.messages,
.stream-state {
    background:
        radial-gradient(circle at 18% 12%, rgba(130, 182, 255, 0.08), transparent 28%),
        radial-gradient(circle at 82% 0%, rgba(79, 214, 202, 0.07), transparent 24%),
        linear-gradient(var(--chat-stream-bg), var(--chat-stream-bg)),
        radial-gradient(circle at 1px 1px, var(--chat-stream-pattern) 1px, transparent 0);
    background-size: auto, auto, auto, 28px 28px;
}

.stream-state {
    gap: 0.45rem;
    padding: 2.4rem 1rem;
}

.stream-state strong {
    font-family: var(--font-accent);
    font-size: 1.18rem;
    font-weight: 760;
}

.stream-state span {
    max-width: 28rem;
    margin: 0 auto;
    line-height: 1.85;
}

.messages {
    padding: 1rem 1.08rem 0.85rem;
    /* Ensure the messages area is an independent scroll container
       so scrolling works on mobile (touch) and desktop (wheel). */
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 981px) {
    .messages {
        padding-inline: clamp(1.4rem, 5vw, 5.4rem);
    }
}

.msg-item.day-start {
    margin-top: 1rem;
    padding-top: 1.2rem;
}

.msg-item.day-start::before {
    min-height: 28px;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    border-color: rgba(133, 161, 185, 0.14);
    background: rgba(15, 27, 40, 0.88);
    color: var(--chat-muted);
}

.msg-avatar {
    width: 38px;
    height: 38px;
    border-radius: 16px;
    box-shadow: 0 18px 28px -22px rgba(0, 0, 0, 0.76);
}

.msg-bubble {
    max-width: min(71%, 720px);
    padding: 0.62rem 0.82rem 0.5rem;
    border-radius: 24px;
    border-color: rgba(133, 161, 185, 0.12);
    background: var(--chat-bubble);
    box-shadow: 0 24px 48px -40px rgba(0, 0, 0, 0.78);
}

.msg-item.me .msg-bubble {
    border-color: rgba(79, 214, 202, 0.16);
    background: var(--chat-bubble-me);
}

.msg-text {
    font-size: 0.9rem;
    line-height: 1.92;
    color: var(--chat-text);
}

.msg-name {
    color: #9cc7ff;
    font-size: 0.72rem;
}

.msg-foot,
.msg-delivery,
.msg-time,
.msg-reaction__count {
    color: var(--chat-muted);
}

.msg-reaction {
    min-height: 26px;
    padding: 0.14rem 0.48rem;
    border-radius: 999px;
    border-color: rgba(133, 161, 185, 0.14);
    background: rgba(15, 27, 40, 0.86);
}

.msg-reaction.is-own {
    background: rgba(130, 182, 255, 0.12);
    border-color: rgba(130, 182, 255, 0.18);
    color: var(--chat-accent);
}

.msg-attachment {
    padding: 0.56rem 0.62rem;
    border-radius: 16px;
    border-color: rgba(133, 161, 185, 0.12);
    background: rgba(15, 28, 41, 0.88);
}

.reply-preview,
.reply-bar {
    border-radius: 16px;
}

.composer {
    padding: 0.9rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--chat-border);
    background: linear-gradient(180deg, rgba(8, 16, 25, 0.72), rgba(8, 16, 25, 0.96));
    backdrop-filter: blur(22px);
}

.reply-bar {
    margin-bottom: 0.6rem;
    padding: 0.55rem 0.72rem;
    background: rgba(130, 182, 255, 0.08);
    border: 1px solid rgba(130, 182, 255, 0.12);
}

.composer-box {
    gap: 0.5rem;
    padding: 0.42rem;
    border-radius: 26px;
    border-color: rgba(133, 161, 185, 0.14);
    background: linear-gradient(180deg, rgba(14, 25, 37, 0.96), rgba(10, 19, 29, 0.98));
    box-shadow:
        0 28px 52px -40px rgba(0, 0, 0, 0.82),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.composer-box:focus-within {
    border-color: rgba(130, 182, 255, 0.22);
    box-shadow:
        0 32px 56px -42px rgba(0, 0, 0, 0.88),
        0 0 0 4px rgba(130, 182, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    background: linear-gradient(180deg, rgba(16, 28, 42, 0.98), rgba(11, 21, 33, 0.98));
}

.composer-tools {
    gap: 0.34rem;
}

.composer-tool,
.composer-send {
    width: 44px;
    height: 44px;
    border-radius: 18px;
}

.composer-tool {
    border-color: rgba(133, 161, 185, 0.12);
    background: rgba(18, 31, 46, 0.82);
    color: var(--chat-muted-strong);
}

.composer-tool:hover,
.composer-tool:focus-visible,
.composer-tool.is-open,
.composer-tool.is-recording {
    background: rgba(22, 39, 58, 0.98);
    color: var(--chat-text);
}

.composer-entry textarea {
    min-height: 52px;
    max-height: 184px;
    padding: 0.7rem 0.18rem;
    background: transparent;
    color: var(--chat-text);
    font-size: 0.94rem;
    line-height: 1.8;
}

.composer-send {
    border: 0;
    background: linear-gradient(135deg, #7cb0ff 0%, #4fd6ca 100%);
    color: #08111a;
    box-shadow: 0 20px 36px -24px rgba(79, 214, 202, 0.46);
}

.composer-send:hover:not(:disabled),
.composer-send:focus-visible {
    filter: brightness(1.03);
    box-shadow: 0 24px 42px -24px rgba(79, 214, 202, 0.5);
}

.composer-send:disabled {
    opacity: 0.48;
    box-shadow: none;
}

.composer-upload-sheet,
.composer-uploads {
    margin-bottom: 0.6rem;
}

.composer-upload-option,
.composer-upload-item {
    border-radius: 16px;
    border-color: rgba(133, 161, 185, 0.12);
    background: rgba(16, 29, 43, 0.88);
}

.composer-voice {
    margin-bottom: 0.6rem;
    padding: 0.8rem 0.9rem;
    border-radius: 18px;
    background: rgba(16, 28, 42, 0.88);
    border: 1px solid rgba(133, 161, 185, 0.12);
}

.composer-status {
    margin-top: 0.42rem;
    min-height: 1rem;
    font-size: 0.74rem;
}

.composer-storage-note {
    margin-top: 0.34rem;
    font-size: 0.72rem;
    line-height: 1.75;
}

.chat-info-sheet,
.chat-modal {
    border-radius: 28px;
    border: 1px solid var(--chat-border);
    background: linear-gradient(180deg, rgba(11, 20, 31, 0.98), rgba(8, 16, 25, 0.98));
    box-shadow: 0 36px 80px -44px rgba(0, 0, 0, 0.84);
}

.chat-mobile-nav {
    border: 1px solid var(--chat-border);
    background: rgba(10, 18, 28, 0.9);
    box-shadow:
        0 28px 56px -34px rgba(0, 0, 0, 0.84),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(24px);
}

.chat-mobile-nav__item {
    color: var(--chat-muted);
}

.chat-mobile-nav__item.is-active {
    color: var(--chat-text);
}

.chat-mobile-nav__item.is-active::before {
    background: linear-gradient(90deg, #7cb0ff, #4fd6ca);
}

.chat-fab {
    border-radius: 22px;
    border: 1px solid rgba(130, 182, 255, 0.18);
    background: linear-gradient(135deg, rgba(124, 176, 255, 0.98), rgba(79, 214, 202, 0.96));
    color: #08111a;
    box-shadow: 0 26px 48px -26px rgba(79, 214, 202, 0.4);
}

@media (max-width: 1240px) {
    .chat-stage {
        grid-template-columns: minmax(290px, 330px) minmax(0, 1fr);
    }

    .msg-bubble {
        max-width: min(78%, 680px);
    }
}

@media (max-width: 980px) {
    .chat-app {
        width: 100%;
        padding: 0 0 calc(0.8rem + var(--chat-shell-offset));
        gap: 0.55rem;
    }

    .chat-app::before {
        top: 0;
        width: 100%;
        height: 220px;
        filter: blur(54px);
    }

    .chat-app__header {
        margin: 0.55rem 0.55rem 0;
        padding: calc(0.82rem + env(safe-area-inset-top, 0px)) 0.82rem 0.82rem;
        border-radius: 24px;
        gap: 0.72rem;
    }

    .chat-back,
    .chat-top-btn,
    .conversation-pane__icon-btn,
    .thread-head__mobile-btn {
        width: 40px;
        height: 40px;
        border-radius: 15px;
    }

    .chat-connection {
        min-height: 34px;
        padding: 0.34rem 0.7rem;
    }

    .chat-stage {
        padding: 0.55rem;
        gap: 0.55rem;
        background: transparent;
        box-shadow: none;
        border: 0;
    }

    .conversation-pane,
    .thread-pane {
        border-radius: 24px;
    }

    .conversation-pane__header,
    .thread-head {
        padding: 0.82rem 0.82rem 0.72rem;
    }

    .conversation-search-wrap,
    .conversation-filter-tabs,
    .conversation-list {
        padding-inline: 0.82rem;
    }

    .conversation-search-wrap {
        padding-top: 0.72rem;
        padding-bottom: 0.52rem;
    }

    .conversation-filter-tabs {
        padding-bottom: 0.62rem;
    }

    .conversation-item__main {
        min-height: 72px;
        padding: 0.74rem 0.14rem;
        border-radius: 18px;
    }

    .thread-placeholder {
        padding: 0.82rem;
    }

    .thread-placeholder__shell {
        gap: 0.82rem;
        padding: 1.05rem;
        border-radius: 22px;
    }

    .thread-placeholder strong {
        font-size: 1.36rem;
    }

    .thread-placeholder__stats,
    .thread-placeholder__actions {
        grid-template-columns: 1fr;
    }

    .thread-placeholder__action {
        min-height: 0;
        padding: 0.92rem;
    }

    .thread-banner-stack {
        padding: 0.68rem 0.82rem 0;
    }

    .messages {
        padding: 0.82rem 0.82rem 0.74rem;
    }

    .msg-bubble {
        max-width: 90%;
        padding: 0.56rem 0.74rem 0.48rem;
        border-radius: 22px;
    }

    .composer {
        padding: 0.72rem 0.82rem calc(0.82rem + env(safe-area-inset-bottom, 0px) + var(--chat-local-nav-height));
    }

    .composer-box {
        border-radius: 24px;
    }

    .composer-tool,
    .composer-send {
        width: 42px;
        height: 42px;
        border-radius: 16px;
    }

    .composer-entry textarea {
        min-height: 48px;
        font-size: 0.9rem;
    }

    .chat-mobile-nav {
        left: 0.55rem;
        right: 0.55rem;
        bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
        border-radius: 24px;
    }

    .chat-fab {
        right: 0.82rem;
        bottom: calc(5.9rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 680px) {
    .chat-app__identity p {
        font-size: 0.76rem;
    }

    .chat-app__header {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .chat-app__actions {
        grid-column: 1 / -1;
        justify-content: space-between;
    }

    .conversation-pane__header-actions {
        padding: 0.24rem;
    }

    .conversation-item__avatar,
    .thread-head__avatar {
        width: 46px;
        height: 46px;
    }

    .thread-head__identity {
        gap: 0.58rem;
    }

    .thread-head__copy strong {
        font-size: 0.92rem;
    }

    .messages {
        padding-inline: 0.72rem;
    }

    .msg-bubble {
        max-width: 94%;
    }

    .composer {
        padding-inline: 0.72rem;
    }

    .composer-box {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .composer-send {
        grid-column: 1 / -1;
        width: 100%;
        height: 46px;
        border-radius: 18px;
    }
}

body.chat-page {
    --chat-bg: #d8e4ef;
    --chat-surface: rgba(255, 255, 255, 0.84);
    --chat-surface-strong: rgba(255, 255, 255, 0.96);
    --chat-border: rgba(107, 129, 154, 0.16);
    --chat-text: #17263a;
    --chat-muted: #66778a;
    --chat-accent: #3390ec;
    --chat-accent-soft: rgba(51, 144, 236, 0.12);
    --chat-bubble: rgba(255, 255, 255, 0.98);
    --chat-bubble-me: linear-gradient(180deg, #dcf2ff 0%, #d3edff 100%);
    --chat-danger: #c7535e;
    --chat-warning: #c2811d;
    --chat-success: #158f63;
    --chat-shell-gradient:
        radial-gradient(circle at 11% 5%, rgba(51, 144, 236, 0.12), transparent 26%),
        radial-gradient(circle at 91% 1%, rgba(90, 180, 255, 0.11), transparent 24%),
        linear-gradient(180deg, #edf4fb 0%, #d8e4ef 100%);
    --chat-header-bg: rgba(255, 255, 255, 0.82);
    --chat-pane-bg: rgba(255, 255, 255, 0.78);
    --chat-pane-bg-strong: rgba(255, 255, 255, 0.93);
    --chat-control-bg: rgba(255, 255, 255, 0.88);
    --chat-control-bg-hover: rgba(255, 255, 255, 0.98);
    --chat-list-active-bg: rgba(51, 144, 236, 0.12);
    --chat-stream-bg: rgba(241, 247, 253, 0.9);
    --chat-stream-pattern: rgba(124, 145, 168, 0.08);
    --chat-composer-bg: rgba(248, 252, 255, 0.98);
    --chat-input-bg: rgba(255, 255, 255, 0.92);
    --chat-overlay-bg: rgba(8, 17, 28, 0.28);
    --chat-sheet-bg: rgba(255, 255, 255, 0.96);
    --chat-modal-bg: rgba(255, 255, 255, 0.98);
    --chat-chip-bg: rgba(255, 255, 255, 0.84);
    --chat-toast-bg: rgba(23, 37, 55, 0.94);
    --chat-shell-offset: 0px;
    --chat-local-nav-height: 0px;
    min-height: var(--chat-vh, 100dvh);
    color: var(--chat-text);
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.chat-page.has-app-shell:not(.app-shell-hidden) {
    --chat-shell-offset: calc(78px + env(safe-area-inset-bottom, 0px));
}

body.chat-page.app-shell-hidden {
    --chat-shell-offset: 0px;
}

body.chat-page.chat-modal-open {
    overflow: hidden;
}

html[data-theme="dark"] body.chat-page {
    --chat-bg: #0c141f;
    --chat-surface: rgba(12, 20, 31, 0.86);
    --chat-surface-strong: rgba(16, 25, 40, 0.96);
    --chat-border: rgba(124, 145, 168, 0.2);
    --chat-text: #eef3ff;
    --chat-muted: #9aabc2;
    --chat-accent: #66b7ff;
    --chat-accent-soft: rgba(102, 183, 255, 0.16);
    --chat-bubble: rgba(16, 25, 40, 0.98);
    --chat-bubble-me: linear-gradient(180deg, #1d4f7f 0%, #183f67 100%);
    --chat-danger: #ef7c88;
    --chat-warning: #e5a44b;
    --chat-success: #43c28f;
    --chat-shell-gradient:
        radial-gradient(circle at 12% 8%, rgba(102, 183, 255, 0.14), transparent 28%),
        radial-gradient(circle at 90% 0%, rgba(67, 194, 255, 0.15), transparent 24%),
        linear-gradient(180deg, #182436 0%, #0c141f 100%);
    --chat-header-bg: rgba(16, 25, 40, 0.88);
    --chat-pane-bg: rgba(14, 22, 34, 0.88);
    --chat-pane-bg-strong: rgba(16, 25, 40, 0.94);
    --chat-control-bg: rgba(16, 25, 40, 0.88);
    --chat-control-bg-hover: rgba(22, 34, 52, 0.96);
    --chat-list-active-bg: rgba(102, 183, 255, 0.2);
    --chat-stream-bg: rgba(12, 20, 31, 0.86);
    --chat-stream-pattern: rgba(124, 145, 168, 0.1);
    --chat-composer-bg: rgba(16, 25, 40, 0.9);
    --chat-input-bg: rgba(16, 25, 40, 0.92);
    --chat-overlay-bg: rgba(5, 9, 16, 0.45);
    --chat-sheet-bg: rgba(15, 23, 36, 0.96);
    --chat-modal-bg: rgba(15, 23, 36, 0.98);
    --chat-chip-bg: rgba(16, 25, 40, 0.86);
    --chat-toast-bg: rgba(10, 18, 29, 0.95);
}

body.chat-page .background-overlay {
    background: var(--chat-shell-gradient);
}

body.chat-page input,
body.chat-page textarea,
body.chat-page button {
    font: inherit;
}

body.chat-page button {
    touch-action: manipulation;
}

body.chat-page,
body.chat-page * {
    -webkit-tap-highlight-color: transparent;
}

.chat-app {
    width: min(1440px, 100%);
    flex: 1 1 auto;
    height: 100%;
    min-height: 100%;
    max-height: var(--chat-vh, 100dvh);
    margin: 0 auto;
    padding: calc(0.42rem + env(safe-area-inset-top, 0px)) 0.42rem calc(0.42rem + var(--chat-shell-offset));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 0.42rem;
}

.chat-app__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.62rem;
    border-radius: 20px;
    border: 1px solid var(--chat-border);
    background: var(--chat-header-bg);
    box-shadow: 0 18px 42px -32px rgba(22, 42, 70, 0.18);
    backdrop-filter: blur(16px);
}

.chat-app__identity {
    min-width: 0;
}

.chat-app__identity h1 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 900;
    line-height: 1.4;
}

.chat-app__identity p {
    margin: 0.08rem 0 0;
    color: var(--chat-muted);
    font-size: 0.74rem;
    line-height: 1.55;
}

.chat-app__actions {
    display: flex;
    align-items: center;
    gap: 0.38rem;
}

.chat-back,
.chat-top-btn,
.chat-sheet-close,
.conversation-pane__close,
.thread-head__mobile-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    background: var(--chat-control-bg);
    color: var(--chat-text);
    overflow: hidden;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease;
}

.chat-back:hover,
.chat-back:focus-visible,
.chat-top-btn:hover,
.chat-top-btn:focus-visible,
.chat-sheet-close:hover,
.chat-sheet-close:focus-visible,
.conversation-pane__close:hover,
.conversation-pane__close:focus-visible,
.thread-head__mobile-btn:hover,
.thread-head__mobile-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(43, 109, 243, 0.3);
    background: var(--chat-control-bg-hover);
    box-shadow: 0 12px 24px -20px rgba(22, 42, 70, 0.18);
}

.chat-back svg,
.chat-top-btn svg,
.chat-sheet-close svg,
.conversation-pane__close svg,
.thread-head__mobile-btn svg {
    width: 18px;
    height: 18px;
}

.chat-top-btn-text {
    width: auto;
    min-width: 64px;
    padding-inline: 0.8rem;
    font-size: 0.78rem;
    font-weight: 820;
}

#account-btn {
    font-size: 0.74rem;
    font-weight: 900;
}

#account-btn-avatar-image {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

#account-btn-avatar-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: inherit;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
}

#account-btn[data-has-avatar="1"] #account-btn-avatar-fallback {
    display: none;
}

#account-btn-avatar-image[hidden] {
    display: none !important;
}

.chat-connection {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-height: 34px;
    padding: 0.35rem 0.72rem;
    border-radius: 999px;
    background: var(--chat-control-bg);
    border: 1px solid var(--chat-border);
    color: var(--chat-muted);
    font-size: 0.74rem;
    font-weight: 820;
}

.chat-connection::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.chat-connection[data-state="live"] {
    color: var(--chat-success);
    background: rgba(21, 143, 99, 0.08);
    border-color: rgba(21, 143, 99, 0.16);
}

.chat-connection[data-state="sync"] {
    color: var(--chat-accent);
    background: rgba(43, 109, 243, 0.08);
    border-color: rgba(43, 109, 243, 0.16);
}

.chat-connection[data-state="issue"] {
    color: var(--chat-warning);
    background: rgba(194, 129, 29, 0.08);
    border-color: rgba(194, 129, 29, 0.16);
}

.chat-app__main {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    contain: layout paint;
}

.chat-login-panel,
.chat-stage {
    min-height: 0;
    border-radius: 24px;
    border: 1px solid var(--chat-border);
    background: var(--chat-surface);
    box-shadow: 0 24px 52px -36px rgba(22, 42, 70, 0.22);
    backdrop-filter: blur(18px);
    contain: layout paint;
}

.chat-login-panel {
    width: min(470px, 100%);
    margin: auto;
    padding: 1.1rem;
}

.chat-login-head {
    display: grid;
    gap: 0.24rem;
    margin-bottom: 0.95rem;
}

.chat-login-kicker {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 28px;
    padding: 0.3rem 0.74rem;
    border-radius: 999px;
    background: var(--chat-accent-soft);
    color: var(--chat-accent);
    font-size: 0.74rem;
    font-weight: 840;
}

.chat-login-title {
    margin: 0.08rem 0 0;
    font-size: 1.26rem;
    line-height: 1.42;
    font-weight: 930;
    letter-spacing: -0.03em;
}

.chat-login-text {
    margin: 0;
    color: var(--chat-muted);
    font-size: 0.84rem;
    line-height: 1.85;
}

.chat-guard-actions {
    display: grid;
    gap: 0.7rem;
}

.chat-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 46px;
    border: 0;
    border-radius: 16px;
    background: var(--btn-gradient);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 860;
    box-shadow: var(--btn-shadow);
    transition: transform var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease, filter var(--motion-fast, 0.18s) ease;
}

.chat-login-btn:hover:not(:disabled),
.chat-login-btn:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.chat-login-btn:disabled {
    opacity: 0.65;
    cursor: default;
    box-shadow: none;
}

.chat-secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-text);
    font-size: 0.82rem;
    font-weight: 820;
}

.chat-secondary-link:hover,
.chat-secondary-link:focus-visible {
    border-color: rgba(43, 109, 243, 0.3);
    background: var(--chat-control-bg-hover);
}

.login-feedback {
    min-height: 1.35rem;
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.81rem;
}

.login-feedback.error {
    color: var(--chat-danger);
}

.chat-stage {
    display: grid;
    height: 100%;
    grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
    gap: 0.46rem;
    padding: 0.44rem;
    overflow: hidden;
}

.conversation-pane,
.thread-pane {
    height: 100%;
    min-height: 0;
    border-radius: 20px;
    border: 1px solid var(--chat-border);
    background: var(--chat-pane-bg);
    overflow: hidden;
    contain: layout paint;
}

.conversation-pane {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
}

.conversation-pane__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.56rem 0.62rem 0.42rem;
}

.conversation-pane__header h2 {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 900;
}

.conversation-pane__header p {
    margin: 0.08rem 0 0;
    color: var(--chat-muted);
    font-size: 0.69rem;
}

.conversation-pane__close,
.thread-head__mobile-btn {
    display: none;
}

.conversation-pane__title-block {
    min-width: 0;
}

.conversation-pane__header-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.conversation-pane__icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
    background: var(--chat-control-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.conversation-pane__icon-btn svg {
    width: 17px;
    height: 17px;
}

.conversation-pane__icon-btn:hover,
.conversation-pane__icon-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(51, 144, 236, 0.32);
    background: var(--chat-control-bg-hover);
}

.conversation-search-wrap {
    display: block;
    padding: 0 0.62rem 0.5rem;
}

.conversation-search-wrap input {
    width: 100%;
    min-height: 38px;
    padding: 0.48rem 0.72rem;
    border-radius: 11px;
    border: 1px solid var(--chat-border);
    background: var(--chat-input-bg);
    color: var(--chat-text);
    font-size: 0.78rem;
}

.conversation-search-wrap input:focus {
    border-color: rgba(43, 109, 243, 0.32);
    box-shadow: 0 0 0 3px rgba(43, 109, 243, 0.08);
    outline: 0;
}

.conversation-empty {
    margin: 0 0.62rem 0.62rem;
    padding: 0.5rem 0.62rem;
    border-radius: 10px;
    border: 1px dashed rgba(124, 145, 168, 0.2);
    color: var(--chat-muted);
    font-size: 0.74rem;
}

.conversation-list {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0 0.4rem 0.5rem;
    display: grid;
    gap: 0.14rem;
}

.conversation-manage-bar {
    margin: 0 0.5rem 0.3rem;
    padding: 0.32rem 0.4rem;
    border-radius: 10px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    display: grid;
    gap: 0.22rem;
    position: relative;
}

.conversation-manage-bar__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    min-width: 0;
}

.conversation-manage-bar__head-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    margin-inline-start: auto;
    min-width: 0;
}

.conversation-manage-bar__head strong {
    font-size: 0.66rem;
    font-weight: 760;
    color: var(--chat-muted);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-manage-bar__head button {
    min-height: 24px;
    padding-inline: 0.5rem;
    border-radius: 999px;
    border: none;
    background: none;
    color: var(--chat-accent);
    transition: background var(--motion-fast) var(--motion-ease-standard);
}

body.chat-page .conversation-manage-bar__head button {
    font-size: 0.66rem;
    font-weight: 800;
}

.conversation-manage-bar__head button:hover {
    background: var(--chat-control-bg-hover);
}

.conversation-manage-bar__actions {
    display: flex;
    align-items: center;
    gap: 0.28rem;
    min-height: 28px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -0.4rem;
    padding: 0 0.4rem;
}

.conversation-manage-bar__actions::-webkit-scrollbar {
    display: none;
}

.conversation-manage-bar__actions button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    min-height: 34px;
    padding: 0 0.72rem;
    border-radius: 12px;
    border: 1px solid var(--chat-border);
    background: var(--chat-surface);
    color: var(--chat-text);
    white-space: nowrap;
    transition:
        border-color var(--motion-fast) var(--motion-ease-standard),
        background var(--motion-fast) var(--motion-ease-standard),
        transform var(--motion-fast) var(--motion-ease-standard);
}

.conversation-manage-bar__actions .manage-action__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--chat-muted);
}

.conversation-manage-bar__actions .manage-action__icon svg {
    width: 17px;
    height: 17px;
}

.conversation-manage-bar__actions .manage-action__label {
    line-height: 1;
}

body.chat-page .conversation-manage-bar__actions button {
    font-size: 0.7rem;
    font-weight: 760;
    line-height: 1;
}

.conversation-manage-bar__actions button:not(:disabled):hover,
.conversation-manage-bar__actions button:not(:disabled):focus-visible {
    border-color: rgba(43, 109, 243, 0.24);
    background: var(--chat-control-bg-hover);
    transform: translateY(-1px);
}

.conversation-manage-bar__actions button.is-danger {
    color: var(--chat-danger);
    border-color: rgba(199, 83, 94, 0.26);
    background: rgba(199, 83, 94, 0.08);
}

.conversation-manage-bar__actions button.is-danger .manage-action__icon {
    color: var(--chat-danger);
}

.conversation-manage-bar__actions button.is-danger:not(:disabled):hover,
.conversation-manage-bar__actions button.is-danger:not(:disabled):focus-visible {
    border-color: rgba(199, 83, 94, 0.4);
    background: rgba(199, 83, 94, 0.14);
}

.conversation-manage-bar__actions button:disabled,
.conversation-manage-bar__head button:disabled {
    opacity: 0.46;
    cursor: default;
}

.conversation-list::-webkit-scrollbar {
    width: 8px;
}

.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(124, 145, 168, 0.24);
    border-radius: 999px;
}

.conversation-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.24rem;
    align-items: center;
    width: 100%;
}

.conversation-item__main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.42rem;
    align-items: center;
    width: 100%;
    padding: 0.42rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 13px;
    background: transparent;
    color: var(--chat-text);
    text-align: start;
    position: relative;
    overflow: hidden;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease;
}

.conversation-item__main:hover,
.conversation-item__main:focus-visible {
    border-color: rgba(51, 144, 236, 0.3);
    background: var(--chat-control-bg-hover);
}

.conversation-item__main::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    inset-block: 8px;
    width: 3px;
    border-radius: 999px;
    background: var(--chat-accent);
    opacity: 0;
    transition: opacity var(--motion-fast, 0.18s) ease;
}

.conversation-item.is-active .conversation-item__main {
    border-color: rgba(51, 144, 236, 0.4);
    background: var(--chat-list-active-bg);
}

.conversation-item.is-active .conversation-item__main::before {
    opacity: 1;
}

.conversation-item.is-selected .conversation-item__main {
    border-color: rgba(51, 144, 236, 0.36);
    background: rgba(51, 144, 236, 0.18);
}

.conversation-item.is-archived {
    opacity: 0.84;
}

.conversation-item.is-unread .conversation-item__title {
    font-weight: 920;
}

.conversation-item__tools {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
}

.conversation-item__more,
.conversation-item__select {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--chat-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease;
}

.conversation-item__more {
    font-size: 1rem;
    line-height: 1;
}

.conversation-item__more:hover,
.conversation-item__more:focus-visible,
.conversation-item__select:hover,
.conversation-item__select:focus-within {
    border-color: rgba(51, 144, 236, 0.26);
    background: var(--chat-control-bg-hover);
    color: var(--chat-text);
}

.conversation-item__select {
    opacity: 0;
    pointer-events: none;
    border-radius: 50% !important;
    border-color: transparent !important;
    background: transparent !important;
}

.conversation-item__select input {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border-radius: 50%;
    border: 2px solid var(--chat-muted);
    background: transparent;
    cursor: pointer;
    transition: background 120ms ease, border-color 120ms ease;
    position: relative;
}

.conversation-item__select input:checked {
    background: var(--chat-accent);
    border-color: var(--chat-accent);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 10.5l3.5 3.5 6.5-7' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 100%;
}

body.chat-page.chat-selection-mode .conversation-item__select {
    opacity: 1;
    pointer-events: auto;
}

.conversation-archive-toggle {
    width: 100%;
    margin-top: 0.28rem;
    border: 1px dashed rgba(124, 145, 168, 0.28);
    border-radius: 12px;
    padding: 0.36rem 0.56rem;
    background: transparent;
    color: var(--chat-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.67rem;
    font-weight: 760;
    transition: border-color var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.conversation-archive-toggle:hover,
.conversation-archive-toggle:focus-visible,
.conversation-archive-toggle.is-open {
    border-color: rgba(51, 144, 236, 0.28);
    color: var(--chat-text);
    background: var(--chat-control-bg-hover);
}

.conversation-item__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 900;
    flex-shrink: 0;
}

.conversation-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.conversation-item__avatar[data-has-avatar="1"] span {
    display: none;
}

.conversation-item__avatar img[hidden] {
    display: none !important;
}

.conversation-item__copy {
    min-width: 0;
    display: grid;
    gap: 0.02rem;
}

.conversation-item__head {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.conversation-item__kind {
    width: 1.28rem;
    height: 1.28rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-accent);
    background: rgba(43, 109, 243, 0.1);
    border: 1px solid rgba(43, 109, 243, 0.18);
    flex-shrink: 0;
}

.conversation-item__kind svg {
    width: 0.86rem;
    height: 0.86rem;
    display: block;
}

.conversation-item__preview-row {
    display: flex;
    align-items: baseline;
    min-width: 0;
    gap: 0.3rem;
    overflow: hidden;
}

.conversation-item__title,
.conversation-item__subtitle,
.conversation-item__preview {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item__title {
    font-size: 0.75rem;
    font-weight: 880;
}

.conversation-item__subtitle {
    font-size: 0.63rem;
    color: var(--chat-muted);
    flex: 0 0 auto;
}

.conversation-item__preview {
    color: var(--chat-muted);
    font-size: 0.67rem;
    display: block;
    flex: 1 1 auto;
}

.conversation-badge {
    display: inline-flex;
    align-items: center;
    min-height: 17px;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: rgba(43, 109, 243, 0.12);
    color: var(--chat-accent);
    font-size: 0.58rem;
    font-weight: 820;
}

.conversation-item__meta {
    display: grid;
    justify-items: end;
    gap: 0.12rem;
}

.conversation-item__flags {
    display: inline-flex;
    align-items: center;
    gap: 0.16rem;
}

.conversation-flag {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    opacity: 0.9;
}

.conversation-flag--muted {
    background: var(--chat-muted);
}

.conversation-flag--pinned {
    background: var(--chat-accent);
}

.conversation-flag--archived {
    background: rgba(124, 145, 168, 0.7);
}

.conversation-item__time {
    font-size: 0.6rem;
    color: var(--chat-muted);
}

.conversation-item__unread {
    min-width: 19px;
    height: 19px;
    padding-inline: 0.24rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--chat-accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 900;
}

.thread-pane {
    position: relative;
    min-width: 0;
    display: grid;
}

.thread-placeholder,
.thread-shell {
    min-height: 0;
}

.thread-placeholder {
    display: grid;
    place-content: center;
    gap: 0.22rem;
    padding: 0.9rem;
    text-align: center;
    color: var(--chat-muted);
}

.thread-placeholder strong {
    color: var(--chat-text);
    font-size: 1rem;
}

.thread-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.thread-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.38rem;
    padding: 0.42rem 0.52rem;
    border-bottom: 1px solid var(--chat-border);
    background: var(--chat-header-bg);
}

.thread-head__identity {
    min-width: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: start;
    display: flex;
    align-items: center;
    gap: 0.44rem;
}

.thread-head__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    flex-shrink: 0;
}

.thread-head__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thread-head__avatar[data-has-avatar="1"] span {
    display: none;
}

.thread-head__avatar img[hidden] {
    display: none !important;
}

.thread-head__copy {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.thread-head__copy strong,
.thread-head__copy span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.thread-head__copy strong {
    font-size: 0.9rem;
    font-weight: 900;
}

.thread-head__copy span {
    color: var(--chat-muted);
    font-size: 0.72rem;
}

.thread-head__actions {
    display: flex;
    align-items: center;
    gap: 0.24rem;
}

.thread-banner-stack {
    padding: 0.28rem 0.42rem 0;
    display: grid;
    gap: 0.22rem;
}

.chat-mute-strip {
    margin: 0;
    padding: 0.42rem 0.68rem;
    border-radius: 10px;
    background: rgba(199, 83, 94, 0.08);
    border: 1px solid rgba(199, 83, 94, 0.16);
    color: var(--chat-danger);
    font-size: 0.76rem;
}

.chat-pinned-strip {
    margin: 0;
    padding: 0.48rem 0.62rem;
    display: grid;
    grid-template-columns: 3px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.7rem;
    border: 1px solid rgba(43, 109, 243, 0.2);
    border-radius: 10px;
    background: var(--chat-chip-bg);
    color: var(--chat-text);
    text-align: start;
}

.chat-pinned-strip:hover,
.chat-pinned-strip:focus-visible {
    border-color: rgba(43, 109, 243, 0.34);
    background: var(--chat-control-bg-hover);
}

.chat-pinned-strip__line {
    width: 3px;
    align-self: stretch;
    border-radius: 999px;
    background: linear-gradient(180deg, #2b6df3 0%, #5ea0ff 100%);
}

.chat-pinned-strip__copy {
    min-width: 0;
    display: grid;
    gap: 0.08rem;
}

.chat-pinned-strip__copy strong {
    font-size: 0.7rem;
    color: var(--chat-accent);
}

.chat-pinned-strip__copy span {
    color: var(--chat-muted);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-pinned-strip__action {
    color: var(--chat-accent);
    font-size: 0.66rem;
    font-weight: 820;
}

.thread-stream {
    position: relative;
    flex: 1 1 auto;
    display: grid;
    min-height: 0;
    overflow: hidden;
}

.stream-state {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: grid;
    place-content: center;
    gap: 0.26rem;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--chat-muted);
    background:
        linear-gradient(var(--chat-stream-bg), var(--chat-stream-bg)),
        radial-gradient(circle at 1px 1px, var(--chat-stream-pattern) 1px, transparent 0);
    background-size: auto, 28px 28px;
}

.stream-state strong {
    font-size: 1rem;
    font-weight: 920;
    color: var(--chat-text);
}

.stream-state span {
    font-size: 0.82rem;
}

.messages {
    direction: ltr;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    height: auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0.48rem 0.52rem 0.38rem;
    background:
        linear-gradient(var(--chat-stream-bg), var(--chat-stream-bg)),
        radial-gradient(circle at 1px 1px, var(--chat-stream-pattern) 1px, transparent 0);
    background-size: auto, 28px 28px;
    scroll-behavior: smooth;
}

.messages > .msg-item {
    width: 100%;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-thumb {
    background: rgba(124, 145, 168, 0.22);
    border-radius: 999px;
}

.msg-item {
    direction: rtl;
    margin-bottom: 0.06rem;
}

.msg-item.is-new {
    animation: chat-message-in var(--motion-base) var(--motion-ease-standard);
    transform-origin: bottom center;
}

.msg-item.me.is-new {
    transform-origin: bottom left;
}

.msg-item.other.is-new {
    transform-origin: bottom right;
}

.msg-row {
    display: flex;
    direction: ltr;
    align-items: flex-end;
    gap: 0.28rem;
}

.msg-item.me .msg-row {
    justify-content: flex-end;
}

.msg-item.other .msg-row {
    justify-content: flex-start;
}

.msg-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(160deg, #97a9bc, #75889d);
    overflow: hidden;
    position: relative;
    transition:
        opacity var(--motion-fast) var(--motion-ease-standard),
        transform var(--motion-fast) var(--motion-ease-standard);
}

.msg-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.msg-avatar__fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    border-radius: inherit;
    background: inherit;
    color: #fff;
    font-size: 0.74rem;
    font-weight: 900;
}

.msg-avatar[data-has-avatar="1"] .msg-avatar__fallback {
    display: none;
}

.msg-avatar__img[hidden] {
    display: none !important;
}

.msg-item.me .msg-avatar .msg-avatar__fallback {
    background: linear-gradient(160deg, #2f72f2, #5b99ff);
}

.msg-item.grouped-with-prev .msg-avatar {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.msg-bubble {
    position: relative;
    max-width: min(74%, 700px);
    padding: 0.36rem 0.58rem 0.28rem;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-bubble);
    box-shadow: 0 10px 24px -22px rgba(22, 42, 70, 0.12);
    transition: transform var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease;
}

.msg-item.me .msg-bubble {
    background: var(--chat-bubble-me);
    border-color: rgba(51, 144, 236, 0.24);
}

.msg-item.delivery-failed .msg-bubble {
    border-color: rgba(199, 83, 94, 0.28);
    background: rgba(199, 83, 94, 0.08);
}

.msg-item.delivery-sending .msg-bubble {
    opacity: 0.82;
}

.msg-item.other.group-single .msg-bubble,
.msg-item.other.group-end .msg-bubble {
    border-bottom-right-radius: 8px;
}

.msg-item.other.group-start .msg-bubble,
.msg-item.other.group-middle .msg-bubble {
    border-top-right-radius: 10px;
    border-bottom-right-radius: 12px;
}

.msg-item.me.group-single .msg-bubble,
.msg-item.me.group-end .msg-bubble {
    border-bottom-left-radius: 8px;
}

.msg-item.me.group-start .msg-bubble,
.msg-item.me.group-middle .msg-bubble {
    border-top-left-radius: 10px;
    border-bottom-left-radius: 12px;
}

.msg-item:hover .msg-bubble,
.msg-item.is-menu-open .msg-bubble {
    box-shadow: 0 16px 30px -24px rgba(22, 42, 70, 0.16);
}

.msg-head {
    display: flex;
    align-items: center;
    gap: 0.34rem;
    margin-bottom: 0.16rem;
}

.msg-item.me .msg-head,
.msg-item.grouped-with-prev .msg-head {
    display: none;
}

.msg-name {
    font-size: 0.71rem;
    font-weight: 900;
    color: var(--chat-accent);
}

.msg-badge,
.msg-flag {
    display: inline-flex;
    align-items: center;
    min-height: 16px;
    padding: 0 0.34rem;
    border-radius: 999px;
    background: rgba(43, 109, 243, 0.08);
    color: var(--chat-accent);
    font-size: 0.58rem;
    font-weight: 780;
}

.msg-text {
    color: var(--chat-text);
    font-size: 0.81rem;
    line-height: 1.66;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-text:empty {
    display: none;
}

.msg-text--caption {
    margin-top: 0.16rem;
}

.msg-attachments {
    margin-top: 0.32rem;
    display: grid;
    gap: 0.36rem;
}

.msg-media-album {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.24rem;
}

.msg-media-album[data-count="3"] .msg-media-album__tile:first-child {
    grid-column: 1 / -1;
    min-height: 178px;
}

.msg-media-album__tile {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(5, 10, 18, 0.9);
    cursor: zoom-in;
}

.msg-media-album__tile img,
.msg-media-album__tile video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.msg-attachment {
    display: grid;
    gap: 0.3rem;
    padding: 0.42rem 0.5rem;
    border-radius: 11px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
}

.msg-attachment__media {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--chat-border);
    background: rgba(5, 10, 18, 0.88);
    cursor: zoom-in;
}

.msg-attachment__media img {
    display: block;
    width: 100%;
    max-height: min(460px, 62vh);
    object-fit: contain;
    background: rgba(5, 10, 18, 0.88);
}

.msg-attachment__media video {
    display: block;
    width: 100%;
    max-height: min(460px, 62vh);
    object-fit: contain;
    background: #000;
}

.msg-media-preview__play,
.msg-media-preview__badge {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.msg-media-preview__play {
    inset: 50% auto auto 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border-radius: 50%;
    background: rgba(5, 10, 18, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(8px);
}

.msg-media-preview__play::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    margin: -7px 0 0 -4px;
    border-style: solid;
    border-width: 7px 0 7px 11px;
    border-color: transparent transparent transparent rgba(255, 255, 255, 0.92);
}

.msg-media-preview__badge {
    inset-inline-end: 0.42rem;
    bottom: 0.42rem;
    min-height: 24px;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: rgba(5, 10, 18, 0.58);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 780;
    display: inline-flex;
    align-items: center;
    backdrop-filter: blur(6px);
}

.msg-attachment__audio {
    width: 100%;
    min-height: 34px;
}

.msg-attachment__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
}

.msg-attachment__name {
    min-width: 0;
    font-size: 0.76rem;
    font-weight: 780;
    color: var(--chat-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msg-attachment__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--chat-muted);
    font-size: 0.64rem;
    white-space: nowrap;
}

.msg-attachment__actions {
    display: flex;
    align-items: center;
    gap: 0.34rem;
}

.msg-attachment__link {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 0.52rem;
    border-radius: 999px;
    border: 1px solid rgba(43, 109, 243, 0.24);
    background: rgba(43, 109, 243, 0.1);
    color: var(--chat-accent);
    font-size: 0.65rem;
    font-weight: 780;
    text-decoration: none;
    cursor: pointer;
}

.msg-attachment__link[aria-disabled="true"] {
    border-color: var(--chat-border);
    background: rgba(127, 145, 165, 0.12);
    color: var(--chat-muted);
    pointer-events: none;
    cursor: default;
}

.msg-attachment__state {
    color: var(--chat-muted);
    font-size: 0.65rem;
}

.msg-attachment__state.is-expired {
    color: var(--chat-danger);
}

.reply-preview {
    margin: 0 0 0.32rem;
    padding: 0.36rem 0.52rem;
    border-radius: 9px;
    border: 0;
    border-inline-end: 3px solid rgba(43, 109, 243, 0.34);
    background: rgba(43, 109, 243, 0.07);
    color: var(--chat-muted);
    font-size: 0.67rem;
    line-height: 1.7;
    text-align: start;
    width: 100%;
    cursor: pointer;
}

.reply-preview:hover,
.reply-preview:focus-visible {
    background: rgba(43, 109, 243, 0.12);
    outline: 0;
}

.reply-preview b {
    color: var(--chat-text);
}

.msg-forwarded {
    width: 100%;
    margin: 0 0 0.28rem;
    padding: 0.38rem 0.54rem;
    border: 0;
    border-radius: 10px;
    border-inline-end: 3px solid color-mix(in srgb, var(--chat-bale-green) 44%, var(--chat-accent));
    background: color-mix(in srgb, var(--chat-bale-green-soft) 72%, transparent);
    color: var(--chat-text);
    display: grid;
    gap: 0.08rem;
    text-align: start;
    cursor: pointer;
}

.msg-forwarded:disabled {
    cursor: default;
    opacity: 0.82;
}

.msg-forwarded__kicker {
    color: var(--chat-bale-green);
    font-size: 0.64rem;
    font-weight: 860;
}

.msg-forwarded__preview {
    font-size: 0.73rem;
    line-height: 1.62;
    color: var(--chat-text);
}

.msg-forwarded__meta {
    color: var(--chat-muted);
    font-size: 0.62rem;
}

.msg-foot {
    margin-top: 0.14rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.26rem;
    color: var(--chat-muted);
    font-size: 0.62rem;
}

.msg-flags {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    flex-wrap: wrap;
}

.msg-time {
    white-space: nowrap;
}

.msg-reactions {
    margin-top: 0.28rem;
    display: flex;
    align-items: center;
    gap: 0.32rem;
    flex-wrap: wrap;
}

.msg-reaction {
    display: inline-flex;
    align-items: center;
    gap: 0.24rem;
    min-height: 24px;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    color: var(--chat-text);
    font-size: 0.68rem;
    font-weight: 760;
    cursor: pointer;
    transition: border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.msg-reaction:hover,
.msg-reaction:focus-visible {
    border-color: rgba(43, 109, 243, 0.3);
    background: rgba(43, 109, 243, 0.08);
}

.msg-reaction.is-own {
    background: rgba(43, 109, 243, 0.1);
    border-color: rgba(43, 109, 243, 0.24);
    color: var(--chat-accent);
}

.msg-reaction__count {
    font-size: 0.62rem;
    color: var(--chat-muted);
}

.msg-delivery {
    color: var(--chat-muted);
    font-size: 0.62rem;
    font-weight: 760;
    white-space: nowrap;
}

.msg-delivery.is-seen {
    color: var(--chat-accent);
}

.composer {
    flex: 0 0 auto;
    padding: 0.44rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--chat-border);
    background: var(--chat-composer-bg);
    backdrop-filter: blur(16px);
}

.reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.34rem;
    padding: 0.4rem 0.52rem;
    border-radius: 11px;
    background: rgba(43, 109, 243, 0.08);
    border: 1px solid rgba(43, 109, 243, 0.12);
    color: var(--chat-muted);
    font-size: 0.7rem;
}

.reply-bar__copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.32rem;
    flex-wrap: wrap;
}

.reply-bar__label,
.reply-bar b {
    color: var(--chat-text);
    font-weight: 840;
}

.reply-cancel {
    border: 0;
    background: transparent;
    color: var(--chat-accent);
    font-weight: 840;
}

.composer-box {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.42rem;
    padding: 0.26rem;
    border-radius: 20px;
    border: 1px solid var(--chat-border);
    background: var(--chat-input-bg);
    transition: border-color var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.composer-box:focus-within {
    border-color: rgba(43, 109, 243, 0.26);
    box-shadow: 0 0 0 3px rgba(43, 109, 243, 0.06);
    background: var(--chat-control-bg-hover);
}

.composer-tools {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
}

.composer-tool {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    color: var(--chat-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.composer-tool svg {
    width: 17px;
    height: 17px;
}

.composer-tool:hover,
.composer-tool:focus-visible,
.composer-tool.is-open,
.composer-tool.is-recording {
    border-color: rgba(43, 109, 243, 0.32);
    color: var(--chat-accent);
    background: rgba(43, 109, 243, 0.1);
}

.composer-upload-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5.2rem, 1fr));
    gap: 0.32rem;
    margin-bottom: 0.38rem;
}

.composer-upload-sheet::-webkit-scrollbar {
    height: 0;
}

.composer-upload-option {
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    color: var(--chat-text);
    min-height: 34px;
    border-radius: 12px;
    padding: 0.34rem 0.52rem;
    font-size: 0.7rem;
    font-weight: 790;
    white-space: nowrap;
    text-align: center;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease;
}

.composer-upload-option:hover,
.composer-upload-option:focus-visible {
    border-color: rgba(43, 109, 243, 0.32);
    background: rgba(43, 109, 243, 0.1);
    color: var(--chat-accent);
    transform: translateY(-1px);
}

.composer-uploads {
    margin-bottom: 0.38rem;
    display: grid;
    gap: 0.3rem;
}

.composer-upload-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.48rem;
    border-radius: 12px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
}

.composer-upload-item__preview {
    position: relative;
    width: 58px;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(5, 10, 18, 0.88);
    cursor: zoom-in;
}

.composer-upload-item__preview img,
.composer-upload-item__preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.composer-upload-item__preview--file {
    background: var(--chat-control-bg);
    color: var(--chat-muted);
    cursor: default;
}

.composer-upload-item__preview-icon {
    font-size: 0.58rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.composer-upload-item__order {
    position: absolute;
    top: 0.28rem;
    inset-inline-start: 0.28rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: rgba(5, 10, 18, 0.68);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 820;
    backdrop-filter: blur(8px);
}

.composer-upload-item__copy {
    min-width: 0;
    flex: 1;
}

.composer-upload-item__name {
    color: var(--chat-text);
    font-size: 0.72rem;
    font-weight: 780;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composer-upload-item__meta {
    color: var(--chat-muted);
    font-size: 0.64rem;
}

.composer-upload-item__progress {
    margin-top: 0.2rem;
    width: 100%;
    height: 5px;
    border-radius: 999px;
    background: rgba(127, 145, 165, 0.24);
    overflow: hidden;
}

.composer-upload-item__progress > span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-color);
}

.composer-upload-item__actions {
    display: grid;
    gap: 0.3rem;
}

.composer-upload-item__edit,
.composer-upload-item__move,
.composer-upload-item__remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.82rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.composer-upload-item__edit,
.composer-upload-item__move {
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-text);
}

.composer-upload-item__edit svg {
    width: 15px;
    height: 15px;
}

.composer-upload-item__move:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.composer-upload-item__remove {
    border: 1px solid rgba(199, 83, 94, 0.18);
    background: rgba(199, 83, 94, 0.12);
    color: var(--chat-danger);
    font-size: 0.9rem;
}

.composer-voice {
    margin-bottom: 0.38rem;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: 0.54rem;
    padding: 0.46rem 0.56rem;
    border-radius: 14px;
    border: 1px solid rgba(43, 109, 243, 0.2);
    background:
        linear-gradient(180deg, rgba(43, 109, 243, 0.13), rgba(43, 109, 243, 0.08)),
        var(--chat-chip-bg);
}

.composer-voice__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--chat-danger);
    box-shadow: 0 0 0 0 rgba(199, 83, 94, 0.44);
    animation: composer-voice-pulse 1.45s var(--motion-ease-soft) infinite;
}

.composer-voice__timer {
    min-width: 48px;
    font-size: 0.78rem;
    font-weight: 850;
    color: var(--chat-text);
}

.composer-voice__actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.composer-voice__actions .shell-action-btn {
    min-height: 32px;
    padding-inline: 0.64rem;
    font-size: 0.68rem;
    border-radius: 10px;
}

@keyframes composer-voice-pulse {
    0% {
        transform: scale(0.92);
        box-shadow: 0 0 0 0 rgba(199, 83, 94, 0.34);
    }
    48% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(199, 83, 94, 0);
    }
    100% {
        transform: scale(0.92);
        box-shadow: 0 0 0 0 rgba(199, 83, 94, 0);
    }
}

.composer-entry textarea {
    width: 100%;
    min-height: 38px;
    max-height: 184px;
    padding: 0.45rem 0.62rem;
    border-radius: 14px;
    border: 0;
    resize: none;
    background: transparent;
    color: var(--chat-text);
    line-height: 1.72;
    font-size: 0.8rem;
    box-shadow: none !important;
}

.composer-entry {
    min-width: 0;
}

.composer-send {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: var(--btn-gradient);
    color: #fff;
    box-shadow: var(--btn-shadow);
    transition: transform var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease, filter var(--motion-fast, 0.18s) ease, opacity var(--motion-fast, 0.18s) ease;
}

.composer-send svg {
    width: 16px;
    height: 16px;
}

.composer-send:hover:not(:disabled),
.composer-send:focus-visible {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.composer-send:disabled {
    opacity: 0.58;
    cursor: default;
    box-shadow: none;
}

.composer-status {
    min-height: 0.84rem;
    margin-top: 0.24rem;
    color: var(--chat-muted);
    font-size: 0.64rem;
}

.composer-status.error {
    color: var(--chat-danger);
}

.composer-storage-note {
    margin-top: 0.14rem;
    color: var(--chat-muted);
    font-size: 0.62rem;
    line-height: 1.7;
}

.chat-context-backdrop,
.chat-list-context-backdrop,
.chat-sheet-backdrop,
.chat-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 260;
    background: var(--chat-overlay-bg);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.chat-context-backdrop.is-open,
.chat-list-context-backdrop.is-open,
.chat-sheet-backdrop.is-open,
.chat-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.chat-context-menu {
    position: fixed;
    z-index: 270;
    display: flex;
    flex-direction: column;
    min-width: 224px;
    max-width: min(290px, calc(100vw - 1rem));
    max-height: min(72vh, 560px);
    padding: 0.34rem;
    border-radius: var(--chat-radius-menu);
    border: 1px solid var(--chat-hairline);
    background: var(--chat-sheet-bg);
    box-shadow: var(--chat-menu-shadow);
    backdrop-filter: blur(18px);
    transform: translateY(6px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    overflow: hidden;
}

.chat-list-context-menu {
    position: fixed;
    z-index: 270;
    min-width: 240px;
    max-width: min(300px, calc(100vw - 1rem));
    padding: 0.5rem;
    border-radius: 18px;
    border: 1px solid var(--chat-border);
    background: var(--chat-sheet-bg);
    box-shadow: 0 28px 60px -34px rgba(18, 30, 48, 0.28);
    backdrop-filter: blur(18px);
    transform: translateY(6px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.chat-context-menu.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-list-context-menu.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.chat-list-context-menu__head {
    display: grid;
    gap: 0.08rem;
    margin-bottom: 0.42rem;
    padding: 0.2rem 0.24rem 0.12rem;
}

.chat-list-context-menu__head strong {
    font-size: 0.76rem;
    font-weight: 860;
    color: var(--chat-text);
}

.chat-list-context-menu__head span {
    font-size: 0.66rem;
    color: var(--chat-muted);
}

.chat-reaction-bar {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    flex: 0 0 auto;
    margin-bottom: 0.34rem;
    padding: 0.16rem;
    border-radius: var(--chat-radius-pill);
    background: var(--chat-control-bg);
    border: 1px solid var(--chat-hairline);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    pointer-events: none;
}

.chat-reaction-bar::-webkit-scrollbar {
    display: none;
}

.chat-reaction-bar:empty {
    display: none;
}

.chat-list-context-action,
.chat-sheet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 40px;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-text);
    font-size: 0.8rem;
    font-weight: 780;
    pointer-events: auto;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.chat-list-context-action:hover,
.chat-list-context-action:focus-visible,
.chat-sheet-btn:hover,
.chat-sheet-btn:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(43, 109, 243, 0.22);
    background: var(--chat-control-bg-hover);
}

/* Message reaction pill: light, circular, borderless emoji buttons */
.chat-reaction-btn {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--chat-text);
    font-size: 20px;
    line-height: 1;
    pointer-events: auto;
    transition: transform var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease;
}

.chat-reaction-btn:hover,
.chat-reaction-btn:focus-visible {
    transform: scale(1.16);
    background: var(--chat-row-hover);
}

.chat-reaction-btn.is-active {
    background: var(--chat-accent-soft);
}

.chat-reaction-btn-more {
    font-size: 18px;
    color: var(--chat-muted);
    background: var(--chat-control-bg-hover);
}

.chat-context-actions {
    display: grid;
    gap: var(--chat-row-gap);
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.chat-list-context-actions {
    display: grid;
    gap: 0.26rem;
}

.chat-context-action {
    justify-content: initial;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 0.66rem;
    min-height: var(--chat-row-min);
    padding: 0 0.7rem;
    border: 0;
    border-radius: var(--chat-radius-row);
    background: transparent;
    color: var(--chat-text);
    font-size: 0.82rem;
    font-weight: 600;
    pointer-events: auto;
    direction: rtl;
    unicode-bidi: isolate;
    text-align: start;
    transition: background var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease;
}

.chat-context-action:hover,
.chat-context-action:focus-visible {
    background: var(--chat-row-hover);
}

.chat-context-action__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--chat-muted);
}

.chat-context-action__icon svg {
    width: 19px;
    height: 19px;
}

.chat-context-action__hint {
    display: none;
}

.chat-list-context-action {
    justify-content: initial;
    display: flex;
    align-items: center;
    gap: 0.62rem;
    padding: 0.54rem 0.74rem;
    direction: rtl;
    unicode-bidi: isolate;
    text-align: start;
}

.chat-list-context-action__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    opacity: 0.68;
}

.chat-list-context-action__hint {
    display: none;
}

.chat-context-action__label,
.chat-context-action__hint,
.chat-list-context-action__label,
.chat-list-context-action__hint {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
    unicode-bidi: isolate;
}

.chat-context-action__hint {
    font-size: 0.72rem;
    color: var(--chat-muted);
    font-weight: 820;
}

.chat-list-context-action__hint {
    font-size: 0.69rem;
    color: var(--chat-muted);
    font-weight: 800;
}

.chat-context-action.is-danger,
.chat-list-context-action.is-danger,
.chat-sheet-btn-danger {
    color: var(--chat-danger);
    background: rgba(199, 83, 94, 0.08);
    border-color: rgba(199, 83, 94, 0.16);
}

/* Borderless message-menu delete row: red text/icon, tint only on hover */
.chat-context-action.is-danger {
    background: transparent;
}

.chat-context-action.is-danger .chat-context-action__icon {
    color: var(--chat-danger);
}

.chat-context-action.is-danger:hover,
.chat-context-action.is-danger:focus-visible {
    background: rgba(199, 83, 94, 0.12);
}

.chat-info-sheet {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 275;
    width: min(400px, 100vw);
    padding: calc(0.95rem + env(safe-area-inset-top, 0px)) 0.9rem calc(0.95rem + env(safe-area-inset-bottom, 0px) + var(--chat-shell-offset));
    border-inline-start: 1px solid var(--chat-border);
    background: var(--chat-sheet-bg);
    box-shadow: -28px 0 60px -42px rgba(18, 30, 48, 0.28);
    backdrop-filter: blur(18px);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition:
        transform var(--motion-slow) var(--motion-ease-soft),
        opacity var(--motion-base) var(--motion-ease-soft);
    overflow: auto;
    overscroll-behavior: contain;
}

.chat-info-sheet.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-peer-sheet {
    position: fixed;
    inset-block: 0;
    inset-inline-end: 0;
    z-index: 280;
    width: min(400px, 100vw);
    padding: calc(0.95rem + env(safe-area-inset-top, 0px)) 0.9rem calc(0.95rem + env(safe-area-inset-bottom, 0px) + var(--chat-shell-offset));
    border-inline-start: 1px solid var(--chat-border);
    background: var(--chat-sheet-bg);
    box-shadow: -28px 0 60px -42px rgba(18, 30, 48, 0.28);
    backdrop-filter: blur(18px);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition:
        transform var(--motion-slow) var(--motion-ease-soft),
        opacity var(--motion-base) var(--motion-ease-soft);
    overflow: auto;
    overscroll-behavior: contain;
}

.chat-peer-sheet.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-info-sheet__topbar {
    display: flex;
    justify-content: flex-end;
}

.chat-info-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.3rem;
    padding: 0.1rem 0.6rem 1.05rem;
    border: 0;
    background: none;
    text-align: center;
    cursor: default;
    font: inherit;
    color: inherit;
}

.chat-info-profile.is-clickable {
    cursor: pointer;
    border-radius: 16px;
    transition: background var(--motion-fast) var(--motion-ease-standard);
}

.chat-info-profile.is-clickable:hover,
.chat-info-profile.is-clickable:focus-visible {
    background: var(--chat-control-bg);
}

.chat-info-profile__avatar {
    position: relative;
    width: 96px;
    height: 96px;
    margin-bottom: 0.3rem;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
}

.chat-info-profile__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-info-profile__avatar[data-has-avatar="1"] span {
    display: none;
}

.chat-info-profile__avatar img[hidden] {
    display: none !important;
}

.chat-info-profile__name {
    margin: 0;
    font-size: 1.16rem;
    font-weight: 900;
    color: var(--chat-text);
}

.chat-info-profile__status {
    margin: 0;
    color: var(--chat-muted);
    font-size: 0.82rem;
}

.chat-info-profile__about {
    margin: 0.35rem 0 0;
    max-width: 100%;
    color: var(--chat-text);
    font-size: 0.82rem;
    line-height: 1.8;
}

.chat-info-quick-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--chat-border);
}

.chat-info-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.32rem;
    min-width: 64px;
    padding: 0.5rem 0.4rem;
    border: 0;
    border-radius: 14px;
    background: none;
    color: var(--chat-text);
    font-size: 0.7rem;
    font-weight: 760;
    transition:
        background var(--motion-fast) var(--motion-ease-standard),
        color var(--motion-fast) var(--motion-ease-standard);
}

.chat-info-quick-action:hover,
.chat-info-quick-action:focus-visible {
    background: var(--chat-control-bg);
}

.chat-info-quick-action__icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--chat-chip-bg);
    color: var(--chat-accent);
}

.chat-info-quick-action__icon svg {
    width: 20px;
    height: 20px;
}

.chat-info-quick-action.is-active .chat-info-quick-action__icon {
    color: #c94155;
}

.chat-info-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--chat-border);
}

.chat-info-block__label {
    display: block;
    margin-bottom: 0.55rem;
    color: var(--chat-muted);
    font-size: 0.74rem;
    font-weight: 820;
}

.chat-info-members {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    overflow: hidden;
}

.chat-info-rows {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    overflow: hidden;
}

.chat-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.64rem 0.76rem;
    border-bottom: 1px solid var(--chat-border);
}

.chat-info-row:last-child {
    border-bottom: none;
}

.chat-info-row--empty {
    justify-content: center;
    color: var(--chat-muted);
    font-size: 0.74rem;
}

.chat-info-row__label {
    color: var(--chat-muted);
    font-size: 0.73rem;
    font-weight: 760;
}

.chat-info-row__value {
    color: var(--chat-text);
    font-size: 0.74rem;
    font-weight: 820;
}

.chat-info-row__value--good {
    color: #0b8a5f;
}

.chat-info-row__value--danger {
    color: #c94155;
}

.chat-info-row__value--muted {
    color: var(--chat-muted);
}

.chat-member {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.62rem;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--chat-border);
}

.chat-member:last-child {
    border-bottom: none;
}

.chat-member--empty {
    grid-template-columns: 1fr;
}

.chat-member--clickable {
    cursor: pointer;
    transition: background var(--motion-fast) var(--motion-ease-standard);
}

.chat-member--clickable:hover,
.chat-member--clickable:focus-visible {
    background: var(--chat-control-bg);
}

.chat-member__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
    font-size: 0.76rem;
    font-weight: 900;
    flex-shrink: 0;
}

.chat-member__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.chat-member__avatar[data-has-avatar="1"] span {
    display: none;
}

.chat-member__avatar img[hidden] {
    display: none !important;
}

.chat-member__copy {
    min-width: 0;
    display: grid;
    gap: 0.04rem;
}

.chat-member__copy strong,
.chat-member__copy span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-member strong {
    font-size: 0.82rem;
}

.chat-member__menu-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--chat-muted);
    flex-shrink: 0;
    transition:
        background var(--motion-fast) var(--motion-ease-standard),
        color var(--motion-fast) var(--motion-ease-standard);
}

.chat-member__menu-btn:hover,
.chat-member__menu-btn:focus-visible {
    background: var(--chat-control-bg);
    color: var(--chat-text);
}

.chat-member__menu-btn svg {
    width: 18px;
    height: 18px;
}

.chat-member span {
    color: var(--chat-muted);
    font-size: 0.74rem;
}

.chat-info-actions-list {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    overflow: hidden;
}

.chat-info-action-row,
.chat-info-link-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.66rem 0.8rem;
    border: 0;
    border-bottom: 1px solid var(--chat-border);
    background: none;
    color: var(--chat-text);
    font: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--motion-fast) var(--motion-ease-standard);
}

.chat-info-action-row:last-child,
.chat-info-link-row:last-child {
    border-bottom: none;
}

.chat-info-action-row:hover,
.chat-info-action-row:focus-visible,
.chat-info-link-row:hover,
.chat-info-link-row:focus-visible {
    background: var(--chat-control-bg-hover);
}

.chat-info-action-row__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--chat-control-bg);
    color: var(--chat-accent);
    flex-shrink: 0;
}

.chat-info-action-row__icon svg {
    width: 18px;
    height: 18px;
}

.chat-info-action-row__label {
    font-size: 0.84rem;
    font-weight: 760;
}

.chat-info-action-row--danger {
    color: #c94155;
}

.chat-info-action-row--danger .chat-info-action-row__icon {
    color: #c94155;
}

.chat-modal {
    position: fixed;
    inset-inline: 50%;
    inset-block-start: 50%;
    transform: translate(-50%, -50%) scale(0.96);
    z-index: 280;
    width: min(460px, calc(100vw - 1rem));
    max-height: calc(var(--chat-vh, 100dvh) - 1.2rem);
    border: 1px solid var(--chat-border);
    border-radius: 20px;
    background: var(--chat-modal-bg);
    box-shadow: 0 28px 60px -34px rgba(18, 30, 48, 0.28);
    backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.chat-modal--group {
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-modal--forward {
    width: min(520px, calc(100vw - 1rem));
}

.chat-modal--reaction {
    width: min(540px, calc(100vw - 1rem));
    grid-template-rows: auto auto minmax(0, 1fr);
}

.chat-modal--edit {
    width: min(560px, calc(100vw - 1rem));
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-modal--poll {
    width: min(560px, calc(100vw - 1rem));
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.poll-options-list {
    display: grid;
    gap: 0.34rem;
}

.poll-option-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem;
}

.poll-option-row input {
    width: 100%;
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    padding: 0.48rem 0.62rem;
    background: var(--chat-input-bg);
    color: var(--chat-text);
    font-size: 0.8rem;
}

.poll-option-row input:focus {
    border-color: rgba(43, 109, 243, 0.32);
    box-shadow: 0 0 0 3px rgba(43, 109, 243, 0.08);
    outline: 0;
}

.poll-option-remove {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-muted-strong);
    display: grid;
    place-items: center;
    flex: none;
}

.poll-option-remove:hover,
.poll-option-remove:focus-visible {
    color: var(--chat-danger);
    border-color: rgba(229, 84, 84, 0.32);
}

.poll-option-remove svg {
    width: 16px;
    height: 16px;
}

.poll-add-option-btn {
    justify-self: start;
    min-height: 38px;
    padding: 0 0.9rem;
    border-radius: 10px;
    border: 1px dashed var(--chat-border);
    background: transparent;
    color: var(--chat-accent);
    font-size: 0.76rem;
    font-weight: 830;
}

.chat-modal--confirm {
    width: min(430px, calc(100vw - 1rem));
    grid-template-rows: auto auto auto;
}

.chat-modal--group .group-flow-step {
    grid-row: 2;
    min-height: 0;
}

.chat-modal--group .group-flow-step.is-active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
}

.chat-modal--group .chat-modal__footer {
    grid-row: 3;
    position: sticky;
    inset-block-end: 0;
    z-index: 2;
    border-top: 1px solid var(--chat-border);
    background: var(--chat-modal-bg);
}

.chat-modal.is-open {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}

.chat-modal.is-busy .chat-modal__body,
.chat-modal.is-busy .chat-modal__footer {
    pointer-events: none;
    opacity: 0.66;
}

.chat-modal.is-busy .chat-sheet-close {
    pointer-events: none;
    opacity: 0.46;
}

.chat-modal__header {
    padding: 0.58rem 0.64rem 0.48rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.48rem;
    border-bottom: 1px solid var(--chat-border);
}

.chat-modal__header h2 {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 900;
}

.chat-modal__body--confirm {
    padding: 0.9rem 0.82rem 0.42rem;
}

.chat-modal__body--confirm p {
    margin: 0;
    color: var(--chat-text);
    font-size: 0.82rem;
    line-height: 1.9;
}

.reaction-picker-native-wrap {
    padding: 0 0.68rem 0.42rem;
    border-bottom: 1px solid var(--chat-border);
}

.reaction-picker-native-wrap button {
    width: 100%;
    min-height: 32px;
    border-radius: 10px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-text);
    font-size: 0.68rem;
    font-weight: 820;
}

.reaction-picker-native-wrap button:hover,
.reaction-picker-native-wrap button:focus-visible {
    border-color: rgba(43, 109, 243, 0.3);
    background: var(--chat-control-bg-hover);
}

.reaction-picker-tabs {
    display: flex;
    align-items: center;
    gap: 0.26rem;
    overflow-x: auto;
    padding: 0 0.68rem 0.44rem;
    border-bottom: 1px solid var(--chat-border);
}

.reaction-picker-tabs::-webkit-scrollbar {
    height: 0;
}

.reaction-picker-tab {
    min-height: 28px;
    padding: 0.2rem 0.58rem;
    border-radius: 999px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-muted);
    font-size: 0.62rem;
    font-weight: 820;
    white-space: nowrap;
}

.reaction-picker-tab.is-active {
    border-color: rgba(51, 144, 236, 0.34);
    background: rgba(43, 109, 243, 0.14);
    color: var(--chat-accent);
}

.reaction-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 0.38rem;
    padding: 0.74rem;
}

.reaction-picker-btn {
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid var(--chat-border);
    background: var(--chat-chip-bg);
    font-size: 1.24rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.reaction-picker-btn:hover,
.reaction-picker-btn:focus-visible {
    border-color: rgba(51, 144, 236, 0.32);
    background: rgba(43, 109, 243, 0.08);
    transform: translateY(-1px);
}

.reaction-picker-btn.is-active {
    border-color: rgba(51, 144, 236, 0.4);
    background: rgba(43, 109, 243, 0.15);
}

#edit-text {
    width: 100%;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    padding: 0.62rem 0.68rem;
    background: var(--chat-input-bg);
    color: var(--chat-text);
    line-height: 1.8;
    resize: vertical;
}

#edit-text:focus {
    border-color: rgba(51, 144, 236, 0.32);
    box-shadow: 0 0 0 3px rgba(43, 109, 243, 0.08);
    outline: 0;
}

.chat-login-btn.chat-login-btn-danger {
    background: linear-gradient(135deg, #cf3f57, #e7657a);
    box-shadow: 0 12px 24px -18px rgba(207, 63, 87, 0.55);
}

.chat-modal__title-wrap {
    min-width: 0;
    display: grid;
    gap: 0.12rem;
}

.chat-modal__title-wrap p {
    margin: 0;
    color: var(--chat-muted);
    font-size: 0.68rem;
}

.chat-modal .conversation-search-wrap {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

.chat-modal__fields {
    display: grid;
    gap: 0.36rem;
    padding: 0.52rem 0.68rem 0.34rem;
}

.chat-modal__fields label {
    font-size: 0.72rem;
    font-weight: 840;
}

.chat-modal__fields--compact {
    padding-bottom: 0.22rem;
}

.chat-modal-meta {
    margin: 0;
    color: var(--chat-muted);
    font-size: 0.68rem;
}

.chat-modal__fields input,
.chat-modal__fields textarea {
    width: 100%;
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    padding: 0.48rem 0.62rem;
    background: var(--chat-input-bg);
    color: var(--chat-text);
    font-size: 0.8rem;
}

.chat-modal__fields textarea {
    resize: vertical;
    min-height: 96px;
}

.chat-modal__fields input:focus,
.chat-modal__fields textarea:focus {
    border-color: rgba(43, 109, 243, 0.32);
    box-shadow: 0 0 0 3px rgba(43, 109, 243, 0.08);
    outline: 0;
}

.chat-modal__body {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 0.14rem 0.6rem 0.56rem;
    display: grid;
    gap: 0.18rem;
}

.chat-modal__members {
    max-height: 280px;
}

.chat-modal__body--dense {
    padding-top: 0.08rem;
}

.chat-modal__footer {
    padding: 0.12rem 0.64rem 0.64rem;
}

.chat-modal__footer--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 0.42rem;
    align-items: center;
}

.chat-modal-secondary-btn {
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
    color: var(--chat-text);
    font-size: 0.76rem;
    font-weight: 830;
}

.chat-modal-secondary-btn-primary {
    border-color: rgba(51, 144, 236, 0.26);
    background: rgba(51, 144, 236, 0.1);
    color: var(--chat-accent);
}

.group-flow-step {
    min-height: 0;
    display: none;
}

.group-flow-step.is-active {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.group-selected {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.group-selected[hidden] {
    display: none !important;
}

.group-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 26px;
    padding: 0 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(51, 144, 236, 0.24);
    background: rgba(51, 144, 236, 0.1);
    color: var(--chat-accent);
    font-size: 0.68rem;
}

.group-selected-chip strong {
    font-size: 0.8rem;
    line-height: 1;
}

.chat-picker-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--chat-text);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.46rem;
    text-align: start;
    padding: 0.42rem 0.44rem;
}

.chat-picker-item:hover,
.chat-picker-item:focus-visible {
    border-color: rgba(51, 144, 236, 0.3);
    background: var(--chat-control-bg-hover);
}

.chat-picker-item.is-selected {
    border-color: rgba(51, 144, 236, 0.38);
    background: rgba(51, 144, 236, 0.1);
}

.chat-picker-item--saved {
    border-color: color-mix(in srgb, var(--chat-bale-green) 28%, var(--chat-border));
    background: color-mix(in srgb, var(--chat-bale-green-soft) 58%, transparent);
}

.chat-picker-item--saved .chat-picker-item__avatar {
    background: linear-gradient(160deg, #2b8a6d, #55b992);
}

.chat-picker-item__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #2f72f2, #6a9dff);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
}

.chat-picker-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-picker-item__avatar[data-has-avatar="1"] span {
    display: none;
}

.chat-picker-item__avatar img[hidden] {
    display: none !important;
}

.chat-picker-item__copy {
    min-width: 0;
    display: grid;
    gap: 0.06rem;
}

.chat-picker-item__copy strong,
.chat-picker-item__copy span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-picker-item__copy strong {
    font-size: 0.75rem;
}

.chat-picker-item__copy span {
    font-size: 0.66rem;
    color: var(--chat-muted);
}

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

.chat-picker-empty {
    padding: 0.64rem;
    border-radius: 10px;
    border: 1px dashed rgba(124, 145, 168, 0.2);
    color: var(--chat-muted);
    font-size: 0.74rem;
    text-align: center;
}

.forward-source-preview {
    display: grid;
    gap: 0.38rem;
    margin-bottom: 0.12rem;
}

.forward-source-card {
    display: grid;
    gap: 0.1rem;
    padding: 0.54rem 0.6rem;
    border-radius: 12px;
    border: 1px solid var(--chat-border);
    background: var(--chat-control-bg);
}

.forward-source-card__kicker {
    color: var(--chat-accent);
    font-size: 0.64rem;
    font-weight: 860;
}

.forward-source-card__preview {
    color: var(--chat-text);
    font-size: 0.75rem;
    line-height: 1.6;
}

.forward-source-card__meta {
    color: var(--chat-muted);
    font-size: 0.62rem;
}

.forward-option-row {
    margin-bottom: 0.08rem;
}

.chat-mobile-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 286;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.24rem;
    padding: 0.3rem 0.44rem calc(0.34rem + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--chat-border);
    background: var(--chat-pane-bg-strong);
    backdrop-filter: blur(18px);
}

.chat-mobile-nav[hidden] {
    display: none !important;
}

.chat-mobile-nav__item {
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--chat-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
    gap: 0.04rem;
    font-size: 0.58rem;
    font-weight: 810;
    text-decoration: none;
    transition: transform var(--motion-fast, 0.18s) ease, border-color var(--motion-fast, 0.18s) ease, background var(--motion-fast, 0.18s) ease, color var(--motion-fast, 0.18s) ease;
}

.chat-mobile-nav__badge {
    position: absolute;
    top: 0.36rem;
    inset-inline-start: 50%;
    transform: translateX(-0.2rem);
    min-width: 18px;
    height: 18px;
    padding: 0 0.28rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    color: var(--accent-contrast);
    font-size: 0.58rem;
    font-weight: 860;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    pointer-events: none;
}

.chat-mobile-nav__item svg {
    width: 18px;
    height: 18px;
}

.chat-mobile-nav__item:hover,
.chat-mobile-nav__item:focus-visible {
    border-color: rgba(51, 144, 236, 0.24);
    background: var(--chat-control-bg-hover);
    color: var(--chat-text);
}

.chat-mobile-nav__item.is-active {
    border-color: rgba(51, 144, 236, 0.32);
    background: rgba(51, 144, 236, 0.12);
    color: var(--chat-accent);
}

.chat-fab {
    position: fixed;
    inset-inline-end: 1rem;
    bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px) + var(--chat-shell-offset));
    z-index: 285;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background: linear-gradient(180deg, #53b6ff 0%, #3390ec 100%);
    color: #fff;
    box-shadow: 0 24px 36px -26px rgba(8, 48, 86, 0.7);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--motion-fast, 0.18s) ease, box-shadow var(--motion-fast, 0.18s) ease, opacity var(--motion-fast, 0.18s) ease;
}

.chat-fab svg {
    width: 22px;
    height: 22px;
}

.chat-fab[hidden] {
    display: none !important;
}

.chat-fab:hover,
.chat-fab:focus-visible {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 28px 42px -26px rgba(8, 48, 86, 0.78);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px) + var(--chat-shell-offset));
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    padding: 0.68rem 0.94rem;
    border-radius: 999px;
    background: var(--chat-toast-bg);
    color: #fff;
    font-size: 0.78rem;
    box-shadow: 0 22px 42px -30px rgba(22, 42, 70, 0.3);
    transition: opacity var(--motion-fast, 0.18s) ease, transform var(--motion-fast, 0.18s) ease;
    z-index: 290;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

@keyframes chat-message-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.96);
    }

    60% {
        opacity: 1;
        transform: translateY(-1px) scale(1.01);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (min-width: 980px) {
    .messages {
        padding-inline: clamp(1rem, 8vw, 7rem);
    }

    .chat-fab {
        display: none !important;
    }

    .chat-mobile-nav {
        display: none !important;
    }
}

@media (max-width: 1100px) {
    .msg-bubble {
        max-width: 76%;
    }
}

@media (max-width: 980px) {
    .thread-placeholder {
        place-content: start center;
        align-content: start;
        justify-items: center;
        gap: 0.2rem;
        padding: calc(1.4rem + env(safe-area-inset-top, 0px)) 0.8rem 0.8rem;
    }

    .thread-placeholder strong {
        font-size: 0.9rem;
    }

    .thread-placeholder span {
        font-size: 0.74rem;
        line-height: 1.55;
        max-width: 28ch;
    }
    body.chat-page {
        --chat-local-nav-height: 0px;
        font-size: clamp(15px, 3.9vw, 16.2px);
        line-height: 1.66;
    }

    body.chat-page.chat-mobile-nav-visible {
        --chat-local-nav-height: calc(62px + env(safe-area-inset-bottom, 0px));
    }

    .chat-app {
        width: 100%;
        max-width: none;
        padding: 0 0 calc(var(--chat-shell-offset) + var(--chat-local-nav-height));
        gap: 0;
        grid-template-rows: minmax(0, 1fr);
    }

    .chat-app__header {
        display: none;
    }

    .chat-app__main {
        min-height: var(--chat-vh, 100dvh);
    }

    .chat-stage {
        position: relative;
        height: 100%;
        min-height: 0;
        grid-template-columns: 1fr;
        padding: 0;
        gap: 0;
        border-radius: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    .conversation-pane,
    .thread-pane {
        position: absolute;
        inset: 0;
        border-radius: 0;
        border: 0;
        background: var(--chat-pane-bg-strong);
        transition: transform 0.24s ease, opacity 0.24s ease;
    }

    .conversation-pane {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .thread-pane {
        transform: translateX(100%);
        opacity: 0;
        pointer-events: none;
    }

    .conversation-pane__close,
    .thread-head__mobile-btn {
        display: inline-flex;
    }

    .chat-app[data-mobile-view="list"] .conversation-pane {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .chat-app[data-mobile-view="list"] .thread-pane {
        transform: translateX(100%);
        opacity: 0;
        pointer-events: none;
    }

    .chat-app[data-mobile-view="thread"] .conversation-pane {
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
    }

    .chat-app[data-mobile-view="thread"] .thread-pane {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .chat-app[data-mobile-view="dm"] .conversation-pane,
    .chat-app[data-mobile-view="group"] .conversation-pane,
    .chat-app[data-mobile-view="dm"] .thread-pane,
    .chat-app[data-mobile-view="group"] .thread-pane {
        transform: translateX(-100%);
        opacity: 0;
        pointer-events: none;
    }

    .conversation-search-wrap input,
    .chat-modal__fields input,
    .chat-modal__fields textarea,
    #dm-search,
    #group-search,
    .composer-entry textarea {
        font-size: 16px;
    }

    .chat-modal {
        inset-inline: 0;
        inset-block-start: 0;
        transform: translateX(104%);
        width: 100vw;
        max-height: var(--chat-vh, 100dvh);
        min-height: var(--chat-vh, 100dvh);
        height: var(--chat-vh, 100dvh);
        border-radius: 0;
        border: 0;
        box-shadow: none;
        backdrop-filter: none;
        transition: transform 0.24s ease;
    }

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

    .chat-context-menu,
    .chat-list-context-menu {
        max-height: min(46vh, 430px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .chat-modal-backdrop {
        background: rgba(10, 22, 38, 0.14);
        backdrop-filter: none;
    }

    .chat-modal__header {
        padding: calc(0.52rem + env(safe-area-inset-top, 0px)) 0.7rem 0.5rem;
    }

    .chat-modal__body {
        padding: 0.14rem 0.56rem 0.56rem;
    }

    .chat-modal__members {
        max-height: none;
        min-height: 0;
    }

    .chat-modal__footer {
        padding: 0.3rem 0.56rem calc(0.72rem + env(safe-area-inset-bottom, 0px));
    }

    .chat-modal--group .chat-modal__footer {
        box-shadow: 0 -8px 24px -18px rgba(18, 30, 48, 0.36);
    }

    .chat-modal__footer--split {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #group-create-btn {
        grid-column: 1 / -1;
    }

    .chat-fab {
        inset-inline-end: 0.82rem;
        bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px) + var(--chat-shell-offset));
    }

    .conversation-list {
        padding-bottom: calc(0.56rem + var(--chat-local-nav-height));
    }

    .conversation-manage-bar {
        margin-inline: 0.48rem;
    }

    .composer {
        padding-bottom: calc(0.62rem + env(safe-area-inset-bottom, 0px) + var(--chat-local-nav-height));
    }

    .thread-pane,
    .conversation-pane {
        padding-bottom: 0;
    }

    .chat-app__identity h1 {
        font-size: 1.18rem;
        line-height: 1.42;
    }

    .chat-app__identity p {
        font-size: 0.92rem;
        line-height: 1.62;
    }

    .chat-back,
    .chat-top-btn,
    .chat-sheet-close,
    .conversation-pane__close,
    .thread-head__mobile-btn,
    .conversation-pane__icon-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .chat-back svg,
    .chat-top-btn svg,
    .chat-sheet-close svg,
    .conversation-pane__close svg,
    .thread-head__mobile-btn svg,
    .conversation-pane__icon-btn svg {
        width: 18px;
        height: 18px;
    }

    .chat-top-btn-text {
        min-height: 40px;
        min-width: 70px;
        padding-inline: 0.8rem;
        font-size: 0.78rem;
    }

    .chat-connection {
        min-height: 36px;
        padding: 0.4rem 0.72rem;
        font-size: 0.76rem;
    }

    .chat-mobile-nav {
        gap: 0.22rem;
        padding: 0.34rem 0.48rem calc(0.38rem + env(safe-area-inset-bottom, 0px));
    }

    .chat-mobile-nav__item {
        min-height: 48px;
        gap: 0.08rem;
        font-size: 0.64rem;
    }

    .chat-mobile-nav__item svg {
        width: 18px;
        height: 18px;
    }

    .conversation-pane__header {
        gap: 0.42rem;
        padding: calc(0.4rem + env(safe-area-inset-top, 0px)) 0.64rem 0.34rem;
    }

    .conversation-pane__header h2 {
        font-size: 0.86rem;
        line-height: 1.4;
    }

    .conversation-pane__header p {
        margin-top: 0.08rem;
        font-size: 0.68rem;
        line-height: 1.6;
    }

    .conversation-search-wrap {
        padding: 0 0.64rem 0.44rem;
    }

    .conversation-search-wrap input {
        min-height: 40px;
        border-radius: 12px;
        padding: 0.48rem 0.72rem;
    }

    .conversation-manage-bar {
        margin: 0 0.5rem 0.36rem;
    }

    .conversation-manage-bar__head button {
        min-height: 28px;
    }

    .conversation-manage-bar__actions button {
        min-height: 30px;
    }

    .conversation-list {
        gap: 0.12rem;
        padding-inline: 0.26rem;
    }

    .conversation-item {
        gap: 0.34rem;
    }

    .conversation-item__main {
        min-height: 58px;
        gap: 0.42rem;
        padding: 0.32rem 0.46rem;
        border-radius: 12px;
    }

    .conversation-item__avatar {
        width: 40px;
        height: 40px;
        font-size: 0.74rem;
    }

    .conversation-item__kind {
        width: 1.3rem;
        height: 1.3rem;
        border-radius: 10px;
    }

    .conversation-item__kind svg {
        width: 0.84rem;
        height: 0.84rem;
    }

    .conversation-item__copy {
        gap: 0.08rem;
    }

    .conversation-item__head {
        gap: 0.38rem;
    }

    .conversation-item__title {
        font-size: 0.8rem;
        line-height: 1.38;
    }

    .conversation-item__subtitle {
        font-size: 0.65rem;
        line-height: 1.42;
    }

    .conversation-item__preview {
        font-size: 0.7rem;
        line-height: 1.45;
    }

    .conversation-item__time {
        font-size: 0.62rem;
    }

    .conversation-item__unread {
        min-width: 20px;
        height: 20px;
        padding-inline: 0.24rem;
        font-size: 0.62rem;
    }

    .conversation-item__more,
    .conversation-item__select {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .conversation-item__select input {
        width: 18px;
        height: 18px;
    }

    .conversation-archive-toggle {
        min-height: 42px;
        padding: 0.44rem 0.62rem;
        font-size: 0.76rem;
    }

    .thread-head {
        gap: 0.34rem;
        padding: calc(0.34rem + env(safe-area-inset-top, 0px)) 0.5rem 0.42rem;
    }

    .thread-head__avatar {
        width: 48px;
        height: 48px;
        font-size: 0.82rem;
    }

    .thread-head__copy strong {
        font-size: 0.94rem;
        line-height: 1.46;
    }

    .thread-head__copy span {
        font-size: 0.75rem;
        line-height: 1.48;
    }

    .messages {
        padding: 0.46rem 0.5rem 0.42rem;
    }

    .msg-row {
        gap: 0.4rem;
    }

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

    .msg-bubble {
        max-width: 90%;
        padding: 0.44rem 0.58rem 0.36rem;
        border-radius: 14px;
    }

    .msg-head {
        margin-bottom: 0.24rem;
    }

    .msg-name {
        font-size: 0.78rem;
    }

    .msg-text {
        font-size: 0.82rem;
        line-height: 1.52;
    }

    .msg-attachment__name {
        font-size: 0.82rem;
    }

    .msg-attachment__meta,
    .msg-attachment__link,
    .msg-attachment__state {
        font-size: 0.72rem;
    }

    .reply-preview {
        margin-bottom: 0.32rem;
        padding: 0.44rem 0.58rem;
        font-size: 0.76rem;
    }

    .msg-foot,
    .msg-delivery,
    .msg-reaction__count {
        font-size: 0.72rem;
    }

    .msg-reactions {
        margin-top: 0.3rem;
        gap: 0.32rem;
    }

    .msg-reaction {
        min-height: 32px;
        padding: 0.18rem 0.46rem;
        font-size: 0.78rem;
    }

    .composer {
        padding: 0.42rem 0.42rem calc(0.46rem + env(safe-area-inset-bottom, 0px) + var(--chat-local-nav-height));
    }

    .composer-box {
        gap: 0.32rem;
        padding: 0.24rem;
        border-radius: 16px;
    }

    .composer-tool {
        width: 38px;
        height: 38px;
    }

    .composer-tool svg {
        width: 18px;
        height: 18px;
    }

    .composer-upload-sheet {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .composer-upload-option {
        min-height: 40px;
        border-radius: 13px;
        font-size: 0.76rem;
    }

    .composer-voice {
        gap: 0.42rem;
        padding: 0.48rem 0.52rem;
        border-radius: 13px;
    }

    .composer-voice__actions .shell-action-btn {
        min-height: 34px;
        padding-inline: 0.7rem;
        font-size: 0.72rem;
    }

    .composer-entry textarea {
        min-height: 40px;
        max-height: 176px;
        padding: 0.44rem 0.54rem;
        line-height: 1.52;
    }

    .composer-send {
        width: 40px;
        height: 40px;
        border-radius: 13px;
    }

    .composer-send svg {
        width: 18px;
        height: 18px;
    }

    .composer-status {
        margin-top: 0.24rem;
        min-height: 0.94rem;
        font-size: 0.74rem;
    }

    .composer-storage-note {
        font-size: 0.72rem;
        line-height: 1.62;
    }
}

@media (max-width: 680px) {
    .chat-stage,
    .chat-login-panel {
        border-radius: 0;
    }

    .chat-stage {
        padding: 0;
    }

    .thread-head {
        padding: calc(0.28rem + env(safe-area-inset-top, 0px)) 0.42rem 0.36rem;
    }

    .messages {
        padding: 0.4rem 0.42rem 0.34rem;
    }

    .msg-bubble {
        max-width: 92%;
        padding: 0.42rem 0.56rem 0.34rem;
    }

    .msg-attachment {
        padding: 0.44rem 0.48rem;
    }

    .msg-avatar {
        width: 34px;
        height: 34px;
    }

    .msg-attachment__media img,
    .msg-attachment__media video {
        max-height: min(56vh, 420px);
    }

    .composer {
        padding: 0.34rem 0.34rem calc(0.44rem + env(safe-area-inset-bottom, 0px) + var(--chat-local-nav-height));
    }

    .chat-context-menu {
        min-width: min(260px, calc(100vw - 1rem));
    }

    .chat-info-sheet {
        width: 100vw;
    }

    .chat-modal {
        width: 100vw;
    }

    .conversation-pane__header {
        padding-inline: 0.58rem;
    }

    .conversation-search-wrap {
        padding-inline: 0.58rem;
    }

    .conversation-list {
        padding-inline: 0.24rem;
    }

    .conversation-manage-bar {
        margin-inline: 0.5rem;
        margin-bottom: 0.3rem;
    }

    .conversation-item__more,
    .conversation-item__select {
        width: 34px;
        height: 34px;
    }
}
