/* Extracted from the legacy post-workspace cascade. Keep route-tail ordering stable. */
@media (max-width: 980px) {

    body.user-body-messaging .call-screen-shell {
        padding:
            clamp(18px, 3vw, 28px)
            clamp(18px, 4vw, 28px)
            calc(max(18px, env(safe-area-inset-bottom)) + 10px);
    }

    body.user-body-messaging .call-screen-body {
        padding:
            clamp(24px, 6vh, 56px)
            0
            calc(170px + max(18px, env(safe-area-inset-bottom)));
    }

    body.user-body-messaging .call-screen-controls {
        gap: 14px;
    }}

@media (max-width: 760px) {

    .screen-share-viewer-modal {
        padding: 12px;
    }

    .screen-share-viewer-shell {
        max-height: calc(100vh - 24px);
        padding: 14px;
        border-radius: 18px;
    }

    .screen-share-viewer-header {
        flex-direction: column;
        align-items: stretch;
    }

    .screen-share-viewer-body {
        min-height: 48vh;
    }

    body.user-body-messaging .list-section.call-history-section:first-child .list-section-header {
        display: flex;
    }

    body.user-body-messaging .call-button {
        min-width: 38px;
        width: 38px;
        height: 34px;
        min-height: 34px;
        border-radius: 999px;
    }

    body.user-body-messaging .chat-action-group,
    body.user-body-messaging .call-button-reason {
        display: none;
    }

    body.user-body-messaging .call-screen-shell {


        gap: 20px;
    }

body.user-body-messaging .call-screen-topbar {
    align-items: center;
    justify-content: space-between;
}



body.user-body-messaging .call-screen-identity {
        gap: 24px;
    }

    body.user-body-messaging .call-screen-avatar {


        box-shadow:
            0 0 0 12px var(--zn-member-bg-surface-lift),
            0 0 0 24px var(--zn-member-bg-surface-faint),
            var(--zn-member-shadow);
    }



    body.user-body-messaging .call-screen-status {
        font-size: 1.06rem;
    }

    body.user-body-messaging .call-screen-status-detail,
    body.user-body-messaging .call-screen-subtitle {
        font-size: 0.9rem;
    }

    body.user-body-messaging .call-screen-footer {



        gap: 14px;
    }

    body.user-body-messaging .call-screen-secondary-actions {

        gap: 10px;
    }

    body.user-body-messaging .call-secondary-action {
        flex: 1 1 160px;
    }









    body.user-body-messaging .call-screen[data-call-ui-mode="incoming"] .call-screen-controls {
        width: min(100%, 256px);
    }

    body.user-body-messaging .call-screen[data-call-ui-mode="outgoing"] .call-screen-controls {
        width: min(100%, 108px);
    }

    body.user-body-messaging .call-screen[data-call-ui-mode="terminal"] .call-screen-body {
        padding-bottom: 24px;
    }

    body.user-body-messaging .composer.is-recording-voice .composer-status,
    body.user-body-messaging .composer.is-recording-voice .voice-record-hint {
        display: none;
    }

    body.user-body-messaging .composer.is-recording-voice [data-chat-attachment-status],
    body.user-body-messaging .composer.is-recording-voice [data-voice-record-indicator] {
        position: static;
        top: auto;
        right: auto;
        transform: none;
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.user-body-messaging .voice-record-indicator {
        right: 54px;
        max-width: calc(100% - 118px);
        font-size: 0.72rem;
    }}

@media (max-width: 430px) and (max-height: 740px) {
    body.user-body-messaging .call-screen-shell {
        gap: 12px;
    }



    body.user-body-messaging .call-screen-avatar {


        box-shadow:
            0 0 0 8px var(--zn-member-bg-surface-lift),
            0 0 0 18px var(--zn-member-bg-surface-faint),
            var(--zn-member-shadow);
    }

    body.user-body-messaging .call-screen-identity {
        gap: 16px;
    }



    body.user-body-messaging .call-screen-status {
        font-size: 0.94rem;
    }

    body.user-body-messaging .call-screen-footer {
        gap: 10px;
    }

    body.user-body-messaging .call-screen-controls {
        gap: 10px;
    }

    body.user-body-messaging .call-control-button {
        min-width: 74px;
    }



    body.user-body-messaging .call-control-button-label {
        font-size: 0.7rem;
    }}

@media (min-width: 981px) {

    body.user-body-messaging .voice-record-indicator {
        right: 58px;
        max-width: calc(100% - 134px);
        font-size: 0.72rem;
    }}

/* Final call surface overrides: audio, video and screen-share are separate visual modes. */
.call-screen {
    z-index: var(--z-layer-critical, 1700);
}

.screen-share-viewer-modal {
    z-index: calc(var(--z-layer-critical, 1700) + 10);
}

.call-screen-backdrop {
    background: linear-gradient(160deg, var(--zn-member-bg-shell), var(--zn-member-bg-app) 58%, var(--zn-member-bg-pane));
    backdrop-filter: blur(20px);
}

.call-screen-shell {
    gap: 0;
    padding: calc(18px + env(safe-area-inset-top)) clamp(18px, 3vw, 34px) calc(22px + env(safe-area-inset-bottom));
}

.call-screen-topbar {
    position: absolute;
    z-index: 5;
    top: calc(18px + env(safe-area-inset-top));
    left: clamp(18px, 3vw, 34px);
    right: clamp(18px, 3vw, 34px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.call-screen-secondary-actions {
    grid-column: 2;
    justify-self: end;
    width: auto;
    min-height: 0;
    gap: 8px;
    pointer-events: auto;
}

.call-secondary-action {
    min-width: 0;
    min-height: 38px;
    padding: 8px 14px;
    border-color: var(--zn-member-border-soft);
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
    backdrop-filter: blur(18px);
}

.call-screen[data-call-experience-mode="screen-share"] .call-secondary-action[data-call-screen-share] {
    border-color: var(--zn-danger-border);
    background: var(--zn-danger-surface-hover);
    color: var(--zn-danger-text-strong);
}

.call-screen-body {
    width: 100%;
    min-height: 100vh;
    padding: calc(78px + env(safe-area-inset-top)) 0 calc(132px + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: center;
}

.call-screen-identity {
    width: min(100%, 520px);
    gap: 18px;
}

.call-screen-avatar {
    width: clamp(132px, 17vw, 184px);
    height: clamp(132px, 17vw, 184px);
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    box-shadow: 0 0 0 12px var(--zn-member-bg-surface-lift), 0 0 0 26px var(--zn-member-bg-surface-faint), var(--zn-member-shadow);
}

.call-screen-title {
    font-size: clamp(2.2rem, 4.8vw, 4.4rem);
    line-height: 0.98;
}

.call-screen[data-call-experience-mode="video"] .call-screen-identity,
.call-screen[data-call-experience-mode="screen-share"] .call-screen-identity,
.call-screen[data-call-experience-mode="video"] .call-screen-status,
.call-screen[data-call-experience-mode="screen-share"] .call-screen-status,
.call-screen[data-call-experience-mode="video"] .call-screen-local-muted,
.call-screen[data-call-experience-mode="screen-share"] .call-screen-local-muted,
.call-screen[data-call-experience-mode="video"] .call-screen-subtitle,
.call-screen[data-call-experience-mode="screen-share"] .call-screen-subtitle {
    display: none !important;
}

.call-screen[data-call-experience-mode="video"] .call-screen-body,
.call-screen[data-call-experience-mode="screen-share"] .call-screen-body {
    padding: 0;
    justify-content: stretch;
}

.call-screen[data-call-experience-mode="video"] .call-video-stage,
.call-screen[data-call-experience-mode="screen-share"] .call-video-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    margin: 0;
}

.call-screen[data-call-experience-mode="video"] .call-video-grid,
.call-screen[data-call-experience-mode="screen-share"] .call-video-grid {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

.call-screen[data-call-experience-mode="video"] .call-video-tile,
.call-screen[data-call-experience-mode="screen-share"] .call-video-tile {
    position: absolute;
    inset: 0;
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--zn-member-bg-pane);
}

.call-screen[data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local,
.call-screen[data-call-experience-mode="screen-share"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
    inset: auto clamp(18px, 3vw, 34px) calc(132px + env(safe-area-inset-bottom)) auto;
    z-index: 3;
    width: min(22vw, 220px);
    min-width: 148px;
    aspect-ratio: 9 / 16;
    border: 1px solid var(--zn-member-border-soft);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--zn-member-shadow);
}

.call-screen[data-call-experience-mode="screen-share"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
    width: min(18vw, 180px);
    min-width: 128px;
}

.call-screen[data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="false"] .call-video-tile-local,
.call-screen[data-call-experience-mode="screen-share"] .call-video-stage[data-has-remote-video="false"] .call-video-tile-local {
    inset: 0;
    width: auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
}

.call-screen[data-call-experience-mode="video"] .call-video-remotes .call-video-tile,
.call-screen[data-call-experience-mode="screen-share"] .call-video-remotes .call-video-tile {
    z-index: 2;
}

.call-screen[data-call-experience-mode="video"] .call-video-label,
.call-screen[data-call-experience-mode="screen-share"] .call-video-label {
    left: 18px;
    bottom: calc(132px + env(safe-area-inset-bottom));
}

.call-screen[data-call-experience-mode="video"] .call-video-tile-local .call-video-label,
.call-screen[data-call-experience-mode="screen-share"] .call-video-tile-local .call-video-label {
    left: 10px;
    bottom: 10px;
}

.call-screen-footer {


    gap: 0;
}







.call-control-button svg {
    width: 24px;
    height: 24px;
}

.call-control-button-label {
    font-size: 0.72rem;
    line-height: 1.12;
}

.call-screen[data-call-experience-mode="audio"] [data-call-mute] {
    order: 1;
}

.call-screen[data-call-experience-mode="audio"] [data-call-speaker] {
    order: 2;
}

.call-screen[data-call-experience-mode="audio"] [data-call-video] {
    order: 3;
}

.call-screen[data-call-experience-mode="video"] [data-call-mute],
.call-screen[data-call-experience-mode="screen-share"] [data-call-mute] {
    order: 1;
}

.call-screen[data-call-experience-mode="video"] [data-call-video],
.call-screen[data-call-experience-mode="screen-share"] [data-call-video] {
    order: 2;
}

.call-screen[data-call-experience-mode="video"] [data-call-speaker],
.call-screen[data-call-experience-mode="screen-share"] [data-call-speaker] {
    order: 3;
}



.call-screen [data-call-accept] {
    order: 3;
}

@media (max-width: 760px) {
    body.user-body-messaging .call-screen-shell {

        padding-left: max(14px, env(safe-area-inset-left));
    }

    body.user-body-messaging .call-screen-topbar {
        top: calc(14px + env(safe-area-inset-top));
        left: max(14px, env(safe-area-inset-left));
        right: max(14px, env(safe-area-inset-right));
        grid-template-columns: minmax(0, 1fr) auto;
    }



    body.user-body-messaging .call-screen-body {
        padding: calc(72px + env(safe-area-inset-top)) 0 calc(122px + env(safe-area-inset-bottom));
    }

    body.user-body-messaging .call-screen-avatar {
        width: 132px;
        height: 132px;
    }

    body.user-body-messaging .call-screen-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }





    body.user-body-messaging .call-control-button {
        min-width: 64px;
        gap: 6px;
    }



    body.user-body-messaging .call-control-button-label {
        font-size: 0.68rem;
    }

    body.user-body-messaging .call-screen[data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local,
    body.user-body-messaging .call-screen[data-call-experience-mode="screen-share"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
        right: max(14px, env(safe-area-inset-right));
        bottom: calc(118px + env(safe-area-inset-bottom));
        width: min(28vw, 118px);
        min-width: 96px;
        border-radius: 14px;
    }

    body.user-body-messaging .call-screen[data-call-experience-mode="video"] .call-video-label,
    body.user-body-messaging .call-screen[data-call-experience-mode="screen-share"] .call-video-label {
        bottom: calc(118px + env(safe-area-inset-bottom));
    }}

@media (max-width: 430px) and (max-height: 740px) {
    body.user-body-messaging .call-screen-body {
        padding: calc(62px + env(safe-area-inset-top)) 0 calc(108px + env(safe-area-inset-bottom));
    }

    body.user-body-messaging .call-screen-avatar {
        width: 104px;
        height: 104px;
    }

    body.user-body-messaging .call-screen-title {
        font-size: 1.85rem;
    }

    }

.call-screen[data-call-experience-mode="video"] .call-video-stage[data-remote-video-count]:not([data-remote-video-count="0"]):not([data-remote-video-count="1"]) .call-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    padding: calc(74px + env(safe-area-inset-top)) clamp(12px, 2vw, 24px) calc(124px + env(safe-area-inset-bottom));
}

.call-screen[data-call-experience-mode="video"] .call-video-stage[data-remote-video-count]:not([data-remote-video-count="0"]):not([data-remote-video-count="1"]) .call-video-remotes .call-video-tile {
    position: relative;
    inset: auto;
    min-height: 0;
    border-radius: 14px;
    overflow: hidden;
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(96px + env(safe-area-inset-bottom));
    width: clamp(132px, 14vw, 200px);
    min-width: 0;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="2"] .call-video-grid,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="3"] .call-video-grid,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="4"] .call-video-grid,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="many"] .call-video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: 1px;
    padding: calc(74px + env(safe-area-inset-top)) 12px calc(112px + env(safe-area-inset-bottom));
    background: #05070c;
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="2"] .call-video-remotes .call-video-tile,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="3"] .call-video-remotes .call-video-tile,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="4"] .call-video-remotes .call-video-tile,
.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="many"] .call-video-remotes .call-video-tile {
    position: relative;
    inset: auto;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="3"] .call-video-grid {
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="3"] .call-video-remotes .call-video-tile:first-child {
    grid-row: span 2;
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="4"] .call-video-grid {
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

.call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-count][data-remote-video-layout="many"] .call-video-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 760px) {
    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
        position: relative;
        inset: auto;
        z-index: 2;
        width: auto;
        min-width: 0;
        min-height: 0;
        aspect-ratio: auto;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="1"] .call-video-grid,
    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="2"] .call-video-grid,
    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="3"] .call-video-grid,
    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="4"] .call-video-grid,
    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="many"] .call-video-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        grid-auto-rows: minmax(0, 1fr);
        gap: 1px;
        padding:
            calc(64px + env(safe-area-inset-top))
            10px
            calc(96px + env(safe-area-inset-bottom));
        background: #05070c;
    }

    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-has-remote-video="true"] .call-video-remotes .call-video-tile {
        position: relative;
        inset: auto;
        min-height: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    body.user-body-messaging .call-screen[data-call-scope="group"][data-call-experience-mode="video"] .call-video-stage[data-remote-video-layout="3"] .call-video-remotes .call-video-tile:first-child {
        grid-row: auto;
    }
}

