
@media (max-width: 760px) {
    .group-chat-drawer {
        --group-chat-mobile-bottom-clearance: calc(var(--bottom-nav-height, 78px) + var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 14px);
    }

    .group-chat-drawer-panel {
        height: calc(min(var(--app-vh), 100dvh) - var(--group-chat-mobile-bottom-clearance));
        max-height: calc(min(var(--app-vh), 100dvh) - var(--group-chat-mobile-bottom-clearance));
        overflow: hidden;
        padding-bottom: 16px;
    }

    .group-chat-create-form {
        display: grid;
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        overflow: hidden;
    }

    .group-chat-participant-picker {
        min-height: 0;
        flex: 1 1 auto;
    }

    .group-chat-participant-list {
        flex: 1 1 auto;
        max-height: min(240px, 30dvh);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .group-chat-drawer-actions {
        position: relative;
        z-index: 2;
        padding-top: 4px;
        background: color-mix(in srgb, var(--zn-member-bg-card) 96%, #050914 4%);
    }

    .group-settings-drawer .group-chat-drawer-panel {
        overflow: auto;
    }

    .group-settings-drawer .group-chat-create-form {
        overflow: visible;
    }
}

.group-settings-form {
    flex: 0 0 auto;
}

.group-avatar-editor {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--zn-member-border);
    border-radius: 14px;
    background: var(--zn-member-bg-surface-faint);
}

.group-avatar-editor legend {
    padding: 0 5px;
    color: var(--zn-member-text-primary);
    font-size: 0.94rem;
    font-weight: 650;
}

.group-avatar-picker-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
}

.group-avatar-preview {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: var(--zn-member-avatar-border-width, 1px) solid var(--zn-member-avatar-border);
    border-radius: 50%;
    background: var(--zn-member-avatar-background);
    color: var(--zn-member-avatar-text);
    font-size: 1.2rem;
    font-weight: 700;
}

.group-avatar-preview img,
.group-avatar-preview span {
    width: 100%;
    height: 100%;
}

.group-avatar-preview span {
    display: grid;
    place-items: center;
}

.group-avatar-preview img {
    display: block;
    object-fit: cover;
    object-position: center;
}

.group-avatar-preview [hidden] {
    display: none;
}

.group-avatar-dropzone {
    min-width: 0;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px dashed var(--zn-member-border);
    border-radius: 12px;
    color: var(--zn-member-text-primary);
    background: var(--zn-member-bg-app);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.group-avatar-dropzone:hover,
.group-avatar-dropzone:focus-within {
    border-color: color-mix(in srgb, var(--zn-success) 70%, var(--zn-member-border));
    background: color-mix(in srgb, var(--zn-success) 7%, var(--zn-member-bg-app));
}

.group-avatar-upload-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    color: var(--zn-success);
}

.group-avatar-dropzone-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.group-avatar-dropzone-copy strong,
.group-avatar-dropzone-copy span {
    overflow-wrap: anywhere;
}

.group-avatar-dropzone-copy strong {
    font-size: 0.88rem;
}

.group-avatar-dropzone-copy span {
    color: var(--zn-member-text-muted);
    font-size: 0.72rem;
    line-height: 1.35;
}

.group-settings-current,
.group-settings-danger {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--zn-member-border);
    border-radius: 12px;
    background: color-mix(in srgb, var(--zn-member-bg-surface) 82%, transparent);
}

.group-settings-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--zn-member-text-secondary);
    font-size: 0.86rem;
}

.group-settings-section-heading strong {
    color: var(--zn-member-text-primary);
    font-size: 0.92rem;
}

.group-settings-chip-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.group-settings-chip {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    align-items: center;
    gap: 10px;
    min-height: 50px;
    padding: 8px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 80%, transparent);
    border-radius: 12px;
    background: var(--zn-member-bg-card);
}

.group-settings-chip-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.group-settings-chip-copy strong,
.group-settings-chip-copy small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.group-settings-chip-copy small {
    color: var(--zn-member-text-muted);
    font-size: 0.76rem;
}

.group-settings-chip button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--zn-member-danger-text-soft) 30%, transparent);
    border-radius: 999px;
    color: var(--zn-member-danger-text-soft);
    background: transparent;
    cursor: pointer;
}

.group-settings-participant-picker {
    flex: 0 0 auto;
    min-height: 220px;
}

.group-settings-status {
    min-height: 18px;
    margin: 0;
    color: var(--zn-member-text-muted);
    font-size: 0.82rem;
}

.group-settings-status[data-tone="error"] {
    color: var(--zn-member-danger-text-soft);
}

.group-settings-delete-confirm {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--zn-member-danger-text-soft) 28%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--zn-member-danger-text-soft) 8%, transparent);
}

.group-settings-delete-confirm[hidden] {
    display: none;
}

.group-settings-delete-confirm p {
    margin: 0;
    color: var(--zn-member-text-secondary);
    font-size: 0.86rem;
}

.pwa-profile-menu {
    position: relative;
    justify-self: end;
    padding: 0;
    border: 0;
    background: transparent;
}

.profile-menu-hidden-trigger {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 18;
}

.pwa-profile-menu > summary {
    list-style: none;
}

.pwa-profile-menu[open] > summary {
    margin-bottom: 0;
}

.pwa-profile-menu > summary::-webkit-details-marker,
.chat-more-menu > summary::-webkit-details-marker,
.chat-menu-nested > summary::-webkit-details-marker {
    display: none;
}

.messages-settings-button,
.chat-more-button {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--zn-member-border-muted);
    border-radius: 12px;
    background: var(--zn-member-bg-surface-faint);
    color: var(--zn-member-text-secondary);
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.messages-settings-button:hover,
.chat-more-button:hover {
    transform: translateY(-1px);
}

.messages-settings-button svg,
.chat-more-button svg {
    width: 18px;
    height: 18px;
}

.profile-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 16;
    width: min(330px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--zn-member-border);
    border-radius: 18px;
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
}

.profile-menu-panel .server-upload-form,
.profile-menu-panel .logout-form {
    width: 100%;
}

