html,
body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    background: var(--md-sys-color-surface);
}

.chat-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100%;
    padding-top: env(safe-area-inset-top);
}

.pane-app-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 64px;
    min-height: 64px;
    padding: 0 8px 0 16px;
    background: transparent;
    color: var(--md-sys-color-on-surface);
    position: relative;
    z-index: 5;
}

.pane-app-bar-actions {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 0;
}

.app-title {
    font-family: var(--md-sys-typescale-font-brand);
    font-size: var(--md-sys-typescale-title-large-size);
    line-height: var(--md-sys-typescale-title-large-line-height);
    font-weight: 400;
    margin: 0;
}

.users-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 380px;
    min-width: 0;
    flex-shrink: 0;
    background: var(--md-sys-color-surface);
}

.user-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-inline-start: -4px;
}

.user-panel img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    background: var(--md-sys-color-surface-container-highest);
    transition: box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.user-panel img:hover {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

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

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--md-sys-typescale-font-brand);
    font-size: var(--md-sys-typescale-title-large-size);
    line-height: var(--md-sys-typescale-title-large-line-height);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
}

.user-sub {
    display: none;
}

.sidebar-tabs {
    display: flex;
    gap: 8px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    --fade-start: 0px;
    --fade-end: 0px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 var(--fade-start), #000 calc(100% - var(--fade-end)), transparent 100%);
}

.sidebar-tabs.can-scroll-start {
    --fade-start: 28px;
}

.sidebar-tabs.can-scroll-end {
    --fade-end: 28px;
}

.sidebar-tabs.dragging {
    scroll-behavior: auto;
    cursor: grabbing;
    user-select: none;
}

.sidebar-tabs::-webkit-scrollbar {
    display: none;
}

.sidebar-tab-btn {
    flex-shrink: 0;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 16px;
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard), padding var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.sidebar-tab-btn i {
    display: none;
    font-size: 18px;
}

.sidebar-tab-btn:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 8%, transparent);
}

.sidebar-tab-btn.active {
    padding-inline-start: 8px;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    box-shadow: none;
}

.sidebar-tab-btn.active i {
    display: inline-flex;
}

.conversations-scroll-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 8px 168px;
}

.conv-category-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px;
    color: var(--md-sys-color-primary);
    font-size: var(--md-sys-typescale-title-small-size);
    line-height: var(--md-sys-typescale-title-small-line-height);
    font-weight: 500;
}

.conv-category-count {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-medium-size);
}

.conversations-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 72px;
    padding: 8px 16px 8px 12px;
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-extra-small);
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.conv-item:first-child,
.conv-item.pinned + .conv-item:not(.pinned) {
    border-top-left-radius: var(--md-sys-shape-corner-large-increased);
    border-top-right-radius: var(--md-sys-shape-corner-large-increased);
}

.conv-item:last-child,
.conv-item.pinned:has(+ .conv-item:not(.pinned)) {
    border-bottom-left-radius: var(--md-sys-shape-corner-large-increased);
    border-bottom-right-radius: var(--md-sys-shape-corner-large-increased);
}

.conv-item.pinned + .conv-item:not(.pinned) {
    margin-top: 12px;
}

.conv-item:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-surface-container));
}

.conv-item .status-dot {
    --dot-cut: var(--md-sys-color-surface-container);
}

.conv-item.active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.conv-item-avatar-wrap,
.conv-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}

.conv-item-avatar,
.group-avatar-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--md-sys-color-surface-container-highest);
}

.group-avatar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
}

.group-avatar-icon i {
    font-size: 24px;
}

.status-dot {
    --dot-cut: var(--md-sys-color-surface);
    position: absolute;
    inset-inline-end: -1px;
    bottom: -1px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 3px solid var(--dot-cut);
    background: var(--md-sys-color-outline);
    display: none;
}

.status-dot.online,
.status-dot.idle,
.status-dot.dnd,
.status-dot.offline {
    display: block;
}

.status-dot.offline {
    background: var(--dot-cut);
    box-shadow: inset 0 0 0 2.5px var(--md-sys-color-outline);
}

.status-dot.online {
    background: var(--md-sys-color-success);
}

.status-dot.idle {
    background: var(--md-sys-color-warning);
}

.status-dot.dnd {
    background: var(--md-sys-color-error);
}

.conv-item.active .status-dot {
    --dot-cut: var(--md-sys-color-secondary-container);
}

.conv-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.conv-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    color: var(--md-sys-color-on-surface);
}

.conv-item-time {
    flex-shrink: 0;
    font-size: var(--md-sys-typescale-label-medium-size);
    line-height: var(--md-sys-typescale-label-medium-line-height);
    color: var(--md-sys-color-on-surface-variant);
}

.conv-item-lastmsg {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    color: var(--md-sys-color-on-surface-variant);
}

.conv-item.unread .conv-item-name,
.conv-item.unread .conv-item-lastmsg {
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}

.conv-item.unread .conv-item-time {
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

.conv-item.active .conv-item-name,
.conv-item.active .conv-item-lastmsg,
.conv-item.active .conv-item-time {
    color: var(--md-sys-color-on-secondary-container);
}

.conv-item .unread-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: var(--md-sys-typescale-label-medium-size);
    line-height: 20px;
}

.conv-item-lastmsg.typing {
    color: var(--md-sys-color-primary);
    font-style: italic;
}

.conversations-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 64px 24px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.conversations-empty i {
    font-size: 48px;
}

.sidebar-top-actions {
    position: absolute;
    inset-inline-end: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    z-index: 6;
}

.sidebar-small-actions {
    display: flex;
    gap: 8px;
}

.fab.fab-small {
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    position: relative;
    overflow: visible;
}

.fab.fab-small .md-ripple {
    display: none;
}

.fab.fab-small:active::after {
    opacity: var(--md-sys-state-pressed);
}

.fab.fab-small .badge-count {
    position: absolute;
    top: -6px;
    inset-inline-end: -6px;
    margin: 0;
}

.fab.fab-small i {
    margin: 0;
}

.fab.fab-extended {
    padding: 0 20px 0 16px;
}

.fab.fab-extended i {
    margin: 0;
}

.fab .badge-count {
    margin-inline-start: -4px;
}

.chat-main {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin: 0;
    margin-inline-end: 16px;
    margin-block-end: 16px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-low);
    overflow: hidden;
}

.chat-app-bar {
    padding: 0 8px 0 12px;
    border-bottom: 1px solid transparent;
    transition: background-color var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.chat-app-bar.scrolled {
    background: var(--md-sys-color-surface-container);
}

.conv-header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.conv-avatar-wrap {
    width: 40px;
    height: 40px;
}

.conv-avatar-wrap img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    background: var(--md-sys-color-surface-container-highest);
}

.chat-app-bar .status-dot {
    --dot-cut: var(--md-sys-color-surface-container-low);
    width: 12px;
    height: 12px;
    border-width: 2px;
}

.conv-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.conv-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    font-size: var(--md-sys-typescale-title-medium-size);
    line-height: var(--md-sys-typescale-title-medium-line-height);
    font-weight: 500;
    color: var(--md-sys-color-on-surface);
}

.conv-subtitle {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: var(--md-sys-typescale-body-small-line-height);
    color: var(--md-sys-color-on-surface-variant);
}

.conv-header-actions {
    display: flex;
    align-items: center;
    gap: 0;
}

.mobile-back-btn {
    display: none;
}

.no-conversation-selected {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.empty-state-content {
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.empty-state-icon {
    width: 112px;
    height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 36%;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.empty-state-icon i {
    font-size: 52px;
}

.empty-state-content h3 {
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
}

.empty-state-content p {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

#chat-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 8px 16px 12px;
    scroll-padding-bottom: 24px;
}

.message {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
    animation: md-message-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

@keyframes md-message-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
}

.message.consecutive {
    margin-top: 2px;
}

.message img.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 20px;
    background: var(--md-sys-color-surface-container-highest);
}

.message.consecutive img.avatar {
    visibility: hidden;
    height: 0;
    margin: 0;
}

.my-message {
    flex-direction: row-reverse;
}

.message .text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    max-width: min(78%, 620px);
}

.my-message .text {
    align-items: flex-end;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 4px;
    min-width: 0;
    max-width: 100%;
}

.message-header strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.my-message .message-header {
    flex-direction: row-reverse;
}

.message.consecutive .message-header {
    display: none;
}

.admin-label,
.profile-role-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 500;
    white-space: nowrap;
}

.timestamp {
    flex-shrink: 0;
    font-size: var(--md-sys-typescale-label-small-size);
    line-height: var(--md-sys-typescale-label-small-line-height);
    color: var(--md-sys-color-on-surface-variant);
}

.edit-tag {
    font-style: italic;
    margin-inline-start: 2px;
}

.message-body {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
}

.my-message .message-body {
    flex-direction: row-reverse;
}

.message-content {
    order: 0;
    min-width: 0;
    padding: 10px 16px;
    border-radius: 20px;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: 22px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.my-message .message-content {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.other-message:has(+ .message.consecutive) .message-content {
    border-end-start-radius: 4px;
}

.other-message.consecutive .message-content {
    border-start-start-radius: 4px;
}

.my-message:has(+ .message.consecutive) .message-content {
    border-end-end-radius: 4px;
}

.my-message.consecutive .message-content {
    border-start-end-radius: 4px;
}

.message.menu-open .message-content {
    filter: brightness(0.88);
}

.message-content a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mention-link {
    display: inline;
    padding: 0 4px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
    color: var(--md-sys-color-primary);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none !important;
}

.my-message .mention-link {
    background: color-mix(in srgb, var(--md-sys-color-on-primary-container) 16%, transparent);
    color: var(--md-sys-color-on-primary-container);
}

.message-content.media-content {
    padding: 4px;
    background: var(--md-sys-color-surface-container-highest);
    white-space: normal;
}

.my-message .message-content.media-content {
    background: var(--md-sys-color-primary-container);
}

.media-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.media-caption {
    padding: 6px 12px 4px;
    white-space: pre-wrap;
}

.media-attachment {
    display: flex;
}

.chat-media-image,
.media-attachment img {
    display: block;
    max-width: min(320px, 100%);
    max-height: 360px;
    width: auto;
    height: auto;
    border-radius: 16px;
    object-fit: cover;
    cursor: zoom-in;
    background: var(--md-sys-color-surface-container);
}

.chat-media-video,
.media-attachment video {
    display: block;
    max-width: min(360px, 100%);
    max-height: 360px;
    border-radius: 16px;
    background: #000;
}

.media-attachment audio {
    display: block;
    width: 260px;
    max-width: 100%;
    height: 40px;
}

.media-attachment iframe,
.youtube-embed {
    width: min(420px, 70vw);
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 16px;
}

.youtube-shorts-embed {
    width: min(260px, 60vw);
    aspect-ratio: 9 / 16;
    border: 0;
    border-radius: 16px;
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    padding: 8px 8px 8px 16px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent);
}

.file-attachment::before {
    content: "description";
    font-family: "Material Symbols Rounded";
    font-size: 24px;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
}

.file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.download-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: inherit;
}