/* Last-pass mobile call polish. Keep this block last so legacy call CSS cannot reintroduce labels or overlaps. */
.call-screen {
    --voice-pulse-scale: 1;
    --voice-pulse-alpha: 0.08;
    --voice-pulse-spread: 18px;
}

.call-screen.is-minimized {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.call-screen-icon-button {
    width: 46px;
    height: 46px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--zn-member-border-soft);
    border-radius: 50%;
    background: var(--zn-member-bg-card);
    color: var(--zn-member-text-primary);
    box-shadow: var(--zn-member-shadow);
    cursor: pointer;
    pointer-events: auto;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease;
}

.call-screen-icon-button {
    grid-column: 1;
    justify-self: start;
}

.call-screen-icon-button:hover {
    transform: translateY(-1px);
    border-color: var(--zn-member-accent-border);
    background: var(--zn-member-bg-surface-lift);
}

.call-screen-icon-button svg {
    width: 21px;
    height: 21px;
}

.messaging-layout.is-call-minimized .composer,
.messaging-layout.is-call-minimized:has(.call-screen:not(.is-hidden)) .composer {
    display: grid !important;
    pointer-events: auto;
}

.messaging-layout.is-call-minimized .message-timeline {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

.call-screen--audio .call-screen-backdrop {
    background:
        radial-gradient(circle at 28% 18%, var(--zn-member-accent-surface-strong), transparent 34%),
        radial-gradient(circle at 78% 24%, var(--zn-success-soft), transparent 30%),
        linear-gradient(180deg, var(--zn-member-bg-shell) 0%, var(--zn-member-bg-app) 68%, var(--zn-member-bg-pane) 100%);
}

.call-screen-shell {
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.call-screen--audio .call-screen-body {
    min-height: 100vh;
    padding:
        calc(68px + env(safe-area-inset-top))
        max(20px, env(safe-area-inset-left))
        calc(128px + env(safe-area-inset-bottom));
    align-items: center;
    justify-content: center;
}

.call-screen--audio .call-screen-identity {
    width: min(100%, 440px);
    gap: 18px;
}

.call-screen-avatar {
    position: relative;
    overflow: visible;
    transform: scale(var(--voice-pulse-scale));
    transition:
        transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
    letter-spacing: 0;
    isolation: isolate;
}

.call-screen-avatar::before {
    content: "";
    position: absolute;
    inset: calc(var(--voice-pulse-spread) * -1);
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, var(--zn-member-accent-surface-strong), transparent 68%);
    opacity: var(--voice-pulse-alpha);
    transform: scale(var(--voice-pulse-scale));
    transition:
        opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.call-screen-avatar .conversation-avatar-image {
    object-position: 50% 50%;
    border-radius: inherit;
    clip-path: circle(50% at 50% 50%);
    -webkit-clip-path: circle(50% at 50% 50%);
}

.call-screen-avatar::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border: 2px solid var(--zn-member-bg-surface-lift);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--zn-member-border-soft);
    pointer-events: none;
}