.profile-menu-panel .topbar-upload-button,
.profile-menu-panel .surface-home-link,
.profile-menu-panel .logout-form .secondary-button {
    width: 100%;
    justify-content: center;
}

.profile-menu-panel > .user-header-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: -2px 0 0;
    padding: 0 2px 2px;
}

.profile-menu-panel > .user-header-actions .notification-settings-compact {
    width: 38px;
    height: 38px;
}

.profile-menu-panel > .user-header-actions .notification-enable-button,
.profile-menu-panel > .user-header-actions .user-header-logout-button {
    width: 38px;
    height: 38px;
}

.notification-settings {
    border: 1px solid var(--zn-member-border);
    border-radius: 16px;
    padding: 10px 12px;
    background: var(--zn-member-bg-surface-faint);
}

.notification-settings-compact {
    justify-self: end;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

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

.notification-copy strong {
    color: var(--zn-member-text-primary);
    font-size: 0.9rem;
    font-weight: 650;
}

.notification-copy span {
    color: var(--zn-member-text-muted);
    font-size: 0.78rem;
}

.notification-copy .notification-status {
    margin-top: 2px;
}

.notification-chevron {
    color: var(--zn-member-text-muted);
    font-size: 1.5rem;
    line-height: 1;
}

.user-bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 4px 2px;
    border-top: 1px solid var(--zn-member-border);
}

.user-bottom-nav-global {
    display: none;
}

.user-bottom-nav-link {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 48px;
    color: var(--zn-member-text-muted);
    font-size: 0.72rem;
}

.user-bottom-nav-link svg {
    width: 21px;
    height: 21px;
    color: var(--zn-member-bottom-nav-icon, currentColor);
}

.user-bottom-nav-link.is-active {
    color: var(--zn-member-bottom-nav-active-text);
}

.user-bottom-nav-link.is-active::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
}

.feed-unread-badge {
    position: absolute;
    top: 4px;
    right: 20%;
    min-width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 1px solid var(--zn-member-border);
    border-radius: 999px;
    background: var(--zn-member-accent);
    color: var(--zn-member-primary-text);
    font-size: 0.62rem;
    font-weight: 760;
    line-height: 1;
    box-shadow: 0 0 0 3px var(--zn-member-accent-soft);
}

.feed-unread-badge[hidden] {
    display: none !important;
}

.mobile-backlink svg {
    width: 20px;
    height: 20px;
}

.chat-more-menu {
    position: relative;
    flex: 0 0 auto;
}

.chat-more-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 18;
    width: min(330px, calc(100vw - 32px));
    padding: 10px;
    border: 1px solid var(--zn-member-border);
    border-radius: 18px;
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
}

.chat-menu-nested {
    position: relative;
}

.chat-menu-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    color: var(--zn-member-text-primary);
    cursor: pointer;
}

button.chat-menu-item {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    text-align: left;
}

.chat-mobile-call-item,
.chat-call-status-menu {
    display: none;
}

.chat-header-actions.has-chat-transient-status > .call-button-reason,
.chat-header-actions.is-chat-status-hidden > .call-button-reason {
    display: none !important;
}

.chat-header-actions.has-chat-transient-status {
    position: relative;
}

.chat-header-actions.has-chat-transient-status
    > .chat-call-status-menu:not([hidden]) {
    position: relative;
    display: block;
    flex: 0 0 auto;
}

.chat-header-actions.has-chat-transient-status .chat-call-status-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 8px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--zn-member-text-muted);
    cursor: pointer;
    transition: background-color 160ms ease;
}

.chat-header-actions.has-chat-transient-status .chat-call-status-button {
    list-style: none;
}

.chat-header-actions.has-chat-transient-status
    .chat-call-status-button::-webkit-details-marker {
    display: none;
}

.chat-header-actions.has-chat-transient-status .chat-call-status-button svg {
    width: 20px;
    height: 20px;
}

.chat-header-actions.has-chat-transient-status
    .chat-call-status-menu[data-tone="warning"]
    > .chat-call-status-button {
    color: var(--zn-member-warning-text);
}

.chat-header-actions.has-chat-transient-status
    .chat-call-status-menu[data-tone="error"]
    > .chat-call-status-button {
    color: var(--zn-member-danger-text);
}

.chat-header-actions.has-chat-transient-status .chat-call-status-button:hover,
.chat-header-actions.has-chat-transient-status .chat-call-status-button:focus-visible,
.chat-header-actions.has-chat-transient-status
    .chat-call-status-menu[open]
    > .chat-call-status-button {
    background: var(--zn-member-bg-surface-active);
}

.chat-header-actions.has-chat-transient-status .chat-call-status-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 19;
    width: min(320px, calc(100vw - 32px));
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--zn-member-border);
    border-radius: 14px;
    color: var(--zn-member-text-primary);
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
    font-size: 0.82rem;
    line-height: 1.45;
}

.chat-header-actions.has-chat-transient-status
    .chat-call-status-menu[open]
    > .chat-call-status-popover {
    display: grid;
}

.chat-header-actions.has-chat-transient-status .chat-call-status-dismiss {
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 7px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--zn-member-text-muted);
    cursor: pointer;
}

.chat-header-actions.has-chat-transient-status .chat-call-status-dismiss:hover,
.chat-header-actions.has-chat-transient-status .chat-call-status-dismiss:focus-visible {
    background: var(--zn-member-bg-surface-active);
    color: var(--zn-member-text-primary);
}

.chat-header-actions.has-chat-transient-status .chat-call-status-dismiss svg {
    width: 18px;
    height: 18px;
}

.chat-status-toggle[data-tone="warning"] {
    color: var(--zn-member-warning-text);
}

.chat-status-toggle[data-tone="error"] {
    color: var(--zn-member-danger-text);
}

.chat-menu-item:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.chat-menu-item:hover,
.chat-menu-item:focus-visible,
.chat-menu-nested[open] > .chat-menu-item {
    background: var(--zn-member-bg-surface-active);
}

.chat-menu-item svg {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
}