.download-link:hover {
    background: color-mix(in srgb, currentColor 8%, transparent);
    text-decoration: none;
}

.message-reply-reference {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    margin: 0 4px 4px;
    padding: 6px 12px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent);
    box-shadow: inset 3px 0 0 var(--md-sys-color-primary);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: var(--md-sys-typescale-body-small-line-height);
    cursor: pointer;
    overflow: hidden;
}

.message-reply-reference i {
    font-size: 16px;
    color: var(--md-sys-color-primary);
}

.message-reply-reference strong {
    color: var(--md-sys-color-on-surface);
    font-weight: 500;
    white-space: nowrap;
}

.message-reply-reference .reply-preview-content-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-thumb {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: cover;
}

.options {
    display: none !important;
}

.md-menu-scrim {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: transparent;
}

.md-menu-scrim.sheet {
    background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent);
    animation: md-fade-in var(--md-sys-motion-duration-short) linear;
}

.md-menu-scrim.closing {
    opacity: 0;
    transition: opacity 150ms linear;
}

.md-menu {
    position: fixed;
    z-index: 5001;
    min-width: 200px;
    max-width: min(340px, calc(100vw - 16px));
    padding: 4px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-level2);
    transform-origin: top left;
    animation: md-menu-in var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-menu.closing {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 150ms linear, transform 150ms var(--md-sys-motion-easing-emphasized-accelerate);
}

@keyframes md-menu-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
}

.md-menu-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 48px;
    padding: 0 16px 0 12px;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background: transparent;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    overflow: hidden;
}

.md-menu-item .material-symbols-rounded {
    font-size: 24px;
    color: var(--md-sys-color-on-surface-variant);
}

.md-menu-item:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.md-menu-item.danger,
.md-menu-item.danger .material-symbols-rounded {
    color: var(--md-sys-color-error);
}

.md-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5001;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 0 calc(16px + env(safe-area-inset-bottom));
    border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
    background: var(--md-sys-color-surface-container-low);
    box-shadow: var(--md-sys-elevation-level1);
    animation: md-sheet-up var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-bottom-sheet.closing {
    transform: translateY(100%);
    transition: transform 180ms var(--md-sys-motion-easing-emphasized-accelerate);
}

@keyframes md-sheet-up {
    from {
        transform: translateY(100%);
    }
}

.md-sheet-handle {
    width: 32px;
    height: 4px;
    margin: 16px auto 12px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--md-sys-color-on-surface-variant) 40%, transparent);
}

.md-bottom-sheet .md-menu-item {
    height: 56px;
    padding: 0 24px;
    gap: 16px;
    border-radius: 0;
    font-size: var(--md-sys-typescale-body-large-size);
    font-weight: 400;
}

.message.system-message {
    justify-content: center;
}

.message.system-message img.avatar,
.message.system-message .message-header,
.message.system-message .options {
    display: none;
}

.message.system-message .text {
    align-items: center;
    max-width: 90%;
}

.message.system-message .message-content {
    padding: 6px 16px;
    border-radius: var(--md-sys-shape-corner-large) !important;
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    line-height: var(--md-sys-typescale-label-large-line-height);
    text-align: center;
}

.message.system-message .mention-link {
    background: transparent;
    padding: 0;
}

.message.system-message .message-content {
    direction: ltr;
}

.mention-link {
    unicode-bidi: isolate;
}

.highlight-message .message-content {
    animation: md-highlight 2s var(--md-sys-motion-easing-standard);
}

@keyframes md-highlight {
    0%,
    60% {
        box-shadow: 0 0 0 3px var(--md-sys-color-tertiary);
    }

    100% {
        box-shadow: 0 0 0 3px transparent;
    }
}

#typing-indicator {
    height: 0;
    padding: 0 24px;
    overflow: hidden;
    font-size: var(--md-sys-typescale-label-medium-size);
    line-height: 20px;
    color: var(--md-sys-color-primary);
    opacity: 0;
    transition: height var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard), opacity var(--md-sys-motion-duration-short) linear;
}

#typing-indicator.visible {
    height: 20px;
    opacity: 1;
}

#previews-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.reply-preview,
.selected-file-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 6px 4px 6px 16px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: inset 4px 0 0 var(--md-sys-color-primary);
    animation: md-sheet-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

@keyframes md-sheet-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.edit-preview {
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    box-shadow: inset 4px 0 0 var(--md-sys-color-tertiary);
}

.reply-preview-meta,
.selected-file-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.reply-preview-meta i {
    color: var(--md-sys-color-primary);
    font-size: 20px;
}

.edit-preview .reply-preview-meta i {
    color: inherit;
}

.reply-preview-label {
    flex-shrink: 0;
    font-weight: 500;
}

.reply-preview-content-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--md-sys-color-on-surface-variant);
}

.selected-file-preview {
    display: none;
}

.selected-file-preview.active {
    display: flex;
}

.selected-file-name {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-name img,
.selected-file-name video {
    max-height: 48px;
    border-radius: 8px;
}

#message-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px 12px;
    transition: opacity var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard), transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.composer-field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    gap: 0;
    min-height: 48px;
    padding: 4px;
    border-radius: 24px;
    background: var(--md-sys-color-surface-container-highest);
    transition: box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.composer-field:focus-within {
    box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
}

#message-input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    max-height: 160px;
    padding: 8px 4px;
    border: none;
    background: transparent;
    box-shadow: none;
    resize: none;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: 24px;
    overflow-y: auto;
}

#message-input:focus,
#message-input:hover {
    box-shadow: none;
}

.form-button {
    position: relative;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard), color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.form-button i {
    font-size: 24px;
}

#record-button.recording {
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    animation: md-pulse 1.4s ease-in-out infinite;
}

@keyframes md-pulse {
    50% {
        box-shadow: 0 0 0 6px color-mix(in srgb, var(--md-sys-color-error) 24%, transparent);
    }
}

#send-button {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

#send-button:hover {
    box-shadow: var(--md-sys-elevation-level1);
}

.media-lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgb(0 0 0 / 0.92);
}

.media-lightbox-backdrop.open {
    display: flex;
    animation: md-fade-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-standard);
}

.media-lightbox-backdrop img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--md-sys-shape-corner-medium);
    object-fit: contain;
}

.media-lightbox-close {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    right: 12px;
    color: #fff;
}

@keyframes md-fade-in {
    from {
        opacity: 0;
    }
}

@keyframes md-dialog-in {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
}

@keyframes md-fullscreen-in {
    from {
        opacity: 0;
        transform: translateY(32px);
    }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: color-mix(in srgb, var(--md-sys-color-scrim) 40%, transparent);
    animation: md-fade-in var(--md-sys-motion-duration-short) linear;
}

.modal-backdrop.open {
    display: flex;
}

#select-members-modal-backdrop,
#group-add-members-modal-backdrop,
#group-admin-picker-backdrop,
#group-owner-settings-backdrop,
#admin-permissions-backdrop,
#bulk-admin-permissions-backdrop {
    z-index: 1100;
}

#profile-backdrop,
#account-edit-modal-backdrop,
#theme-paste-import-backdrop {
    z-index: 1200;
}

#app-dialog-backdrop {
    z-index: 1300;
}

.custom-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    max-height: calc(100dvh - 48px);
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    box-shadow: var(--md-sys-elevation-level3);
    overflow: hidden;
    animation: md-dialog-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 12px 24px;
}

.modal-header h3 {
    flex: 1;
    min-width: 0;
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.modal-header h3 i {
    display: none;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0;
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 24px 16px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 24px;
}

.modal-body .modal-footer {
    padding: 24px 0 0;
}

.dialog-modal {
    width: min(420px, 100%);
    padding: 24px;
}

.dialog-modal h3 {
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
    margin-bottom: 16px;
}

.dialog-modal > p {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
}

#group-owner-settings-backdrop .dialog-modal {
    padding: 0;
}

.basic-dialog {
    width: min(360px, 100%);
    text-align: center;
}

.dialog-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.dialog-icon i {
    font-size: 24px;
    color: var(--md-sys-color-secondary) !important;
}

.basic-dialog h3 {
    margin-bottom: 16px;
}

.basic-dialog p {
    text-align: start;
    word-break: break-word;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.basic-dialog .dialog-actions .primary-btn,
.basic-dialog .dialog-actions .danger-btn {
    background: transparent;
    color: var(--md-sys-color-primary);
    padding: 0 12px;
    box-shadow: none;
}

.basic-dialog .dialog-actions .danger-btn {
    color: var(--md-sys-color-error);
}

.modal-nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
    padding: 0 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.modal-tab-btn {
    position: relative;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 16px;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    overflow: hidden;
}

.modal-tab-btn i {
    font-size: 20px;
}

.modal-tab-btn::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--md-sys-color-primary);
    transform: scaleX(0);
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.modal-tab-btn:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.modal-tab-btn.active {
    color: var(--md-sys-color-primary);
}

.modal-tab-btn.active::after {
    transform: scaleX(1);
}

.modal-tab-content {
    padding-top: 16px;
}