.call-screen--audio .call-screen-title {
    font-size: 3rem;
    line-height: 1.02;
    letter-spacing: 0;
}

.call-screen--audio .call-screen-status {
    margin: -4px 0 0;
    color: var(--zn-member-text-secondary);
    font-size: 1.04rem;
    font-weight: 620;
    letter-spacing: 0;
}

.call-screen--audio[data-call-scope="group"] .call-screen-body {
    align-items: center;
    justify-content: center;
}

.call-screen--audio .call-screen-subtitle,
.call-screen--audio .call-screen-local-muted,
.call-screen--audio .call-screen-kicker,
.call-screen--audio .call-video-stage,
.call-screen--video .call-screen-identity,
.call-screen--screen .call-screen-identity,
.call-screen--video .call-screen-status,
.call-screen--screen .call-screen-status,
.call-screen--video .call-screen-local-muted,
.call-screen--screen .call-screen-local-muted,
.call-screen--video .call-screen-subtitle,
.call-screen--screen .call-screen-subtitle {
    display: none !important;
}

.call-screen--video .call-screen-body,
.call-screen--screen .call-screen-body {
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

.call-screen--video .call-video-stage,
.call-screen--screen .call-video-stage {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

.call-screen--video .call-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.call-screen--screen .call-screen-topbar {
    grid-template-columns: minmax(0, 1fr) auto;
}

.call-screen--screen .call-screen-secondary-actions {
    grid-column: 2;
    justify-self: end;
}

.call-screen--screen .call-secondary-action[data-call-screen-share] {
    min-width: 72px;
    border-color: var(--zn-danger-border);
    background: var(--zn-danger-surface-hover);
}

.call-screen-footer {
    position: fixed;
    z-index: 6;
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
}

.call-screen-controls {
    width: max-content;
    max-width: calc(100vw - 28px);
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 64px;
    align-items: center;
    justify-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--zn-member-border-soft);
    border-radius: 999px;
    background: var(--zn-member-bg-card);
    box-shadow: var(--zn-member-shadow);
    backdrop-filter: blur(24px);
}

.call-screen[data-call-ui-mode="incoming"] .call-screen-controls {
    grid-template-columns: repeat(2, minmax(64px, 1fr));
    width: min(100%, 180px);
}

.call-screen[data-call-ui-mode="outgoing"] .call-screen-controls {
    grid-template-columns: minmax(64px, 1fr);
    width: min(100%, 96px);
}

.call-screen[data-call-ui-mode="active"] .call-screen-controls {
    width: max-content;
    max-width: calc(100vw - 28px);
}

.call-control-button {
    min-width: 0;
    width: 64px;
    gap: 0;
    flex: 0 0 auto;
}

.call-screen .call-screen-controls .call-control-button .call-control-button-face {
    width: 58px;
    height: 58px;
    color: #fff;
}

.call-control-button-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.call-info-action {
    width: auto;
    max-width: min(100%, 280px);
    min-height: 44px;
    margin-top: 4px;
    padding: 0 18px 0 12px;
    border: 1px solid var(--zn-member-accent-border);
    border-radius: 999px;
    background: var(--zn-member-bg-surface-strong);
    box-shadow: var(--zn-member-shadow);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.call-info-action-icon {
    width: 30px;
    height: 30px;
    box-shadow: none;
}

.call-info-action-label {
    font-size: 0.92rem;
    font-weight: 760;
    white-space: nowrap;
}

.call-info-action[data-join-state="failed"] {
    border-color: var(--zn-danger-border);
    background: var(--zn-danger-soft);
    color: var(--zn-danger-text-strong);
}

.call-screen--audio [data-call-speaker],
.call-screen--video [data-call-speaker] {
    order: 1;
}

.call-screen--audio [data-call-video],
.call-screen--video [data-call-video] {
    order: 2;
}

.call-screen--audio [data-call-mute],
.call-screen--video [data-call-mute] {
    order: 3;
}

.call-screen--screen [data-call-mute] {
    order: 1;
}

.call-screen--screen [data-call-video] {
    order: 2;
}

.call-screen--screen [data-call-speaker] {
    order: 3;
}



.call-control-button[data-call-video][data-active="true"] .call-control-button-face {
    border-color: var(--zn-member-accent-border-strong);
    background: var(--zn-member-accent-border-strong);
    color: #fff;
}

@media (max-width: 760px) {










    body.user-body-messaging .call-screen--video .call-video-stage[data-has-remote-video="true"] .call-video-tile-local,
    body.user-body-messaging .call-screen--screen .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
        border-radius: 14px;
    }}

@media (max-width: 430px) and (max-height: 740px) {
    body.user-body-messaging .call-screen--audio .call-screen-avatar {
        width: 108px;
        height: 108px;
    }

    body.user-body-messaging .call-screen--audio .call-screen-title {
        font-size: 2rem;
    }

}

/* Mobile call UI safety pass: visual-only separation for audio, video and screen modes. */
.call-screen--audio .call-video-stage {
    display: none !important;
}

.call-screen--video .call-screen-identity,
.call-screen--screen .call-screen-identity {
    display: none !important;
}

.call-screen--video .call-video-stage,
.call-screen--screen .call-video-stage {
    display: block;
}

.call-screen--video .call-screen-local-muted,
.call-screen--screen .call-screen-local-muted {
    position: fixed;
    z-index: 7;
    left: 50%;
    bottom: calc(98px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
}

.call-screen [data-call-screen-share] {
    order: 3;
}

.call-screen .meeting-memo-control {
    order: 4;
}

.call-screen [data-call-mute] {
    order: 2;
}

.call-screen [data-call-video] {
    order: 1;
}

.call-screen--audio [data-call-speaker] {
    order: 1;
}

.call-screen--audio [data-call-video] {
    order: 2;
}

.call-screen--audio [data-call-mute] {
    order: 3;
}

.call-screen [data-call-hangup],
.call-screen [data-call-decline] {
    order: 5;
}

.call-control-button[data-call-screen-share][data-active="true"] .call-control-button-face {
    border-color: var(--zn-success-border);
    background: var(--zn-success-soft-strong);
    color: var(--zn-member-success-text);
}

body.user-body-meetings .meeting-memo-control[data-memo-state="recording"] .meeting-memo-button {
    border-color: rgba(248, 113, 113, 0.42);
    background: rgba(127, 29, 29, 0.56);
    color: #fecaca;
}

body.user-body-meetings .meeting-memo-control[data-memo-state="processing"] .meeting-memo-button {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(120, 53, 15, 0.48);
    color: #fde68a;
}

body.user-body-meetings .meeting-layout.meeting-room-active [data-meeting-rtc-status] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 760px) {
    body.user-body-messaging .call-screen,
    body.user-body-messaging .call-screen-shell,
    body.user-body-messaging .call-screen-body {
        min-height: 100dvh;
    }

    body.user-body-messaging .call-screen--video .call-screen-body,
    body.user-body-messaging .call-screen--screen .call-screen-body {
        min-height: 0;
    }

    body.user-body-messaging .call-screen-shell {
        padding:
            calc(12px + env(safe-area-inset-top))
            max(10px, env(safe-area-inset-right))
            calc(18px + env(safe-area-inset-bottom))
            max(10px, env(safe-area-inset-left));
    }

    body.user-body-messaging .call-screen-secondary-actions {
        position: fixed;
        z-index: 7;
        top: calc(58px + env(safe-area-inset-top));
        right: max(10px, env(safe-area-inset-right));
        width: auto;
        min-height: 0;
    }

    body.user-body-messaging .call-screen-secondary-actions:empty,
    body.user-body-messaging .call-screen-secondary-actions[hidden] {
        display: none !important;
    }

    body.user-body-messaging .call-secondary-action {
        min-width: 0;
        min-height: 36px;
        padding: 8px 12px;
        font-size: 0.76rem;
    }

    body.user-body-messaging .call-screen--video .call-switch-camera-overlay:not([hidden]) {
        position: fixed;
        z-index: 8;
        top: calc(14px + env(safe-area-inset-top));
        right: max(12px, env(safe-area-inset-right));
        display: grid;
        place-items: center;
    }

    body.user-body-messaging .call-screen-controls {
        width: max-content;
        max-width: calc(100vw - 20px);
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 46px;
        gap: 8px;
        padding: 8px;
    }

    body.user-body-messaging .call-control-button svg {
        width: 20px;
        height: 20px;
    }

    body.user-body-messaging .call-info-action {
        max-width: min(100%, 260px);
        min-height: 42px;
        padding-right: 14px;
    }

    body.user-body-messaging .call-screen--audio .call-screen-body {
        padding:
            calc(44px + env(safe-area-inset-top))
            max(16px, env(safe-area-inset-left))
            calc(230px + env(safe-area-inset-bottom));
    }

    body.user-body-messaging .call-screen--audio .call-screen-identity {
        gap: 12px;
        transform: translateY(-56px);
    }

    body.user-body-messaging .call-screen--audio .call-screen-avatar {
        width: 96px;
        height: 96px;
        box-shadow:
            0 0 0 8px var(--zn-member-bg-surface-lift),
            0 0 0 16px var(--zn-member-bg-surface-faint),
            var(--zn-member-shadow);
    }

    body.user-body-messaging .call-screen--audio .call-screen-avatar::before {
        inset: calc((var(--voice-pulse-spread) + 4px) * -1);
    }

    body.user-body-messaging .call-screen--audio .call-screen-title {
        font-size: 1.78rem;
        line-height: 1.04;
    }

    body.user-body-messaging .call-screen--audio .call-screen-status,
    body.user-body-messaging .call-screen--audio .call-screen-status-detail {
        position: static;
        z-index: auto;
        min-height: 30px;
        max-width: min(320px, calc(100vw - 48px));
        margin: 2px auto 0;
        padding: 7px 14px;
        border: 1px solid var(--zn-member-border-soft);
        border-radius: 999px;
        background: color-mix(in srgb, var(--zn-member-bg-card) 92%, transparent);
        box-shadow: var(--zn-member-shadow);
        backdrop-filter: blur(18px);
        transform: none;
        text-align: center;
    }

    body.user-body-messaging .call-screen--audio .call-screen-status {
        font-size: 0.98rem;
    }

    body.user-body-messaging .call-screen .meeting-memo-control {
        width: 50px;
        justify-self: center;
    }

    body.user-body-messaging .call-screen .meeting-memo-button {
        width: 50px;
    }

    body.user-body-messaging .call-control-button {
        width: 46px;
    }

    body.user-body-messaging .call-screen .call-screen-controls .call-control-button .call-control-button-face {
        width: 42px;
        height: 42px;
    }

    body.user-body-messaging .call-screen-footer {
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: calc(18px + env(safe-area-inset-bottom));
    }

    body.user-body-messaging:has(.call-screen:not(.is-hidden):not(.is-minimized)) .user-bottom-nav {
        display: none !important;
        pointer-events: none;
    }

    body.user-body-messaging .call-screen--video .call-video-stage[data-has-remote-video="true"] .call-video-tile-local,
    body.user-body-messaging .call-screen--screen .call-video-stage[data-has-remote-video="true"] .call-video-tile-local {
        bottom: calc(92px + env(safe-area-inset-bottom));
        right: max(10px, env(safe-area-inset-right));
        width: 96px;
        min-width: 86px;
    }

    body.user-body-messaging .call-screen--video .call-video-label,
    body.user-body-messaging .call-screen--screen .call-video-label {
        bottom: calc(92px + env(safe-area-inset-bottom));
    }}

@media (min-width: 981px) {

    body.user-body-messaging .messaging-layout.is-call-minimized .composer {
        position: relative;
        bottom: auto;
        height: 78px;
        min-height: 78px;
        max-height: 78px;
        margin-top: 0;
        padding-top: 11px !important;
        padding-bottom: 11px !important;
        overflow: visible;
    }

    body.user-body-messaging .messaging-layout.is-call-minimized .composer-message-form {
        height: 54px;
        min-height: 54px;
    }}

.call-screen--audio .call-screen-identity {
    gap: 24px;
}

.call-screen--audio .call-screen-avatar {
    width: clamp(124px, 18vw, 164px);
    height: clamp(124px, 18vw, 164px);
    flex: 0 0 auto;
    box-shadow:
        0 0 0 10px var(--zn-member-bg-surface-lift),
        0 0 0 22px var(--zn-member-bg-surface-faint),
        var(--zn-member-shadow);
}

.call-screen--audio .call-screen-avatar::before {
    inset: calc((var(--voice-pulse-spread) + 2px) * -1);
}

.call-screen--audio .call-screen-copy {
    position: relative;
    z-index: 1;
    margin-top: 8px;
}

.call-screen--audio .call-screen-avatar .conversation-avatar-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Keep the microphone picker centered independently from the back and screen-share actions. */
.call-screen-topbar,
body.user-body-messaging .call-screen-topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.call-screen-topbar .call-microphone-field {
    grid-column: 2;
    justify-self: center;
}

.call-screen-topbar .call-screen-secondary-actions,
.call-screen--screen .call-screen-secondary-actions {
    grid-column: 3;
    justify-self: end;
}