.chat-menu-item .chat-files-count {
    margin-left: auto;
}

.chat-more-popover .chat-files-popover,
.chat-participants-popover {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 8px;
    box-shadow: none;
    border-radius: 14px;
    background: var(--zn-member-bg-surface-faint);
}

.chat-participants-popover {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--zn-member-border);
}

.chat-participant-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.chat-participant-avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 12px;
    font-size: 0.74rem;
}

.chat-participant-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.chat-participant-copy span {
    color: var(--zn-member-text-muted);
    font-size: 0.76rem;
}







.chat-files-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--zn-member-accent-surface-strong);
    color: var(--zn-member-accent-text);
    font-size: 0.72rem;
    font-weight: 600;
}

.chat-files-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 12;
    width: min(360px, calc(100vw - 48px));
    padding: 12px;
    border: 1px solid var(--zn-member-border);
    border-radius: 18px;
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
}

.chat-files-popover-header,
.chat-files-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-files-popover-header {
    justify-content: space-between;
    margin-bottom: 10px;
}

.chat-files-popover-copy {
    min-width: 0;
}

.chat-files-popover-copy strong,
.chat-files-item-name {
    display: block;
    color: var(--zn-member-text-primary);
}

.chat-files-popover-copy span,
.chat-files-item-meta {
    font-size: 0.78rem;
    color: var(--zn-member-text-muted);
}

.chat-files-filter-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chat-files-filter-row::-webkit-scrollbar {
    display: none;
}

.chat-files-filter-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--zn-member-border);
    border-radius: 999px;
    background: var(--zn-member-bg-surface-hover);
    color: var(--zn-member-text-muted);
    font: inherit;
    font-size: 0.68rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.chat-files-filter-button.is-active {
    background: var(--zn-member-accent-surface);
    border-color: var(--zn-member-accent-border-strong);
    color: var(--zn-member-text-primary);
}

[data-theme-family="institutional-light"] body.user-body-messaging .chat-files-filter-button.is-active {
    background: var(--zn-member-filled-accent-background);
    color: var(--zn-member-filled-accent-text);
}

.chat-files-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--zn-member-bg-surface-strong);
    color: inherit;
    font-size: 0.64rem;
    font-weight: 600;
}

.chat-files-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-height: 360px;
    overflow: auto;
}

.chat-files-item {
    min-width: 0;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 10px;
    padding: 8px;
    border-radius: 14px;
    background: var(--zn-member-bg-surface-hover);
}

.chat-files-item[hidden] {
    display: none;
}

.chat-files-item-preview {
    width: 64px;
    height: 64px;
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--zn-member-border);
    border-radius: 12px;
    background:
        linear-gradient(var(--zn-member-bg-surface-active), var(--zn-member-bg-surface-active)),
        var(--zn-member-bg-card);
    color: var(--zn-member-text-secondary);
}

.chat-files-item-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-files-item-preview svg {
    width: 30px;
    height: 30px;
}

.chat-files-item-preview[data-chat-files-preview="image"] {
    background: var(--zn-member-bg-surface);
}

.chat-files-item-preview[data-chat-files-preview="video"] {
    background: #111;
}

.chat-files-item-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-files-item-preview[data-chat-files-preview="audio"] {
    color: var(--zn-member-accent-text);
}

.chat-files-item-copy {
    min-width: 0;
}

.chat-files-item-name,
.chat-files-item-meta {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-files-item-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.16;
}

.chat-files-item .file-message-link {
    grid-column: 2;
    justify-self: start;
    min-height: 30px;
    padding: 5px 10px;
    font-size: 0.76rem;
}

.chat-files-empty {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--zn-member-text-muted);
}

.chat-files-empty strong,
.chat-files-empty p {
    margin: 0;
}

.chat-subtitle {
    margin: 4px 0 0;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.call-button {
    min-width: 84px;
    white-space: nowrap;
}

.call-button:disabled {
    cursor: default;
    opacity: 0.6;
}

@keyframes call-event-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 26%, transparent); }
    72% { box-shadow: 0 0 0 12px color-mix(in srgb, currentColor 0%, transparent); }
    100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 0%, transparent); }
}

.call-event-drawer {
    width: min(100%, 420px);
    color: var(--zn-member-text-secondary);
    font-size: 0.78rem;
}

.call-event-drawer summary {
    width: max-content;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0 auto;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 56%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-bg-card) 72%, transparent);
    color: var(--zn-member-text-muted);
    cursor: pointer;
    list-style: none;
    backdrop-filter: blur(14px);
}

.call-event-drawer summary::-webkit-details-marker {
    display: none;
}

.call-event-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--zn-member-success-text, #39d98a);
}

.call-event-list {
    display: grid;
    gap: 7px;
    max-height: 148px;
    margin: 8px 0 0;
    padding: 10px;
    overflow: auto;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 62%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--zn-member-bg-card) 88%, transparent);
    box-shadow: var(--zn-member-shadow);
    backdrop-filter: blur(18px);
}

.call-event-list:empty::before {
    content: "No events yet.";
    color: var(--zn-member-text-muted);
}

.call-event-list li {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

.call-event-list time {
    color: var(--zn-member-text-muted);
}

.call-button-reason[data-tone="error"] {
    color: var(--zn-member-danger-text);
}

.call-button-reason[data-tone="warning"] {
    color: var(--zn-member-warning-text);
}

.screen-share-viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.screen-share-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 5, 10, 0.78);
    backdrop-filter: blur(10px);
}

.screen-share-viewer-shell {
    position: relative;
    z-index: 1;
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--zn-member-border-soft);
    border-radius: 22px;
    background:
        radial-gradient(circle at top, rgba(115, 152, 255, 0.08), transparent 45%),
        rgba(6, 12, 22, 0.96);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.screen-share-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.screen-share-viewer-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.screen-share-viewer-copy strong {
    font-size: 1.08rem;
}

.screen-share-viewer-copy span {
    color: var(--zn-member-text-muted);
    font-size: 0.86rem;
}