.tab-desc {
    margin-bottom: 16px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.input-with-button,
.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-button .input-icon,
.search-input-wrap .search-icon {
    position: absolute;
    left: 16px;
    top: 28px;
    transform: translateY(-50%);
    color: var(--md-sys-color-on-surface-variant);
    pointer-events: none;
    z-index: 1;
}

.input-with-button .input,
.search-input-wrap .input {
    padding-left: 48px;
}

.search-input-wrap .input,
#member-picker-search-input {
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-highest);
    box-shadow: none;
}

.input-with-button .primary-btn {
    flex-shrink: 0;
    height: 56px;
}

.requests-subnav {
    display: flex;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--md-sys-color-surface-variant);
}

.req-subtab-btn {
    position: relative;
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 500;
    cursor: pointer;
}

.req-subtab-btn i {
    font-size: 18px;
}

.req-subtab-btn.active {
    color: var(--md-sys-color-on-surface);
}

.req-subtab-btn.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--md-sys-color-primary);
}

.requests-list,
.group-members-list,
.friends-checklist-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.friends-checklist-container {
    overflow-y: auto;
}

.request-card,
.group-member-card,
.group-add-friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 8px 12px 8px 12px;
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
}

.request-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.request-avatar,
.group-member-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    background: var(--md-sys-color-surface-container-highest);
}

.request-names {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.request-nick {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    color: var(--md-sys-color-on-surface);
}

.request-username {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.request-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-req-accept {
    height: 36px;
    padding: 0 16px;
}

.btn-req-reject {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    min-width: 36px;
    padding: 0 12px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: var(--md-sys-color-error);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
}

.btn-req-reject i,
.btn-req-accept i {
    font-size: 18px;
    margin: 0;
}

.btn-req-reject:hover {
    background: color-mix(in srgb, var(--md-sys-color-error) 8%, transparent);
}

.empty-list-msg {
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 32px 16px;
    text-align: center;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
    background: var(--md-sys-color-surface-container);
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.group-avatar-upload-wrap {
    display: flex;
}

.group-avatar-preview {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-sys-color-secondary-container);
    background-size: cover;
    background-position: center;
    color: var(--md-sys-color-on-secondary-container);
    cursor: pointer;
}

.group-avatar-preview i {
    font-size: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group > label {
    padding: 0 4px 4px;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.selected-friends-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.member-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 8px 0 4px;
    border-radius: var(--md-sys-shape-corner-small);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.member-chip img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.member-chip-remove {
    font-size: 18px;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
}

#open-member-picker-btn {
    width: 100%;
    height: 56px;
    justify-content: space-between;
}

.friend-check-item {
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 56px;
    padding: 8px 16px;
    background: var(--md-sys-color-surface-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
    cursor: pointer;
}

.friend-check-item:hover,
.group-add-friend-row:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-surface-container));
}

.friend-check-item .request-avatar {
    width: 32px !important;
    height: 32px !important;
}

.md-checkbox {
    position: relative;
    display: inline-flex;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.md-checkbox input {
    position: absolute;
    inset: -11px;
    width: 40px;
    height: 40px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.md-checkbox-box {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    box-shadow: inset 0 0 0 2px var(--md-sys-color-on-surface-variant);
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.md-checkbox-icon {
    font-size: 16px !important;
    color: var(--md-sys-color-on-primary);
    opacity: 0;
    font-variation-settings: "FILL" 0, "wght" 700, "GRAD" 0, "opsz" 20 !important;
}

.md-checkbox input:checked + .md-checkbox-box {
    background: var(--md-sys-color-primary);
    box-shadow: none;
}

.md-checkbox input:checked + .md-checkbox-box .md-checkbox-icon {
    opacity: 1;
}

.group-details-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.group-avatar-edit-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.group-info-avatar-img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--md-sys-color-surface-container-highest);
}

.group-name-edit-wrap {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.group-name-edit-wrap .primary-btn {
    height: 56px;
}

.group-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.group-members-section h4,
.group-admins-section h4,
.account-section-title {
    margin: 0 0 8px;
    padding: 0 4px;
    color: var(--md-sys-color-primary);
    font-size: var(--md-sys-typescale-title-small-size);
    line-height: var(--md-sys-typescale-title-small-line-height);
    font-weight: 500;
}

.group-admins-section,
.group-members-section {
    margin-top: 24px !important;
}

.group-section-head h4 {
    margin: 0;
}

.group-member-name {
    cursor: pointer;
}

.group-member-name:hover {
    text-decoration: underline;
}

.group-member-you {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.group-member-card > div:last-child {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.owner-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 500;
}

.owner-badge.admin-badge {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.owner-badge i {
    font-size: 14px;
}

.md-tonal-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
}

.md-tonal-icon-btn i {
    font-size: 20px;
}

.md-tonal-icon-btn:hover {
    filter: brightness(1.08);
}

.group-actions-danger {
    margin-top: 24px;
}

#leave-group-btn {
    width: 100%;
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.group-owner-settings,
.admin-permissions-list {
    display: flex;
    flex-direction: column;
}

.group-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 56px;
    padding: 8px 0;
    margin-top: 0 !important;
}

.group-setting-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.group-setting-title {
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
}

.group-setting-desc {
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.group-empty-hint {
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 16px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
    background: var(--md-sys-color-surface-container);
}

.profile-modal {
    width: min(400px, 100%);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.profile-modal .profile-top-actions {
    position: sticky;
    top: 12px;
    height: 0;
    align-self: flex-end;
    margin-inline-end: 12px;
    z-index: 4;
    order: -1;
}

.profile-banner {
    flex-shrink: 0;
    height: 128px;
    background: var(--md-sys-color-primary-container);
    background-size: cover;
    background-position: center;
}

.profile-top-actions {
    position: absolute;
    top: 12px;
    inset-inline-end: 12px;
    display: flex;
    gap: 8px;
}

.profile-action-btn {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 75%, transparent);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.profile-modal-body {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    padding: 0 24px 24px;
}

.profile-avatar {
    position: relative;
    z-index: 1;
    display: block;
    width: 96px;
    height: 96px;
    margin-top: -48px;
    border-radius: 50%;
    border: 6px solid var(--md-sys-color-surface-container-high);
    object-fit: cover;
    background: var(--md-sys-color-surface-container-highest);
}

.profile-modal-info {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
}

.profile-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

#profile-nickname {
    font-family: var(--md-sys-typescale-font-brand);
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
    font-weight: 400;
    cursor: pointer;
}

#profile-username {
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
}

.profile-section {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface-container);
}

.profile-section-label {
    margin-bottom: 4px;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
}

.profile-section-label:not(:first-child) {
    margin-top: 16px;
}

#profile-description {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
}

#profile-created-at {
    font-size: var(--md-sys-typescale-body-medium-size);
}

#settings-backdrop {
    z-index: 900;
}

.settings-modal {
    display: grid;
    grid-template-columns: 300px 1fr;
    width: min(1040px, 100%);
    height: min(760px, calc(100dvh - 48px));
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    box-shadow: var(--md-sys-elevation-level3);
    overflow: hidden;
    animation: md-dialog-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    background: transparent;
    overflow-y: auto;
}

.settings-nav-header {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 56px;
    padding: 0 4px 8px 12px;
}

.settings-nav-header h2 {
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
}

.mobile-close-settings-nav {
    display: none;
}

.settings-nav button[data-tab],
.settings-nav .logout-nav-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 56px;
    padding: 0 24px 0 16px;
    border: none;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    text-align: start;
    cursor: pointer;
    overflow: hidden;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.settings-nav button i {
    font-size: 24px;
}

.settings-nav button[data-tab]:hover,
.settings-nav .logout-nav-btn:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-surface-container));
}

.settings-nav-header + button[data-tab] {
    border-top-left-radius: var(--md-sys-shape-corner-large-increased);
    border-top-right-radius: var(--md-sys-shape-corner-large-increased);
}

.settings-nav button[data-tab]:has(+ .logout-nav-btn),
.settings-nav .logout-nav-btn {
    border-bottom-left-radius: var(--md-sys-shape-corner-large-increased);
    border-bottom-right-radius: var(--md-sys-shape-corner-large-increased);
}

.settings-nav .logout-nav-btn {
    border-top-left-radius: var(--md-sys-shape-corner-large-increased);
    border-top-right-radius: var(--md-sys-shape-corner-large-increased);
}

.settings-nav button[data-tab].active {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.settings-nav button[data-tab].active i {
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.settings-nav .logout-nav-btn {
    margin-top: auto;
    color: var(--md-sys-color-error);
}

.settings-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 64px;
    padding: 8px 12px 8px 24px;
}

.settings-header h2 {
    flex: 1;
    min-width: 0;
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
}

.settings-back-btn {
    display: none;
}

.settings-header-actions {
    display: flex;
    align-items: center;
}

.settings-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px 32px;
}

.settings-scroll > div {
    max-width: 720px;
}

.settings-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 8px;
}

.settings-section-head .account-section-title {
    margin: 0;
}

.settings-list,
.security-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    overflow: hidden;
}

.md-list-item,
.security-item,
.device-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 72px;
    padding: 12px 16px 12px 20px;
    border: none;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    font: inherit;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.md-list-item:hover,
.security-item:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, var(--md-sys-color-surface-container-high));
    text-decoration: none;
}

.md-list-item.static,
.device-item,
.security-item-status {
    cursor: default;
}

.md-list-item.static:hover,
.security-item-status:hover {
    background: var(--md-sys-color-surface-container-high);
}

.md-list-item > i:first-child {
    color: var(--md-sys-color-on-surface-variant);
    font-size: 24px;
}

.md-list-item > i:last-child {
    color: var(--md-sys-color-on-surface-variant);
}

.md-list-item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.md-list-item-text > span {
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
}

.md-list-item-text small {
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: var(--md-sys-typescale-body-medium-line-height);
    color: var(--md-sys-color-on-surface-variant);
}

.security-item-info {
    flex: 1;
    min-width: 0;
}

.security-item-info label {
    display: block;
    font-size: var(--md-sys-typescale-body-large-size);
    line-height: var(--md-sys-typescale-body-large-line-height);
    cursor: inherit;
}

.security-item-info .value {
    font-size: var(--md-sys-typescale-body-medium-size) !important;
    line-height: var(--md-sys-typescale-body-medium-line-height);
    color: var(--md-sys-color-on-surface-variant);
    overflow: hidden;
    text-overflow: ellipsis;
}

.security-chevron {
    color: var(--md-sys-color-on-surface-variant);
}

.security-item-status select {
    width: auto;
    min-height: 40px;
    padding: 8px 40px 8px 16px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: var(--md-sys-typescale-label-large-size);
    background-color: transparent;
}

.security-expand-panel,
.account-edit-panel {
    margin-top: 8px;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface-container-high);
}

.field-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.field-row label {
    min-width: 120px;
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.device-icon svg {
    display: block;
    width: 28px;
    height: 28px;
}

.device-icon .material-symbols-rounded {
    font-size: 28px;
}

.device-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.device-info {
    flex: 1;
    min-width: 0;
}

.device-os {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--md-sys-typescale-body-large-size);
}

.device-meta {
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
    overflow-wrap: anywhere;
}

.current-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 500;
}

.account-profile-card {
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    overflow: hidden;
}

.account-profile-banner {
    position: relative;
    z-index: 0;
    height: 144px;
    background: var(--md-sys-color-primary-container);
    background-size: cover;
    background-position: center;
    cursor: pointer;
}

.account-banner-overlay,
.avatar-change-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / 0);
    color: #fff;
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short) linear, background-color var(--md-sys-motion-duration-short) linear;
}

.account-banner-overlay i,
.avatar-change-overlay i {
    font-size: 28px;
}

.account-profile-banner:hover .account-banner-overlay,
.avatar-change-wrapper:hover .avatar-change-overlay {
    opacity: 1;
    background: rgb(0 0 0 / 0.35);
}

.account-banner-remove-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 75%, transparent);
    color: var(--md-sys-color-on-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 2;
}

.account-profile-body {
    padding: 0 20px 20px;
}

.account-profile-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: -44px;
}

.avatar-change-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 6px solid var(--md-sys-color-surface-container-high);
    overflow: hidden;
    cursor: pointer;
    background: var(--md-sys-color-surface-container-highest);
}

.avatar-change-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-media-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.account-media-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.account-toolbar-delete {
    color: var(--md-sys-color-error);
}

.account-profile-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 8px;
}

.account-field-clickable,
.account-about-clickable {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    padding: 2px 8px;
    margin-inline-start: -8px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.account-field-clickable:hover,
.account-about-clickable:hover {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

#account-nickname {
    font-family: var(--md-sys-typescale-font-brand);
    font-size: var(--md-sys-typescale-headline-small-size);
    line-height: var(--md-sys-typescale-headline-small-line-height);
    font-weight: 400;
}

.account-username-text {
    font-size: var(--md-sys-typescale-body-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.account-edit-icon {
    font-size: 18px !important;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

.account-about-card {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface-container);
}

.account-about-card h4 {
    font-size: var(--md-sys-typescale-label-large-size);
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 4px;
}

.account-about-clickable {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin: 0 -8px;
}

#account-description {
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.account-member-since {
    margin-top: 16px;
}

#account-created-at {
    font-size: var(--md-sys-typescale-body-medium-size);
}

.account-security-section {
    margin-top: 24px;
}

.theme-editor-card {
    padding: 20px;
    margin-bottom: 24px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
}

.theme-editor-card.is-busy {
    cursor: progress;
}

.te-preview {
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
}

.te-preview-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
    padding: 0 16px;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.te-preview-title {
    flex: 1;
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 500;
}

.te-preview-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px;
}

.te-bubble {
    max-width: 75%;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.te-bubble.in {
    align-self: flex-start;
    border-start-start-radius: 6px;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
}

.te-bubble.out {
    align-self: flex-end;
    border-start-end-radius: 6px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.te-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.te-chip {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 16px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.te-switch {
    position: relative;
    width: 52px;
    height: 32px;
    border-radius: 16px;
    background: var(--md-sys-color-primary);
}

.te-switch span {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--md-sys-color-on-primary);
}

.te-fab {
    margin-inline-start: auto;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    box-shadow: var(--md-sys-elevation-level2);
}

.te-section {
    margin-top: 24px;
}

.te-label {
    margin-bottom: 12px;
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 500;
}

.te-label-row {
    display: flex;
    justify-content: space-between;
}

.te-label-hint {
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
    font-size: var(--md-sys-typescale-body-small-size);
}

.te-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 12px;
}

.te-swatch {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    max-width: 72px;
    padding: 6px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
    cursor: pointer;
    transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.te-swatch.selected {
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
}

.te-swatch.wallpaper::after {
    content: "wallpaper";
    position: absolute;
    left: -2px;
    bottom: -2px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    font-family: "Material Symbols Rounded";
    font-size: 14px;
    -webkit-font-feature-settings: "liga";
    font-feature-settings: "liga";
}

.te-swatch-face {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.te-swatch-face span:nth-child(1) {
    grid-column: 1 / 3;
    background: var(--sw-a);
}

.te-swatch-face span:nth-child(2) {
    background: var(--sw-b);
}

.te-swatch-face span:nth-child(3) {
    background: var(--sw-c);
}

.te-swatch-check {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    font-size: 18px;
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.te-swatch.selected .te-swatch-check {
    transform: translate(-50%, -50%) scale(1);
}

.te-color-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.te-color-actions label {
    cursor: pointer;
}

.te-color-picker {
    position: relative;
}

.te-color-picker input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.te-color-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline);
    margin-inline-start: -8px;
}

.te-hex {
    color: var(--md-sys-color-on-surface-variant);
    font-family: ui-monospace, monospace;
    font-size: var(--md-sys-typescale-label-medium-size);
}

.te-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.md-slider {
    width: 100%;
    height: 44px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.md-slider::-webkit-slider-runnable-track {
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(var(--md-sys-color-primary), var(--md-sys-color-primary)) 0 / var(--fill, 50%) 100% no-repeat, var(--md-sys-color-secondary-container);
}

.md-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 4px;
    height: 44px;
    margin-top: -14px;
    border-radius: 2px;
    background: var(--md-sys-color-primary);
    box-shadow: 0 0 0 6px var(--md-sys-color-surface-container-high);
}

.md-slider::-moz-range-track {
    height: 16px;
    border-radius: 8px;
    background: var(--md-sys-color-secondary-container);
}

.md-slider::-moz-range-progress {
    height: 16px;
    border-radius: 8px;
    background: var(--md-sys-color-primary);
}

.md-slider::-moz-range-thumb {
    width: 4px;
    height: 44px;
    border: none;
    border-radius: 2px;
    background: var(--md-sys-color-primary);
}

.te-note {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.te-note[hidden] {
    display: none;
}

.te-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}

.te-actions .material-symbols-rounded,
.te-color-actions .material-symbols-rounded {
    font-size: 18px;
    margin-inline-start: -8px;
}

.themes-grid,
.fonts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.theme-item,
.font-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface-container-high);
}

.theme-item .danger-btn,
.font-item .danger-btn {
    height: 36px;
    padding: 0 12px;
    background: transparent;
    color: var(--md-sys-color-error);
}

.toggle {
    display: inline-flex;
}

.font-item-preview {
    padding: 12px;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container);
    font-size: var(--md-sys-typescale-title-medium-size);
}

.settings-upload-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
}

.settings-upload-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-file-label {
    cursor: pointer;
}

.settings-upload-hint {
    margin-top: 12px;
    padding: 0 4px;
}

.themes-import-textarea {
    min-height: 220px;
    font-family: ui-monospace, monospace;
    font-size: 13px;
}

.theme-import-name-fallback {
    margin-top: 12px;
}

@media (max-width: 1100px) and (min-width: 840px) {
    .users-sidebar {
        width: 320px;
    }
}

@media (max-width: 839px) {
    .chat-layout {
        padding-top: 0;
    }

    .users-sidebar {
        width: 100%;
        padding-top: env(safe-area-inset-top);
    }

    .chat-main {
        margin: 0;
        border-radius: 0;
        background: var(--md-sys-color-surface);
        padding-top: env(safe-area-inset-top);
    }

    body.no-active-conversation .chat-main {
        display: none;
    }

    body:not(.no-active-conversation) .users-sidebar {
        display: none;
    }

    .mobile-back-btn {
        display: inline-flex;
    }

    .chat-app-bar {
        padding: 0 4px;
    }

    .chat-app-bar .status-dot {
        --dot-cut: var(--md-sys-color-surface);
    }

    #chat-container {
        padding: 4px 8px 8px;
    }

    .message .text {
        max-width: 84%;
    }

    .message img.avatar {
        width: 28px;
        height: 28px;
    }

    #message-form {
        padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
    }

    #previews-container {
        padding: 0 8px;
    }

    #header-home-btn {
        display: none;
    }

    .modal-backdrop {
        padding: 16px;
    }

    .settings-modal {
        grid-template-columns: 1fr;
        width: 100%;
        height: 100%;
        border-radius: 0;
        position: fixed;
        inset: 0;
        background: var(--md-sys-color-surface);
        animation: md-fullscreen-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
    }

    #settings-backdrop {
        padding: 0;
    }

    .settings-nav {
        background: var(--md-sys-color-surface);
        padding: calc(4px + env(safe-area-inset-top)) 12px 16px;
    }

    .mobile-close-settings-nav {
        display: inline-flex;
    }

    .settings-nav-header {
        padding-left: 0;
        gap: 8px;
    }

    .settings-nav-header h2 {
        font-size: var(--md-sys-typescale-headline-medium-size);
        line-height: var(--md-sys-typescale-headline-medium-line-height);
        padding: 24px 0 8px 12px;
        width: 100%;
        order: 2;
    }

    .settings-nav-header {
        flex-wrap: wrap;
    }

    .settings-nav button[data-tab],
    .settings-nav .logout-nav-btn {
        height: 64px;
        border-radius: var(--md-sys-shape-corner-extra-small);
        background: var(--md-sys-color-surface-container);
        font-size: var(--md-sys-typescale-body-large-size);
        font-weight: 400;
        color: var(--md-sys-color-on-surface);
    }

    .settings-nav button[data-tab]:first-of-type {
        border-top-left-radius: var(--md-sys-shape-corner-large-increased);
        border-top-right-radius: var(--md-sys-shape-corner-large-increased);
    }

    .settings-nav button[data-tab]:has(+ .logout-nav-btn),
    .settings-nav button[data-tab]:last-of-type {
        border-bottom-left-radius: var(--md-sys-shape-corner-large-increased);
        border-bottom-right-radius: var(--md-sys-shape-corner-large-increased);
    }

    .settings-nav button[data-tab].active {
        background: var(--md-sys-color-surface-container);
        color: var(--md-sys-color-on-surface);
    }

    .settings-nav button[data-tab] i {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--md-sys-color-secondary-container);
        color: var(--md-sys-color-on-secondary-container);
        font-size: 22px;
    }

    .settings-nav .logout-nav-btn {
        margin-top: 16px;
        border-radius: var(--md-sys-shape-corner-large-increased);
        color: var(--md-sys-color-error);
    }

    .settings-content {
        position: fixed;
        inset: 0;
        background: var(--md-sys-color-surface);
        padding-top: env(safe-area-inset-top);
        transform: translateX(calc(100% * var(--nova-dir, 1)));
        visibility: hidden;
        transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized), visibility 0s linear var(--md-sys-motion-duration-medium);
    }

    .settings-modal.show-content .settings-content {
        transform: none;
        visibility: visible;
        transition-delay: 0s;
    }

    .settings-back-btn {
        display: inline-flex;
    }

    .settings-header {
        padding: 4px 4px 4px 4px;
    }

    .settings-header h2 {
        font-size: var(--md-sys-typescale-title-large-size);
        line-height: var(--md-sys-typescale-title-large-line-height);
    }

    #close-settings {
        display: none;
    }

    .settings-scroll {
        padding: 0 16px calc(32px + env(safe-area-inset-bottom));
    }

    .account-edit-icon {
        opacity: 1;
    }
}