.screen-share-viewer-body {
    position: relative;
    flex: 1;
    min-height: min(72vh, 720px);
    border: 1px solid var(--zn-member-border-soft);
    border-radius: 18px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        rgba(4, 8, 15, 0.96);
}

.screen-share-viewer-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #020407;
}

.screen-share-viewer-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: var(--zn-member-text-muted);
    background:
        linear-gradient(135deg, rgba(122, 150, 255, 0.08), transparent 44%),
        rgba(4, 8, 15, 0.92);
}

.screen-share-viewer-fallback strong {
    color: var(--zn-member-text-primary);
    font-size: 1rem;
}

.danger-button {
    border-color: rgba(255, 138, 138, 0.22);
    color: var(--zn-member-danger-text-soft);
}

.message-timeline {
    position: relative;
    z-index: 1;
    isolation: isolate;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--zn-member-bg-pane-shade, var(--zn-member-bg-pane));
}

.message-timeline[hidden] {
    display: none;
}

.message-timeline > .message-date-divider:first-child,
.message-timeline > .message-row:first-child {
    margin-top: auto;
}

.message-row {
    position: relative;
    display: flex;
}

.message-row:hover,
.message-row:focus-within {
    z-index: 30;
}

.message-row.is-reaction-picker-open,
.message-row.is-overflow-menu-open {
    z-index: 40;
}

.message-row.is-touch-actions-open {
    z-index: 60;
}

.message-row.is-reply-target .message-bubble {
    animation: message-reply-target-pulse 820ms ease;
}

.message-date-divider {
    align-self: center;
    margin: 2px 0 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 48%, transparent);
    background: color-mix(in srgb, var(--zn-member-bg-surface-faint) 68%, transparent);
    color: var(--zn-member-text-muted);
    font-size: 0.72rem;
}

.message-row.is-sent {
    justify-content: flex-end;
}

.message-row.is-received {
    justify-content: flex-start;
}

.message-row.is-call-event {
    justify-content: center;
}

.message-typing-indicator {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 72%, transparent);
    border-radius: 8px;
    background: var(--zn-member-bg-surface-faint);
    color: var(--zn-member-text-secondary);
    box-shadow: var(--zn-member-shadow-soft);
}

.message-typing-label {
    font-size: 0.82rem;
    font-weight: 650;
}

.message-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.message-typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    animation: message-typing-dot 1s ease-in-out infinite;
}

.message-typing-dots i:nth-child(2) { animation-delay: 0.14s; }
.message-typing-dots i:nth-child(3) { animation-delay: 0.28s; }

@keyframes message-typing-dot {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
    .message-typing-dots i { animation: none; opacity: 0.72; }
}

.call-event-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: min(88%, 560px);
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 24%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-bg-surface-faint) 58%, transparent);
    color: var(--zn-member-text-secondary);
    font-size: 0.76rem;
    line-height: 1.35;
    text-align: center;
}

.message-bubble {
    --message-actions-gap: 0.5rem;
    --message-actions-width: 2.5rem;
    --message-header-action-size: 28px;
    position: relative;
    max-width: min(68%, 720px);
    border-radius: 16px;
    padding: 9px 14px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 28%, transparent);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0)),
        color-mix(in srgb, var(--zn-member-bg-bubble-in) 88%, transparent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.message-author-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 6px;
    min-width: 0;
    margin: 0 0 6px;
}

.message-author-copy {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 8px;
    overflow: hidden;
    padding-inline-end: calc(var(--message-header-action-size) + 6px);
}

.message-author-copy .message-author,
.message-author-copy .message-author-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-row.is-sent .message-bubble {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
        color-mix(in srgb, var(--zn-member-bg-bubble-out) 82%, transparent);
    border-color: var(--zn-member-sent-border);
    color: var(--zn-member-sent-text);
    box-shadow: var(--zn-member-sent-shadow);
}

.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) .message-author,
.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) .message-author-title,
.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) .message-time,
.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) .message-status {
    color: var(--zn-member-sent-meta-text);
}

.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) p,
.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) strong,
.message-row.is-sent:not(.is-group-message) .message-bubble:not(.has-media-message) a {
    color: var(--zn-member-sent-text);
}

.message-row.is-group-message .message-bubble:not(.has-media-message),
.message-row.is-sent.is-group-message .message-bubble:not(.has-media-message),
.message-row.is-group-message .message-bubble:not(.has-media-message) p,
.message-row.is-group-message .message-bubble:not(.has-media-message) strong,
.message-row.is-group-message .message-bubble:not(.has-media-message) a {
    color: var(--zn-member-group-message-text);
}

.message-row.is-group-message .message-bubble {
    --group-message-tone: var(--zn-member-accent);
    --group-message-base: var(--zn-group-message-surface);
    --group-message-bg: color-mix(in srgb, var(--group-message-base) 68%, var(--group-message-tone) 32%);
    --group-message-border: color-mix(in srgb, var(--zn-member-border) 42%, var(--group-message-tone) 58%);
    --group-message-author: color-mix(in srgb, var(--zn-member-text-primary) 52%, var(--group-message-tone) 48%);
    --group-message-shadow: color-mix(in srgb, var(--group-message-tone) 24%, transparent);
    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--zn-member-bg-surface) 16%, transparent),
            transparent
        ),
        var(--group-message-bg);
    border-color: var(--group-message-border);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, var(--zn-member-bg-surface) 20%, transparent),
        0 12px 28px color-mix(in srgb, var(--group-message-shadow) 80%, transparent);
}

.message-row.is-sent.is-group-message .message-bubble {
    --group-message-base: var(--zn-group-message-sent-surface);
}

.message-row.is-group-message .message-author {
    color: var(--zn-member-group-message-author-text);
    font-weight: 700;
}

.message-row.is-group-message :is(.message-time, .message-status) {
    color: var(--zn-member-group-message-meta-text);
}