@media (max-width: 599px) {
    .friend-modal,
    .group-modal,
    .group-info-modal,
    .select-members-modal,
    .member-picker-modal,
    .theme-paste-import-modal,
    .account-edit-modal {
        position: fixed;
        inset: 0;
        width: 100% !important;
        max-width: none !important;
        max-height: none;
        height: 100%;
        border-radius: 0;
        background: var(--md-sys-color-surface);
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        animation: md-fullscreen-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
    }

    .friend-modal .modal-header,
    .group-modal .modal-header,
    .group-info-modal .modal-header,
    .select-members-modal .modal-header,
    .member-picker-modal .modal-header,
    .theme-paste-import-modal .modal-header,
    .account-edit-modal .modal-header {
        min-height: 64px;
        padding: 8px 4px 8px 16px;
    }

    .friend-modal .modal-header h3,
    .group-modal .modal-header h3,
    .group-info-modal .modal-header h3,
    .select-members-modal .modal-header h3,
    .member-picker-modal .modal-header h3,
    .theme-paste-import-modal .modal-header h3,
    .account-edit-modal .modal-header h3 {
        font-size: var(--md-sys-typescale-title-large-size);
        line-height: var(--md-sys-typescale-title-large-line-height);
    }

    .modal-body {
        padding: 4px 16px 16px;
    }

    .modal-footer {
        padding: 12px 16px 16px;
    }

    .input-with-button {
        flex-wrap: wrap;
    }

    .input-with-button .primary-btn {
        width: 100%;
        height: 48px;
        border-radius: var(--md-sys-shape-corner-full);
    }

    .request-card {
        flex-wrap: wrap;
    }

    .request-card .request-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-tab-btn {
        padding: 0 8px;
        font-size: var(--md-sys-typescale-label-large-size);
    }

    .modal-tab-btn i {
        display: none;
    }

    .account-profile-row {
        flex-wrap: wrap;
    }

    .themes-grid,
    .fonts-grid {
        grid-template-columns: 1fr;
    }

    .theme-editor-card {
        padding: 16px;
    }
}

html.custom-fonts-active .material-symbols-rounded,
html.custom-fonts-active .fa,
html.custom-fonts-active .fas,
html.custom-fonts-active .far,
html.custom-fonts-active .fab {
    font-family: "Material Symbols Rounded" !important;
}

:root[dir="rtl"] {
    --nova-dir: -1;
}

:root[dir="rtl"] .fa-arrow-left,
:root[dir="rtl"] .fa-chevron-right,
:root[dir="rtl"] .md-menu-check {
    transform: scaleX(-1);
}

:root[dir="rtl"] .message-content,
:root[dir="rtl"] .conv-item-lastmsg {
    unicode-bidi: plaintext;
}

.md-menu-title {
    padding: 12px 16px 8px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 500;
}

.md-menu-divider {
    height: 1px;
    margin: 4px 12px;
    background: var(--md-sys-color-outline-variant);
}

.md-menu-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.md-menu-check {
    margin-inline-start: auto;
    font-size: 20px !important;
}

.md-menu-item[disabled] {
    opacity: 0.38;
    pointer-events: none;
}

.conv-item-flag {
    font-size: 16px;
    color: var(--md-sys-color-on-surface-variant);
}

.conv-item-flag.pin {
    color: var(--md-sys-color-primary);
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

.add-folder-chip {
    padding: 0 10px;
}

.add-folder-chip .material-symbols-rounded {
    font-size: 20px;
}

.blocked-composer-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 12px 12px;
    min-height: 56px;
    padding: 4px 8px 4px 20px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.blocked-composer-text {
    flex: 1;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.blocked-composer-bar .btn-text {
    color: var(--md-sys-color-on-error-container);
}

#message-form.blocked-hidden {
    display: none !important;
}

.settings-tab-intro {
    margin: 0 4px 16px;
}

#language-options .md-list-item {
    cursor: pointer;
}

.md-radio {
    width: 20px;
    height: 20px;
    accent-color: var(--md-sys-color-primary);
    cursor: pointer;
}

.dialog-input {
    margin-top: 4px;
}

.request-username,
#profile-username,
.account-username-text {
    direction: ltr;
    unicode-bidi: isolate;
    align-self: flex-start;
}

.profile-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.profile-actions > button {
    flex: 1 1 0;
    min-width: 0;
    height: 64px;
    padding: 6px 4px;
    flex-direction: column;
    gap: 4px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    font-size: var(--md-sys-typescale-label-medium-size);
    line-height: var(--md-sys-typescale-label-medium-line-height);
}

.profile-actions > button:active {
    border-radius: var(--md-sys-shape-corner-medium);
}

.profile-actions > button > span:not(.material-symbols-rounded) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-actions .danger-outline {
    color: var(--md-sys-color-error);
}

.profile-actions > button[hidden] {
    display: none;
}

.profile-actions .material-symbols-rounded {
    font-size: 22px;
    margin: 0 !important;
}

.call-view {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: min(46vh, 460px);
    min-height: 240px;
    margin: 0 12px 8px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-lowest);
    overflow: hidden;
    animation: md-sheet-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.call-view[hidden] {
    display: none;
}

.chat-main.in-call #chat-call-btn,
.chat-main.in-call #chat-video-btn {
    display: none;
}

.chat-main.call-expanded .call-view {
    flex: 1;
    height: auto;
    margin-bottom: 12px;
}

.chat-main.call-expanded #chat-container,
.chat-main.call-expanded #typing-indicator,
.chat-main.call-expanded #previews-container,
.chat-main.call-expanded #message-form,
.chat-main.call-expanded #blocked-composer-bar,
.chat-main.call-expanded #no-conversation-selected {
    display: none !important;
}

.call-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.call-focus {
    flex: 1;
    min-height: 0;
    display: flex;
}

.call-focus[hidden] {
    display: none;
}

.call-focus .call-tile {
    flex: 1;
    aspect-ratio: auto;
}

.call-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    align-content: stretch;
}

.call-grid[hidden] {
    display: none;
}

.call-focus .call-tile {
    cursor: zoom-out;
}

.call-tile {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-surface-container-high);
    overflow: hidden;
    cursor: pointer;
    isolation: isolate;
    transition: box-shadow var(--md-sys-motion-duration-short) linear;
}

.call-tile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 3px transparent;
    transition: box-shadow var(--md-sys-motion-duration-short) linear;
    pointer-events: none;
    z-index: 3;
}

.call-tile.speaking::after {
    box-shadow: inset 0 0 0 3px var(--md-sys-color-primary);
}

.call-tile video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    display: none;
}

.call-tile video.mirror {
    transform: scaleX(-1);
}

.call-tile.screen video {
    object-fit: contain;
}

.call-tile.has-video video {
    display: block;
}

.call-tile.has-video .call-tile-avatar {
    display: none;
}

.call-tile-avatar img {
    width: clamp(48px, 28%, 96px);
    aspect-ratio: 1;
    height: auto;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: auto;
}

.call-tile-avatar {
    width: 100%;
    display: flex;
    justify-content: center;
}

.call-tile.speaking .call-tile-avatar img {
    box-shadow: 0 0 0 4px var(--md-sys-color-primary);
}

.call-tile.connecting .call-tile-avatar img {
    opacity: 0.5;
    animation: md-pulse-soft 1.4s ease-in-out infinite;
}

@keyframes md-pulse-soft {
    50% {
        opacity: 0.9;
    }
}

.call-tile-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 16px);
    height: 28px;
    padding: 0 10px;
    border-radius: var(--md-sys-shape-corner-full);
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 500;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.call-tile-label > span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-tile-badge .material-symbols-rounded {
    font-size: 16px;
}

.call-tile-badge.off {
    color: #ffb4ab;
}

.call-tile-fs {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.5);
    color: #fff;
    cursor: pointer;
}

.call-tile.has-video .call-tile-fs {
    display: inline-flex;
}

.call-tile:fullscreen {
    border-radius: 0;
    background: #000;
    cursor: default;
}

.call-tile:fullscreen video {
    object-fit: contain;
}

.call-tile:fullscreen .call-tile-hint,
.call-tile:fullscreen .call-tile-live {
    display: none;
}

.call-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.call-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1 1 160px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
}

.call-status {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.call-timer {
    font-variant-numeric: tabular-nums;
    color: var(--md-sys-color-on-surface-variant);
}

.call-dot {
    width: 8px;
    height: 8px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--md-sys-color-warning);
}

.connected .call-dot {
    background: var(--md-sys-color-success);
}

.call-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.call-btn {
    position: relative;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    overflow: hidden;
    transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized), background-color var(--md-sys-motion-duration-short) linear;
}

.call-btn[hidden] {
    display: none;
}

.call-btn .material-symbols-rounded {
    font-size: 24px;
}

.call-btn:hover {
    filter: brightness(1.1);
}

.call-btn.on {
    border-radius: 50%;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.call-btn.off {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

.call-btn.leave {
    width: 72px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
}

.call-btn.accept {
    width: 72px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-success);
    color: var(--md-sys-color-on-success);
}

.call-btn.accept-video {
    border-radius: 50%;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.call-btn.small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.call-btn.small.leave {
    width: 52px;
    border-radius: var(--md-sys-shape-corner-full);
}

.call-join-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 12px 8px;
    min-height: 56px;
    padding: 8px 8px 8px 16px;
    border-radius: var(--md-sys-shape-corner-large-increased);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    animation: md-sheet-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.call-join-banner[hidden] {
    display: none;
}

.call-join-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-medium-size);
}

.call-mini {
    position: fixed;
    inset-inline-end: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom));
    z-index: 950;
    touch-action: none;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px 6px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-level3);
    animation: md-dialog-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.call-mini[hidden] {
    display: none;
}

.call-mini-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    max-width: 220px;
    padding: 0 8px;
    border: none;
    background: none;
    color: var(--md-sys-color-on-surface);
    text-align: start;
    cursor: pointer;
}

.call-mini-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.call-mini-text strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.call-mini-text small {
    font-size: var(--md-sys-typescale-label-small-size);
}

.call-incoming {
    position: fixed;
    top: calc(16px + env(safe-area-inset-top));
    left: 50%;
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 16px;
    width: min(440px, calc(100vw - 24px));
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    box-shadow: var(--md-sys-elevation-level3);
    transform: translateX(-50%);
    animation: md-incoming-in var(--md-sys-motion-duration-long) var(--md-sys-motion-easing-emphasized-decelerate);
}

.call-incoming[hidden] {
    display: none;
}

@keyframes md-incoming-in {
    from {
        opacity: 0;
        transform: translate(-50%, -24px);
    }
}

.call-incoming-avatar {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
    animation: md-ring 1.6s ease-out infinite;
}

@keyframes md-ring {
    0% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--md-sys-color-primary) 50%, transparent);
    }

    100% {
        box-shadow: 0 0 0 14px transparent;
    }
}

.call-incoming-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.call-incoming-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 500;
}

.call-incoming-sub {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
}

.call-incoming-actions {
    display: flex;
    gap: 8px;
}

.call-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.call-setting[hidden] {
    display: none;
}

.call-setting > label {
    font-size: var(--md-sys-typescale-title-small-size);
    font-weight: 500;
}

.call-settings-backdrop {
    z-index: 1400;
}

.conv-item-flag.call {
    color: var(--md-sys-color-success);
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 20;
}

@media (max-width: 839px) {
    .call-view {
        margin: 0 8px 8px;
    }

    .chat-main.call-expanded .call-view {
        margin: 0;
        border-radius: 0;
    }

    .call-stage {
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .call-grid {
        flex: 1 0 auto;
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(120px, 1fr);
        align-content: stretch;
    }

    .call-grid[data-layout="pairs"] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .call-grid .call-tile {
        aspect-ratio: auto;
        min-height: 0;
    }

    .call-grid[data-layout="pairs"] .call-tile:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .call-focus .call-tile-fs {
        display: inline-flex;
    }

    .call-info {
        flex-basis: 100%;
        justify-content: center;
    }

    .call-bar {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .call-controls {
        flex: 1 1 100%;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .call-btn {
        flex: 0 1 52px;
        width: 52px;
        min-width: 0;
        height: 52px;
    }

    .call-btn.leave {
        flex-basis: 72px;
    }

    .call-mini {
        bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .call-incoming {
        flex-wrap: wrap;
    }

    .call-incoming-actions {
        width: 100%;
        justify-content: space-around;
    }
}

.md-code {
    padding: 1px 6px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);
    font-family: ui-monospace, "Roboto Mono", monospace;
    font-size: 0.92em;
}

.md-spoiler {
    border-radius: 4px;
    background: var(--md-sys-color-on-surface-variant);
    color: transparent;
    cursor: pointer;
    transition: background-color var(--md-sys-motion-duration-short) linear, color var(--md-sys-motion-duration-short) linear;
}

.md-spoiler * {
    visibility: hidden;
}

.md-spoiler.revealed {
    background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
    color: inherit;
}

.md-spoiler.revealed * {
    visibility: visible;
}

.message-content u,
#profile-description u,
#account-description u {
    text-underline-offset: 2px;
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    width: min(300px, 70vw);
    padding: 6px 10px 6px 6px;
    color: inherit;
    direction: ltr;
}

.voice-play {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    cursor: pointer;
    transition: border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized), transform var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.voice-play:active {
    transform: scale(0.92);
}

.voice-player.playing .voice-play {
    border-radius: 14px;
}

.voice-play .material-symbols-rounded {
    font-size: 24px;
    font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.my-message .voice-play {
    background: var(--md-sys-color-on-primary-container);
    color: var(--md-sys-color-primary-container);
}

.voice-wave {
    flex: 1;
    min-width: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

@media (max-width: 599px) {
    .voice-wave span:nth-child(even) {
        display: none;
    }
}

.voice-wave span {
    flex: 1;
    max-width: 4px;
    min-width: 2px;
    height: calc(var(--h, 0.4) * 100%);
    min-height: 4px;
    border-radius: 2px;
    background: currentColor;
    opacity: 0.35;
    transition: opacity var(--md-sys-motion-duration-short) linear, height var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.voice-wave span.played {
    opacity: 1;
}

.other-message .voice-wave span.played {
    background: var(--md-sys-color-primary);
}

.voice-time {
    flex-shrink: 0;
    min-width: 34px;
    font-size: var(--md-sys-typescale-label-medium-size);
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}

.voice-speed {
    flex-shrink: 0;
    height: 24px;
    min-width: 34px;
    padding: 0 6px;
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    background: color-mix(in srgb, currentColor 14%, transparent);
    color: inherit;
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 600;
    cursor: pointer;
}

.message-content.media-content:has(.voice-player) {
    padding: 4px;
}

.seen-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 0 6px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-small-size);
    line-height: 16px;
    animation: md-fade-in var(--md-sys-motion-duration-medium) linear;
}

.seen-indicator .material-symbols-rounded {
    font-size: 16px;
}

.seen-indicator.seen .material-symbols-rounded {
    color: var(--md-sys-color-primary);
}

.seen-avatars {
    display: inline-flex;
}

.seen-avatars img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--md-sys-color-surface-container-low);
}

.seen-avatars img + img {
    margin-inline-start: -5px;
}

.status-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot-inline {
    --dot-cut: var(--md-sys-color-surface-container-high);
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--md-sys-color-success);
}

.status-dot-inline.idle {
    background: var(--md-sys-color-warning);
}

.status-dot-inline.dnd {
    background: var(--md-sys-color-error);
}

.status-dot-inline.offline {
    background: transparent;
    box-shadow: inset 0 0 0 2.5px var(--md-sys-color-outline);
}

.md-menu .status-dot-inline,
.md-bottom-sheet .status-dot-inline {
    --dot-cut: var(--md-sys-color-surface-container);
    width: 16px;
    height: 16px;
    margin: 4px;
}

.md-bottom-sheet .status-dot-inline {
    --dot-cut: var(--md-sys-color-surface-container-low);
}

.status-dot.idle::after,
.status-dot-inline.idle::after {
    content: "";
    position: absolute;
    top: -12%;
    left: -12%;
    width: 66%;
    height: 66%;
    border-radius: 50%;
    background: var(--dot-cut);
}

.status-dot.dnd::after,
.status-dot-inline.dnd::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 20%;
    right: 20%;
    height: 26%;
    min-height: 2px;
    border-radius: 2px;
    background: var(--dot-cut);
    transform: translateY(-50%);
}

.message-content.media-content:not(:has(.media-caption)):has(.video-player, .chat-media-image) {
    padding: 0;
    background: transparent !important;
    border-radius: 20px;
    overflow: hidden;
}

.message-content.media-content:has(.media-caption):has(.video-player) {
    padding: 4px;
}

.video-player {
    --vp-ratio: 1.7778;
    --vp-progress: 0;
    --vp-buffer: 0;
    position: relative;
    display: block;
    width: min(380px, 68vw, calc(min(420px, 60vh) * var(--vp-ratio)));
    aspect-ratio: var(--vp-ratio);
    border-radius: 18px;
    background: #000;
    overflow: hidden;
    color: #fff;
    cursor: pointer;
    isolation: isolate;
    outline: none;
    direction: ltr;
    user-select: none;
    -webkit-user-select: none;
}

.video-player:focus-visible {
    box-shadow: 0 0 0 3px var(--md-sys-color-secondary);
}

.video-player .vp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    margin: 0;
    object-fit: contain;
    background: #000;
}

.video-player.fullscreen {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    border-radius: 0;
    aspect-ratio: auto;
}

.video-player::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 96px;
    background: linear-gradient(to top, rgb(0 0 0 / 0.7), transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--md-sys-motion-duration-medium) linear;
    z-index: 1;
}

.video-player.show-controls.started::after,
.video-player.paused.started::after {
    opacity: 1;
}

.vp-big-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-level2);
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized), opacity var(--md-sys-motion-duration-short) linear, border-radius var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized);
}