.message-row .message-bubble.has-media-message,
.message-row.is-sent .message-bubble.has-media-message,
.message-row.is-received .message-bubble.has-media-message,
.message-row.is-group-message .message-bubble.has-media-message,
.message-row.is-sent.is-group-message .message-bubble.has-media-message {
    display: grid;
    width: fit-content;
    max-width: min(76%, 560px);
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.message-row.is-sent .message-bubble.has-media-message {
    margin-right: 10px;
}

.message-row.is-received .message-bubble.has-media-message {
    margin-left: 10px;
}

.message-row .message-bubble.has-video-message,
.message-row.is-sent .message-bubble.has-video-message,
.message-row.is-received .message-bubble.has-video-message,
.message-row.is-group-message .message-bubble.has-video-message {
    max-width: min(70%, 430px);
    background: transparent;
    box-shadow: none;
}

.message-bubble.has-media-message .message-author,
.message-bubble.has-media-message .message-author-title {
    width: fit-content;
    margin: 0;
    padding: 0;
    color: color-mix(in srgb, var(--zn-member-text-primary) 82%, var(--zn-member-accent) 18%);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.34);
}

.message-bubble.has-media-message .message-author-line {
    width: 100%;
    box-sizing: border-box;
    padding-inline: 14px;
}

.message-reply-preview {
    position: relative;
    display: grid;
    gap: 3px;
    margin: 0 0 8px;
    padding: 8px 10px 8px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--zn-member-bg-surface) 58%, transparent);
    color: var(--zn-member-text-secondary);
    overflow: hidden;
}

.message-reply-preview::before {
    content: "";
    position: absolute;
    inset: 7px auto 7px 0;
    width: 3px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-accent) 82%, #ffffff 18%);
}

.message-reply-label {
    min-width: 0;
    overflow: hidden;
    color: var(--zn-member-text-primary);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-reply-excerpt {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    color: var(--zn-member-text-muted);
    font-size: 0.76rem;
    line-height: 1.25;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.composer-reply-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 7px;
    padding: 8px 8px 8px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--zn-member-bg-surface) 72%, transparent);
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--zn-member-accent) 78%, #ffffff 22%);
}

.composer-message-form.is-replying .composer-input-shell {
    align-items: stretch;
    flex-direction: column;
    padding: 8px;
}

.composer-message-form.is-replying .composer-input {
    width: 100%;
}

.composer-message-form.is-replying .voice-record-button {
    top: auto;
    right: 16px;
    bottom: 15px;
    transform: none;
}

.composer-message-form.is-replying .voice-record-button:hover,
.composer-message-form.is-replying .voice-record-button:focus-visible {
    transform: none;
}

.composer-reply-preview[hidden] {
    display: none;
}

.composer-reply-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.composer-reply-label,
.composer-reply-excerpt {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composer-reply-label {
    color: var(--zn-member-text-primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.composer-reply-excerpt {
    color: var(--zn-member-text-muted);
    font-size: 0.76rem;
    line-height: 1.25;
}

.composer-reply-clear {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--zn-member-text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.composer-reply-clear:hover,
.composer-reply-clear:focus-visible {
    background: color-mix(in srgb, var(--zn-member-accent) 14%, transparent);
    color: var(--zn-member-text-primary);
}

.message-reaction-strip {
    position: absolute;
    right: 8px;
    bottom: -12px;
    left: auto;
    display: flex;
    width: max-content;
    max-width: calc(100vw - 48px);
    flex-wrap: nowrap;
    gap: 3px;
    align-items: center;
    justify-content: flex-end;
    overflow: visible;
    z-index: 12;
}

.message-reaction-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 28px;
    height: 22px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-surface) 92%, #ffffff 8%);
    color: inherit;
    font-size: 0.82rem;
    line-height: 1;
    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.08);
    cursor: pointer;
}

.message-row.is-received .message-reaction-strip {
    right: auto;
    left: 8px;
    justify-content: flex-start;
}

.message-reaction-badge.is-active {
    border-color: transparent;
    background: color-mix(in srgb, var(--zn-member-accent) 18%, var(--zn-member-surface) 82%);
}

.message-reaction-count {
    font-size: 0.72rem;
    font-weight: 800;
}

.message-reaction-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: min(260px, calc(100vw - 24px));
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 650;
    line-height: 1.25;
    text-align: center;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.2);
    pointer-events: none;
}

.message-reaction-tooltip[hidden] {
    display: none;
}

.message-reaction-trigger {
    position: absolute;
    left: -34px;
    top: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 72%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-surface) 96%, #ffffff 4%);
    color: var(--zn-member-text-muted);
    font-size: 0.92rem;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.92);
    transition: opacity 150ms ease, transform 150ms ease, color 150ms ease, border-color 150ms ease;
    z-index: 5;
}

.message-row.is-received .message-reaction-trigger {
    right: -34px;
    left: auto;
}

.message-bubble:hover .message-reaction-trigger,
.message-bubble:focus-within .message-reaction-trigger,
.message-row.is-reaction-picker-open .message-reaction-trigger {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
}

.message-reaction-trigger:hover,
.message-reaction-trigger:focus-visible,
.message-row.is-reaction-picker-open .message-reaction-trigger {
    border-color: color-mix(in srgb, var(--zn-member-accent) 48%, transparent);
    color: var(--zn-member-text-primary);
}

.message-reaction-palette {
    --message-reaction-choice-size: 28px;
    position: absolute;
    right: auto;
    left: var(--message-popup-left, 0px);
    top: var(--message-popup-top, 0px);
    bottom: auto;
    display: grid;
    width: min(194px, var(--message-popup-width, calc(100vw - 24px)));
    max-width: var(--message-popup-width, calc(100vw - 24px));
    max-height: var(--message-popup-max-height, calc(100vh - 24px));
    box-sizing: border-box;
    grid-template-columns: repeat(auto-fit, var(--message-reaction-choice-size));
    justify-content: center;
    gap: 3px;
    padding: 4px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 72%, transparent);
    border-radius: 18px;
    background: var(--zn-member-bg-pane);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
    overflow-x: hidden;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform-origin: right center;
    transition: opacity 150ms ease;
    z-index: 44;
}

.message-row.is-received .message-reaction-palette {
    right: auto;
    left: var(--message-popup-left, 0px);
    transform-origin: left center;
}