.video-player.started.show-controls:not(.paused) .vp-big-play {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.vp-big-play:hover {
    border-radius: 22px;
}

.vp-big-play .material-symbols-rounded {
    font-size: 36px;
    font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 40;
}

.video-player:not(.paused) .vp-big-play {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.vp-duration-chip {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 8px;
    border-radius: var(--md-sys-shape-corner-full);
    background: rgb(0 0 0 / 0.6);
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.vp-duration-chip .material-symbols-rounded {
    font-size: 14px;
}

.video-player.started .vp-duration-chip {
    display: none;
}

.vp-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    border: 4px solid rgb(255 255 255 / 0.25);
    border-top-color: var(--md-sys-color-primary);
    animation: md-spin 0.9s linear infinite;
    display: none;
}

.video-player.loading:not(.paused) .vp-spinner {
    display: block;
}

.vp-controls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 0 6px 4px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity var(--md-sys-motion-duration-short) linear, transform var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
    pointer-events: none;
}

.video-player.started.show-controls .vp-controls,
.video-player.started.paused .vp-controls {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.vp-progress {
    position: relative;
    height: 20px;
    margin: 0 8px;
    display: flex;
    align-items: center;
    cursor: pointer;
    touch-action: none;
}

.vp-track {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgb(255 255 255 / 0.3);
    overflow: hidden;
    transition: height var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.vp-progress:hover .vp-track,
.video-player.scrubbing .vp-track {
    height: 6px;
}

.vp-buffer,
.vp-fill {
    position: absolute;
    inset: 0 auto 0 0;
}

.vp-buffer {
    width: calc(var(--vp-buffer) * 100%);
    background: rgb(255 255 255 / 0.35);
}

.vp-fill {
    width: calc(var(--vp-progress) * 100%);
    background: var(--md-sys-color-primary);
}

.vp-thumb {
    position: absolute;
    top: 50%;
    left: calc(var(--vp-progress) * 100%);
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    transform: scale(0);
    transition: transform var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
}

.vp-progress:hover .vp-thumb,
.video-player.scrubbing .vp-thumb {
    transform: scale(1);
}

.vp-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.vp-spacer {
    flex: 1;
}

.vp-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: #fff;
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 600;
    cursor: pointer;
}

.vp-btn[hidden] {
    display: none;
}

.vp-btn:hover {
    background: rgb(255 255 255 / 0.16);
}

.vp-btn .material-symbols-rounded {
    font-size: 22px;
    font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.vp-time {
    padding: 0 6px;
    font-size: var(--md-sys-typescale-label-medium-size);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.video-player.fullscreen .vp-btn {
    min-width: 48px;
    height: 48px;
}

.video-player.fullscreen .vp-btn .material-symbols-rounded {
    font-size: 28px;
}

@media (max-width: 420px) {
    .vp-speed,
    .vp-pip {
        display: none;
    }
}

.call-tile.is-screen {
    background: #000;
}

.call-tile-live {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-error);
    color: var(--md-sys-color-on-error);
    font-size: var(--md-sys-typescale-label-small-size);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.call-tile-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.5);
    color: #fff;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--md-sys-motion-duration-short) linear, transform var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-emphasized);
}

.call-grid .call-tile.has-video:hover .call-tile-hint {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.call-stage {
    position: relative;
}

.call-show-all {
    position: absolute;
    top: 16px;
    inset-inline-start: 16px;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px 0 10px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.call-show-all[hidden] {
    display: none;
}

.call-show-all .material-symbols-rounded {
    font-size: 18px;
}

.call-focus .call-tile-live {
    top: 16px;
    inset-inline-start: auto;
    left: auto;
    right: 60px;
}

.selected-file-preview.active {
    align-items: center;
    padding: 8px 4px 8px 12px;
}

.selected-file-name {
    flex: 1;
    min-width: 0;
    gap: 8px;
}

.att-strip {
    display: flex;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    padding: 2px;
    scrollbar-width: thin;
}

.att-item {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-highest);
    overflow: hidden;
}

.att-item img,
.att-item video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
}

.att-badge {
    position: relative;
    z-index: 1;
    color: #fff;
    font-size: 24px;
    text-shadow: 0 1px 4px rgb(0 0 0 / 0.5);
}

.att-icon {
    font-size: 26px;
    color: var(--md-sys-color-on-surface-variant);
}

.att-name {
    max-width: 58px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    color: var(--md-sys-color-on-surface-variant);
}

.att-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 2;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    cursor: pointer;
}

.att-remove .material-symbols-rounded {
    font-size: 16px;
}

.att-progress {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 2;
    height: 4px;
    background: rgb(0 0 0 / 0.35);
}

.att-progress::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--p, 0) * 100%);
    background: var(--md-sys-color-primary);
    transition: width 120ms linear;
}

.att-count {
    flex-shrink: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-variant-numeric: tabular-nums;
}

.album-stack {
    gap: 4px;
}

.message-content.media-content:has(.album-stack) {
    padding: 4px;
}

.media-album {
    display: grid;
    gap: 3px;
    width: min(380px, 68vw);
    grid-template-columns: repeat(6, 1fr);
    border-radius: 16px;
    overflow: hidden;
}

.album-cell {
    grid-column: span 3;
}

.media-album.count-3 .album-cell:first-child {
    grid-column: span 6;
}

.media-album.count-5 .album-cell:nth-child(n+3),
.media-album.count-6 .album-cell,
.media-album.count-7 .album-cell:nth-child(n+5),
.media-album.count-8 .album-cell:nth-child(n+3),
.media-album.count-9 .album-cell,
.media-album.count-10 .album-cell:nth-child(n+5) {
    grid-column: span 2;
}

.album-cell {
    position: relative;
    aspect-ratio: 1;
    min-width: 0;
    background: var(--md-sys-color-surface-container);
    overflow: hidden;
}

.media-album.count-3 .album-cell:first-child {
    aspect-ratio: 2 / 1;
}

.media-album.count-5 .album-cell:nth-child(-n+2),
.media-album.count-7 .album-cell:nth-child(-n+4),
.media-album.count-8 .album-cell:nth-child(-n+2),
.media-album.count-10 .album-cell:nth-child(-n+4) {
    aspect-ratio: 4 / 3;
}

.album-cell .chat-media-image {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: cover;
}

.album-cell .video-player,
.album-cell .video-player.portrait {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
}

.album-cell .video-player .vp-video {
    object-fit: cover;
}

.album-cell .video-player.fullscreen .vp-video {
    object-fit: contain;
}

.album-cell .vp-big-play {
    width: 44px;
    height: 44px;
}

.album-cell .vp-big-play .material-symbols-rounded {
    font-size: 26px;
}

.album-cell .vp-row .vp-mute,
.album-cell .vp-row .vp-speed,
.album-cell .vp-row .vp-pip,
.album-cell .vp-row .vp-time {
    display: none;
}

.album-stack .voice-player,
.album-stack .file-attachment {
    width: min(380px, 68vw);
}

.media-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 48px;
    height: 48px;
    background: rgb(255 255 255 / 0.12);
    color: #fff;
    transform: translateY(-50%);
}

.media-lightbox-nav[hidden] {
    display: none;
}

.media-lightbox-nav.prev {
    left: 16px;
}

.media-lightbox-nav.next {
    right: 16px;
}

.media-lightbox-nav .material-symbols-rounded {
    font-size: 32px;
}

.media-lightbox-counter {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: var(--md-sys-typescale-label-large-size);
    font-variant-numeric: tabular-nums;
}

.delete-account-btn {
    width: 100%;
    margin-top: 16px;
    justify-content: center;
}

.admin-label[style*="--tag-color"] {
    background: var(--tag-color);
    color: var(--tag-text, #fff);
}

.server-announcement {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top));
    left: 50%;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: min(640px, calc(100vw - 24px));
    padding: 6px 6px 6px 14px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-level2);
    translate: -50% 0;
}

.server-announcement-text {
    flex: 1;
    min-width: 0;
    font-size: var(--md-sys-typescale-body-medium-size);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.server-announcement .icon-btn {
    flex-shrink: 0;
    color: inherit;
}

.list-end {
    height: 1px;
}

.new-chat-modal .tab-desc {
    margin: 0 0 12px;
}

.new-chat-modal .status-alert {
    margin-top: 12px;
}

.new-chat-modal .modal-footer {
    margin-top: 16px;
}

.friends-filter {
    display: flex;
    margin-bottom: 12px;
}

.friends-heading {
    padding: 12px 4px 4px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 8px 8px 8px 12px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
}

.friend-avatar {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
}

.friend-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.friend-avatar .status-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 14px;
    height: 14px;
    border: 2px solid var(--md-sys-color-surface-container);
    border-radius: 50%;
}

.friend-names {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-names > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.friend-actions .material-symbols-rounded {
    font-size: 20px;
}

@media (max-width: 599px) {
    .friend-modal .modal-nav-tabs {
        padding: 0;
    }

    .friend-modal .modal-tab-btn {
        padding: 0 8px;
        gap: 4px;
        font-size: var(--md-sys-typescale-label-large-size);
    }

    .friend-modal .modal-tab-btn i {
        display: none;
    }

    .fab.fab-extended {
        padding: 0 16px 0 12px;
    }

    .call-mini {
        bottom: calc(160px + env(safe-area-inset-bottom));
    }
}

#change-group-avatar-btn,
#save-group-rename-btn {
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1;
    text-align: center;
}

#change-group-avatar-btn {
    display: inline-flex;
}

.call-mini.dragging,
.audio-dock.dragging {
    cursor: grabbing;
    animation: none;
}

.audio-dock {
    position: fixed;
    inset-inline-end: 16px;
    bottom: calc(160px + env(safe-area-inset-bottom));
    z-index: 949;
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(320px, max(280px, 78vw), calc(100vw - 16px));
    padding: 6px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    box-shadow: var(--md-sys-elevation-level3);
    touch-action: none;
    cursor: grab;
}

.audio-dock[hidden] {
    display: none;
}

.audio-dock-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.audio-dock-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 500;
}

.audio-dock-seek {
    width: 100%;
    height: 16px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    touch-action: auto;
    cursor: pointer;
}

.audio-dock-seek::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: var(--md-sys-color-outline-variant);
}

.audio-dock-seek::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--md-sys-color-outline-variant);
}

.audio-dock-seek::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    margin-top: -4px;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
    appearance: none;
    -webkit-appearance: none;
}

.audio-dock-seek::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: none;
    border-radius: 50%;
    background: var(--md-sys-color-primary);
}

.audio-dock-time {
    flex-shrink: 0;
    font-size: var(--md-sys-typescale-label-medium-size);
    color: var(--md-sys-color-on-surface-variant);
    font-variant-numeric: tabular-nums;
}