.message-row.is-reaction-picker-open .message-reaction-palette {
    opacity: 1;
    pointer-events: auto;
}

.message-reaction-choice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--message-reaction-choice-size, 28px);
    height: var(--message-reaction-choice-size, 28px);
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 1rem;
    cursor: pointer;
}

.message-reaction-choice:hover,
.message-reaction-choice:focus-visible,
.message-reaction-choice.is-active {
    background: color-mix(in srgb, var(--zn-member-accent) 18%, transparent);
}

@media (hover: none), (pointer: coarse) {
    .message-reaction-trigger {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(-50%) scale(1);
    }
}

.message-reaction-badge.is-reaction-feedback {
    animation: message-reaction-pop-sent 960ms cubic-bezier(0.22, 1.25, 0.36, 1);
}

.message-row.is-received .message-reaction-badge.is-reaction-feedback {
    animation-name: message-reaction-pop-received;
}

.message-edited {
    color: var(--zn-member-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
}

.message-row.is-deleted .message-bubble {
    border-style: dashed;
    box-shadow: none;
    opacity: 0.82;
}

.message-tombstone {
    color: var(--zn-member-text-muted);
    font-style: italic;
}

.message-reply-preview.is-deleted .message-reply-excerpt {
    font-style: italic;
}

.message-actions {
    position: absolute;
    right: calc(100% + var(--message-actions-gap));
    top: 50%;
    display: grid;
    width: var(--message-actions-width);
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 2px;
    padding: 3px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 58%, transparent);
    border-radius: 999px;
    background: var(--zn-member-bg-pane);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(-50% + 4px));
    transition: opacity 140ms ease, transform 140ms ease;
    z-index: 42;
}

.message-row.is-received .message-actions {
    right: auto;
    left: calc(100% + var(--message-actions-gap));
}

.message-actions::before {
    position: absolute;
    top: 0;
    right: calc(-1 * var(--message-actions-gap));
    bottom: 0;
    width: var(--message-actions-gap);
    content: "";
}

.message-row.is-received .message-actions::before {
    right: auto;
    left: calc(-1 * var(--message-actions-gap));
}

.message-bubble:hover > .message-actions,
.message-bubble:focus-within > .message-actions,
.message-row.is-touch-actions-open .message-bubble > .message-actions,
.message-row.is-reaction-picker-open .message-bubble > .message-actions,
.message-row.is-overflow-menu-open .message-bubble > .message-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%);
}

.message-author-line > .message-overflow-menu {
    position: absolute;
    top: 4px;
    right: 5px;
    width: var(--message-header-action-size);
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: opacity 140ms ease, transform 140ms ease;
    z-index: 43;
}

.message-author-line > .message-overflow-menu > summary {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 0;
    border-radius: 8px;
}