.audio-dock-btn {
    flex-shrink: 0;
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: var(--md-sys-typescale-label-medium-size);
    cursor: pointer;
}

.audio-dock-btn[data-dock="toggle"] {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.att-item.previewable {
    cursor: pointer;
}

.att-preview-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface-dim, var(--md-sys-color-surface));
    color: var(--md-sys-color-on-surface);
    animation: md-fullscreen-in var(--md-sys-motion-duration-medium) var(--md-sys-motion-easing-emphasized-decelerate);
}

.att-preview-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: calc(8px + env(safe-area-inset-top)) 8px 8px 16px;
    background: var(--md-sys-color-surface-container);
}

.att-preview-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-title-medium-size);
}

.att-preview-remove {
    color: var(--md-sys-color-error);
}

.att-preview-media {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

.att-preview-media img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--md-sys-shape-corner-large);
    object-fit: contain;
}

.att-preview-media .video-player {
    width: min(100%, 720px, calc((100dvh - 120px) * var(--vp-ratio)));
}

.att-preview-audio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: min(420px, 100%);
    padding: 24px 16px;
    border-radius: var(--md-sys-shape-corner-extra-large);
    background: var(--md-sys-color-surface-container-high);
}

.att-preview-audio > .material-symbols-rounded {
    font-size: 48px;
    color: var(--md-sys-color-primary);
}

.att-preview-audio .voice-player {
    width: 100%;
    padding: 0;
}

.att-preview-audio .voice-wave span.played {
    background: var(--md-sys-color-primary);
}

.swipe-reply-icon {
    position: absolute;
    top: 50%;
    left: -36px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    font-size: 18px;
    transform: translateY(-50%);
}

.swipe-reply-icon.own {
    left: auto;
    right: -36px;
}

.swipe-reply-icon.armed {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

@media (pointer: coarse) {
    #chat-container {
        overflow-x: hidden;
    }

    #chat-container .message:not(.system-message) {
        touch-action: pan-y;
        transition: transform 160ms var(--md-sys-motion-easing-standard);
    }

    #chat-container .message.swiping {
        transition: none;
    }
}

.group-member-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    display: flex;
}

.group-member-avatar-wrap .status-dot {
    --dot-cut: var(--md-sys-color-surface-container);
    width: 14px;
    height: 14px;
    border-width: 2px;
}

.message.command-result .message-content {
    text-align: start;
    white-space: pre-line;
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
}

.command-result-note {
    margin-top: 4px;
    font-size: var(--md-sys-typescale-label-small-size);
    opacity: 0.75;
}

.effect-canvas {
    position: fixed;
    inset: 0;
    z-index: 5000;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
}

.effect-countdown {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-primary);
    font-size: min(40vw, 240px);
    font-weight: 700;
    text-shadow: 0 4px 24px rgb(0 0 0 / 0.6);
    pointer-events: none;
    animation: effect-countdown-pop 1s var(--md-sys-motion-easing-emphasized-decelerate);
}

@keyframes effect-countdown-pop {
    from {
        opacity: 0;
        transform: scale(1.6);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.effect-shake {
    animation: effect-shake 0.7s linear;
}

@keyframes effect-shake {
    0%, 100% {
        transform: translate(0, 0);
    }
    20%, 60% {
        transform: translate(-8px, 3px);
    }
    40%, 80% {
        transform: translate(8px, -3px);
    }
}

.chat-tool-modal {
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    height: min(720px, 90vh);
}

.chat-tool-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.chat-media-tabs {
    flex-shrink: 0;
}

.chat-tool-day {
    padding: 12px 4px 8px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.chat-tool-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-tool-group.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 4px;
}

.chat-media-thumb {
    position: relative;
    aspect-ratio: 1;
    padding: 0;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-high);
    overflow: hidden;
    cursor: pointer;
}

.chat-media-thumb img,
.chat-media-thumb video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.chat-media-play {
    position: absolute;
    top: 50%;
    left: 50%;
    color: #fff;
    font-size: 36px;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 6px rgb(0 0 0 / 0.6);
}

.chat-tool-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 6px 8px 6px 12px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
}

.chat-tool-row-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-tool-row-main a,
.chat-tool-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-tool-row-main small,
.chat-search-result small {
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-small-size);
}

.chat-tool-status {
    padding: 16px;
    color: var(--md-sys-color-on-surface-variant);
    text-align: center;
}

.chat-tool-status:empty {
    display: none;
}

.chat-search-form {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px 8px;
}

.chat-search-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.chat-search-filters label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    font-size: var(--md-sys-typescale-label-medium-size);
    color: var(--md-sys-color-on-surface-variant);
}

.chat-search-filters .input {
    width: 100%;
    min-width: 0;
    color-scheme: dark light;
}

.chat-search-result {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    width: 100%;
    margin-bottom: 4px;
    padding: 10px 12px;
    border: none;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    text-align: start;
    cursor: pointer;
}

.chat-search-result span {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
    color: var(--md-sys-color-on-surface-variant);
}

.chat-search-result mark {
    border-radius: 3px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.chat-tool-modal.compact {
    height: auto;
    max-height: 90vh;
}

.poll-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
}

.poll-form-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.poll-form-option {
    display: flex;
    align-items: center;
    gap: 4px;
}

.poll-form-option .input {
    flex: 1;
    min-width: 0;
}

.poll-form [hidden] {
    display: none;
}

.poll-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(320px, 68vw);
}

.poll-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.poll-mode,
.poll-footer {
    font-size: var(--md-sys-typescale-label-medium-size);
    opacity: 0.75;
}

.poll-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background: linear-gradient(to right, color-mix(in srgb, currentColor 22%, transparent) var(--poll-share), color-mix(in srgb, currentColor 8%, transparent) var(--poll-share));
    color: inherit;
    text-align: start;
    cursor: pointer;
}

[dir="rtl"] .poll-option {
    background: linear-gradient(to left, color-mix(in srgb, currentColor 22%, transparent) var(--poll-share), color-mix(in srgb, currentColor 8%, transparent) var(--poll-share));
}

.poll-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.poll-option.selected .poll-check {
    background: currentColor;
    box-shadow: inset 0 0 0 3px var(--md-sys-color-surface-container-high);
}

.poll-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.poll-count {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.message-forwarded {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-style: italic;
}

.message-forwarded .material-symbols-rounded {
    font-size: 16px;
}

.message-forwarded-from {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--md-sys-color-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.options .forward-btn .material-symbols-rounded {
    font-size: 18px;
}

.forward-top {
    flex-shrink: 0;
    padding: 0 16px 8px;
}

.forward-top .input {
    width: 100%;
}

.forward-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.forward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 6px 12px;
    border-radius: var(--md-sys-shape-corner-large);
    cursor: pointer;
}

.forward-item.selected {
    background: var(--md-sys-color-secondary-container);
}

.forward-item img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.forward-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forward-bottom {
    flex-shrink: 0;
    padding: 8px 16px 16px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

.forward-bottom [hidden] {
    display: none;
}

.forward-bottom .modal-footer {
    align-items: center;
}

.forward-count {
    margin-inline-end: auto;
    color: var(--md-sys-color-on-surface-variant);
}

.new-chat-suggestions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.new-chat-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 60px;
    padding: 8px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
}

.new-chat-suggestion {
    cursor: pointer;
}

.new-chat-suggestion img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.new-chat-results {
    max-height: 300px;
    margin-top: 12px;
    overflow-y: auto;
}

.new-chat-suggestion .md-tonal-icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.poll-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.poll-card.ended .poll-option {
    cursor: default;
}

.poll-card.ended .poll-time {
    font-weight: 600;
}

.poll-voters {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
}

.poll-voters img {
    width: 22px;
    height: 22px;
    border: 2px solid var(--md-sys-color-surface-container-high);
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-high);
    object-fit: cover;
}

.poll-voters img + img {
    margin-inline-start: -11px;
}

.poll-question {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 600;
}

.poll-question textarea {
    width: 100%;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    color: inherit;
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 500;
    line-height: 1.35;
    resize: none;
}

.poll-question textarea::placeholder {
    color: inherit;
    opacity: 0.65;
}

.poll-question:focus-within {
    box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
}

.poll-section-label {
    margin-bottom: -4px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
}

.poll-form-option {
    min-height: 44px;
    padding-inline: 10px 4px;
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
}

.poll-form-option:focus-within {
    box-shadow: inset 0 0 0 2px var(--md-sys-color-primary);
}

.poll-option-number {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 600;
}

.poll-form-option input[type="text"] {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    color: var(--md-sys-color-on-surface);
}

.poll-form-option .icon-btn {
    width: 36px;
    height: 36px;
}

.poll-add-option {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0 12px 0 8px;
    border: none;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    color: var(--md-sys-color-primary);
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 500;
    cursor: pointer;
}

.poll-duration-select {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 12px;
    border: none;
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-highest);
    color: var(--md-sys-color-on-surface);
    font-size: var(--md-sys-typescale-body-large-size);
    text-align: start;
    cursor: pointer;
}

.poll-duration-value {
    flex: 1;
}

.security-modal-backdrop {
    z-index: 1200;
}

.security-modal {
    width: min(460px, 100%);
}

.security-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.security-modal .modal-footer {
    margin-top: 16px;
    padding: 0;
}

.security-modal .input {
    width: 100%;
}

.security-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
}

.security-step .primary-btn {
    align-self: flex-end;
}

.security-step-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.security-step-title span {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    font-size: var(--md-sys-typescale-label-medium-size);
    font-weight: 600;
}

.security-hint {
    margin: 0;
    color: var(--md-sys-color-on-surface-variant);
    font-size: var(--md-sys-typescale-body-small-size);
}

.security-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.security-fields label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--md-sys-typescale-label-large-size);
    color: var(--md-sys-color-on-surface-variant);
}

.security-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container);
    text-align: center;
}

.security-qr p {
    margin: 0;
    overflow-wrap: anywhere;
}

.security-qr img {
    width: min(220px, 100%);
    height: auto;
    border-radius: var(--md-sys-shape-corner-medium);
    background: #fff;
}

.security-status:empty {
    display: none;
}