.message-author-line > .message-overflow-menu > summary > span {
    display: grid;
    width: 26px;
    height: 26px;
    box-sizing: border-box;
    place-items: center;
    padding-bottom: 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    line-height: 1;
    letter-spacing: 1px;
    text-indent: 1px;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.message-row:not(.is-deleted) .message-bubble.has-text-message > .message-body,
.message-row:not(.is-deleted) .message-bubble.has-text-message > .message-reply-preview {
    padding-inline-end: calc(var(--message-header-action-size) + 6px);
}

.message-bubble:hover .message-author-line > .message-overflow-menu,
.message-bubble:focus-within .message-author-line > .message-overflow-menu,
.message-author-line > .message-overflow-menu:focus-within,
.message-row.is-touch-actions-open .message-author-line > .message-overflow-menu,
.message-row.is-overflow-menu-open .message-author-line > .message-overflow-menu,
.message-author-line > .message-overflow-menu[open] {
    opacity: 1;
    transform: none;
}

.message-row.is-overflow-trigger-ready .message-author-line > .message-overflow-menu,
.message-author-line > .message-overflow-menu:focus-within,
.message-row.is-touch-actions-open .message-author-line > .message-overflow-menu,
.message-row.is-overflow-menu-open .message-author-line > .message-overflow-menu,
.message-author-line > .message-overflow-menu[open] {
    pointer-events: auto;
}

.message-row.is-editing .message-author-line > .message-overflow-menu {
    opacity: 0;
    pointer-events: none;
}

.message-timeline:has(.message-row.is-reaction-picker-open, .message-overflow-menu[open])
    .message-row:not(.is-reaction-picker-open):not(:has(.message-overflow-menu[open]))
    .message-bubble:hover > .message-actions {
    opacity: 0;
    pointer-events: none;
    transform: translateY(calc(-50% + 4px));
    transition: none;
}

.message-timeline:has(.message-row.is-reaction-picker-open, .message-overflow-menu[open])
    .message-row:not(.is-reaction-picker-open):not(:has(.message-overflow-menu[open]))
    .message-bubble:hover .message-author-line > .message-overflow-menu {
    opacity: 0;
    pointer-events: none;
    transform: translateY(3px);
    transition: none;
}

.message-actions > button,
.message-overflow-menu > summary,
.message-overflow-list button {
    border: 0;
    background: transparent;
    color: var(--zn-member-text-secondary);
    cursor: pointer;
    font: inherit;
}

.message-actions > button,
.message-overflow-menu > summary {
    display: flex;
    width: 100%;
    min-height: 28px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 750;
    list-style: none;
}

.message-action-icon {
    display: block;
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.message-actions [data-tooltip] {
    position: relative;
}

.message-actions [data-tooltip]::after {
    position: absolute;
    top: 50%;
    right: calc(100% + var(--message-actions-gap));
    width: max-content;
    max-width: min(160px, calc(100vw - 24px));
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.94);
    color: #ffffff;
    content: attr(data-tooltip);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15;
    opacity: 0;
    pointer-events: none;
    transform: translate(4px, -50%);
    transition: opacity 120ms ease, transform 120ms ease;
    white-space: nowrap;
    z-index: 30;
}

.message-row.is-received .message-actions [data-tooltip]::after {
    right: auto;
    left: calc(100% + var(--message-actions-gap));
    transform: translate(-4px, -50%);
}

.message-actions [data-tooltip]:hover::after,
.message-actions [data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
}

.message-overflow-menu > summary[data-tooltip] {
    position: relative;
}

.message-overflow-menu > summary[data-tooltip]::after {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: max-content;
    max-width: min(160px, calc(100vw - 24px));
    padding: 5px 8px;
    border-radius: 7px;
    background: rgba(15, 23, 42, 0.94);
    color: #ffffff;
    content: attr(data-tooltip);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 120ms ease, transform 120ms ease;
    white-space: nowrap;
    z-index: 46;
}

.message-overflow-menu > summary[data-tooltip]:hover::after,
.message-overflow-menu > summary[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: none;
}

.message-row.is-reaction-picker-open .message-reaction-trigger::after,
.message-overflow-menu[open] > summary::after {
    visibility: hidden;
    opacity: 0;
}

.message-bubble > .message-actions > .message-reaction-trigger {
    position: static;
    inset: auto;
    width: 100%;
    height: 28px;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
}

.message-actions > button:hover,
.message-actions > button:focus-visible,
.message-overflow-menu > summary:hover,
.message-overflow-menu > summary:focus-visible {
    background: color-mix(in srgb, var(--zn-member-accent) 14%, transparent);
    color: var(--zn-member-text-primary);
}

.message-author-line > .message-overflow-menu > summary:hover,
.message-author-line > .message-overflow-menu > summary:focus-visible {
    background: transparent;
    outline: none;
}

.message-author-line > .message-overflow-menu > summary:hover > span,
.message-author-line > .message-overflow-menu > summary:focus-visible > span {
    border-color: color-mix(in srgb, var(--zn-member-accent-border) 40%, transparent);
    background: color-mix(in srgb, var(--zn-member-accent) 13%, var(--zn-member-bg-pane));
    color: var(--zn-member-text-primary);
}

.message-author-line > .message-overflow-menu > summary:focus-visible > span {
    outline: 2px solid var(--zn-member-accent-border-strong, var(--zn-member-accent));
    outline-offset: 1px;
}

.message-author-line > .message-overflow-menu[open] > summary > span {
    border-color: color-mix(in srgb, var(--zn-member-accent-border) 62%, transparent);
    background: color-mix(in srgb, var(--zn-member-accent) 20%, var(--zn-member-bg-pane));
    color: var(--zn-member-text-primary);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, #ffffff 12%, transparent),
        0 4px 10px color-mix(in srgb, var(--zn-member-accent) 16%, transparent);
}

.message-overflow-menu {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
}

.message-overflow-menu > summary::-webkit-details-marker {
    display: none;
}

.message-overflow-list {
    position: absolute;
    right: auto;
    left: var(--message-popup-left, 0px);
    top: var(--message-popup-top, 0px);
    bottom: auto;
    display: none;
    width: min(176px, var(--message-popup-width, calc(100vw - 24px)));
    min-width: 0;
    max-width: var(--message-popup-width, calc(100vw - 24px));
    max-height: var(--message-popup-max-height, calc(100vh - 24px));
    box-sizing: border-box;
    flex-flow: column nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 3px;
    padding: 5px;
    border: 1px solid var(--zn-member-border);
    border-radius: 12px;
    background: var(--zn-member-bg-pane);
    color: var(--zn-member-text-primary);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
    overflow-x: hidden;
    overflow-y: auto;
    visibility: hidden;
    z-index: 44;
}

.message-overflow-menu[open] > .message-overflow-list {
    display: flex;
}

.message-overflow-list button,
.message-overflow-list > a {
    flex: 0 0 auto;
    display: flex;
    width: 100%;
    min-height: 32px;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.message-overflow-action-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.message-overflow-list button:hover,
.message-overflow-list button:focus-visible,
.message-overflow-list > a:hover,
.message-overflow-list > a:focus-visible {
    background: color-mix(in srgb, var(--zn-member-accent) 12%, transparent);
}

.message-overflow-list .is-danger {
    color: var(--zn-member-danger-text-soft, #d04444);
}

.message-inline-editor {
    display: grid;
    gap: 8px;
    min-width: min(420px, 62vw);
}

.message-inline-editor textarea {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    padding: 9px 10px;
    border: 1px solid color-mix(in srgb, var(--zn-member-accent) 58%, var(--zn-member-border));
    border-radius: 10px;
    background: var(--zn-member-bg-surface);
    color: var(--zn-member-text-primary);
    font: inherit;
}

.message-inline-editor-actions,
.message-mutation-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.message-mutation-status,
.message-mutation-dialog-status {
    margin: 7px 0 0;
    color: var(--zn-member-danger-text-soft, #d04444);
    font-size: 0.76rem;
}

.message-mutation-status[data-tone="success"] {
    color: var(--zn-member-success, #27834a);
}

.message-mutation-status[data-tone="progress"] {
    color: var(--zn-member-text-muted);
}

.message-mutation-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
}

.message-mutation-overlay[hidden] {
    display: none;
}

.message-mutation-dialog {
    width: min(420px, 100%);
    padding: 20px;
    border: 1px solid var(--zn-message-dialog-border);
    border-radius: 16px;
    background: var(--zn-message-dialog-background);
    color: var(--zn-message-dialog-text);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.26);
}

.message-mutation-dialog h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.message-mutation-dialog p {
    margin: 0 0 18px;
    color: var(--zn-message-dialog-muted-text);
}

.message-reaction-palette.is-message-popup-positioned,
.message-overflow-list.is-message-popup-positioned,
.message-row .message-reaction-palette.is-message-popup-fallback,
.message-row .message-overflow-list.is-message-popup-fallback {
    visibility: visible;
}

.message-reaction-palette.is-message-popup-positioned,
.message-overflow-list.is-message-popup-positioned {
    position: fixed;
}

.message-reaction-palette.is-message-popup-fallback,
.message-overflow-list.is-message-popup-fallback {
    position: fixed;
    right: auto;
    left: 50%;
    top: 50%;
    bottom: auto;
    width: min(312px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    transform: translate(-50%, -50%);
}

.message-overflow-list.is-message-popup-fallback {
    width: min(176px, calc(100vw - 24px));
}

@media (hover: none), (pointer: coarse) {
    .message-bubble {
        --message-actions-width: 3.25rem;
        --message-header-action-size: 44px;
    }

    .message-actions {
        display: none;
    }

    .message-row.is-touch-actions-open .message-bubble > .message-actions {
        display: grid;
    }

    .message-row:not(.is-deleted):is(
        [data-message-kind="image"],
        [data-message-kind="video"],
        [data-message-kind="audio"],
        [data-message-kind="file"]
    ) .message-bubble > .message-actions {
        display: grid;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(-50%);
        transition: none;
    }

    .message-row:not(.is-deleted):is(
        [data-message-kind="image"],
        [data-message-kind="video"],
        [data-message-kind="audio"],
        [data-message-kind="file"]
    ) .message-author-line > .message-overflow-menu {
        opacity: 1;
        pointer-events: auto;
        transform: none;
        transition: none;
    }

    .message-actions > button,
    .message-overflow-menu > summary,
    .message-bubble > .message-actions > .message-reaction-trigger {
        min-height: 44px;
        height: 44px;
    }

    .message-bubble > .message-actions > .message-reaction-trigger {
        width: 44px;
        justify-self: center;
    }

    .message-reaction-palette {
        --message-reaction-choice-size: 44px;
        width: min(312px, var(--message-popup-width, calc(100vw - 24px)));
        grid-template-columns: repeat(auto-fit, var(--message-reaction-choice-size));
        gap: 6px;
        padding: 0.5rem;
    }

    .message-reaction-choice {
        width: 44px;
        height: 44px;
    }

    .message-actions [data-tooltip]::after,
    .message-overflow-menu > summary[data-tooltip]::after {
        display: none;
        content: none;
    }

    .message-inline-editor {
        min-width: min(78vw, 420px);
    }
}

@media (max-width: 760px) and (hover: none),
       (max-width: 760px) and (pointer: coarse) {
    .message-bubble {
        --message-actions-width: 44px;
    }

    .message-action-icon-react {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 980px) {
    .message-timeline {
        overflow-x: hidden;
    }
}

@media (max-width: 760px) {
    .message-overflow-menu[open] > .message-overflow-list {
        padding: 0.5rem;
    }

    .message-overflow-list button,
    .message-overflow-list > a {
        min-width: 0;
        min-height: 44px;
        padding: 8px 10px;
        text-align: left;
        font-size: 0.75rem;
        white-space: nowrap;
    }
}

@media (max-width: 980px) and (hover: hover) and (pointer: fine) {
    .message-row.is-sent .message-actions [data-tooltip]::after {
        right: auto;
        left: calc(100% + var(--message-actions-gap));
        transform: translate(-4px, -50%);
    }

    .message-row.is-received .message-actions [data-tooltip]::after {
        right: calc(100% + var(--message-actions-gap));
        left: auto;
        transform: translate(4px, -50%);
    }

    .message-row.is-sent .message-actions [data-tooltip]:hover::after,
    .message-row.is-sent .message-actions [data-tooltip]:focus-visible::after,
    .message-row.is-received .message-actions [data-tooltip]:hover::after,
    .message-row.is-received .message-actions [data-tooltip]:focus-visible::after {
        transform: translate(0, -50%);
    }
}

@keyframes message-reply-target-pulse {
    0% {
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    }
    38% {
        box-shadow:
            0 0 0 2px color-mix(in srgb, var(--zn-member-accent-border) 64%, transparent),
            0 12px 26px rgba(15, 23, 42, 0.16);
    }
    100% {
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    }
}

@keyframes message-reaction-pop-sent {
    0% {
        opacity: 0;
        transform: translate(-18px, -12px) scale(0.5);
    }
    58% {
        opacity: 1;
        transform: translate(-6px, -4px) scale(1.5);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

@keyframes message-reaction-pop-received {
    0% {
        opacity: 0;
        transform: translate(18px, -12px) scale(0.5);
    }
    58% {
        opacity: 1;
        transform: translate(6px, -4px) scale(1.5);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .message-row.is-reply-target .message-bubble {
        animation: none;
    }

    .message-reaction-badge.is-reaction-feedback {
        animation: none;
    }

    .message-reaction-trigger,
    .message-reaction-palette,
    .message-actions,
    .message-actions [data-tooltip]::after,
    .message-author-line > .message-overflow-menu,
    .message-author-line > .message-overflow-menu > summary > span,
    .message-overflow-menu > summary[data-tooltip]::after {
        transition: none;
    }
}

.message-row.is-group-message.message-tone-0 {
    --group-message-tone: var(--zn-success);
}

.message-row.is-group-message.message-tone-1 {
    --group-message-tone: var(--zn-accent);
}

.message-row.is-group-message.message-tone-2 {
    --group-message-tone: #a78bfa;
}

.message-row.is-group-message.message-tone-3 {
    --group-message-tone: var(--zn-warning);
}

.message-row.is-group-message.message-tone-4 {
    --group-message-tone: var(--zn-danger);
}

.message-row.is-group-message.message-tone-5 {
    --group-message-tone: #8bcf6b;
}

.message-row.is-group-message.message-tone-6 {
    --group-message-tone: #46c7d8;
}

.message-row.is-group-message.message-tone-7 {
    --group-message-tone: #f08b54;
}

.message-row.is-group-message.message-tone-8 {
    --group-message-tone: #bd4ec6;
}

.message-row.is-group-message.message-tone-9 {
    --group-message-tone: #4f9dca;
}

.message-author {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: var(--zn-member-text-secondary);
}

.message-author-title {
    margin: 0 0 6px;
}

.message-body {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    line-height: 1.42;
    font-size: 0.92rem;
    font-weight: 400;
}

.message-body a,
.network-feed-content a {
    color: var(--zn-member-text-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.message-body a:hover,
.network-feed-content a:hover {
    color: var(--zn-member-accent-text);
}
