
.image-message-card,
.video-message-card,
.audio-message-card,
.file-message-card {
    display: flex;
    gap: 8px;
    position: relative;
    max-width: min(100%, 360px);
}

.image-message-card,
.video-message-card,
.audio-message-card {
    flex-direction: column;
    gap: 8px;
}

.image-message-card {
    width: fit-content;
    max-width: min(76vw, 560px);
}

.video-message-card {
    width: clamp(220px, 42vw, 390px);
    max-width: 100%;
}

.audio-message-card {
    width: min(100%, 520px);
}

.audio-message-card .attachment-inline-main {
    gap: 0;
}

.file-message-card {
    align-items: center;
    min-width: min(100%, 260px);
    padding: 7px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--zn-member-bg-surface-faint) 38%, transparent);
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 26%, transparent);
}

.attachment-preview-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: zoom-in;
    text-align: left;
}

.image-message-card .attachment-preview-button,
.video-message-card .attachment-preview-button {
    width: fit-content;
    max-width: 100%;
}

.chat-media-frame {
    position: relative;
    overflow: visible;
    width: 100%;
    border-radius: 18px;
    background: transparent;
    box-shadow: none;
    isolation: isolate;
}

.image-message-card .chat-media-frame,
.video-message-card .chat-media-frame {
    width: fit-content;
    max-width: 100%;
}

.video-message-card .chat-media-frame {
    width: 100%;
}

.image-message-card .chat-media-frame--reserved {
    width: fit-content;
    height: auto;
    max-width: 100%;
    aspect-ratio: auto;
    background: color-mix(in srgb, var(--zn-member-bg-card) 86%, var(--zn-member-bg-surface-faint));
}

.video-message-card .chat-media-frame--reserved {
    aspect-ratio: var(--chat-media-aspect-ratio, 16 / 9);
    max-height: min(58vh, 420px);
    overflow: hidden;
    background: color-mix(in srgb, var(--zn-member-bg-card) 86%, var(--zn-member-bg-surface-faint));
}

.chat-media-frame::before {
    content: "";
    position: absolute;
    inset: -14px;
    z-index: -1;
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 18%, rgba(150, 205, 255, 0.32), transparent 36%),
        radial-gradient(circle at 88% 82%, rgba(188, 143, 255, 0.24), transparent 40%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(120, 164, 255, 0.1));
    filter: blur(18px);
    opacity: 0.8;
    pointer-events: none;
}

.message-row.is-sent .chat-media-frame {
    box-shadow: none;
}

.message-row.is-sent .chat-media-frame::before {
    opacity: 0.92;
}

.video-message-card .chat-media-frame::before {
    content: none;
}

.attachment-card-footer,
.attachment-inline-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.attachment-card-footer {
    justify-content: flex-end;
}

.attachment-card-copy {
    min-width: 0;
    flex: 1;
}

.image-message-preview {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(58vh, 420px);
    object-fit: contain;
    border-radius: 16px;
    border: 0;
    background: transparent;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.3),
        0 18px 38px rgba(0, 0, 0, 0.13);
}

.chat-media-frame--reserved .image-message-preview {
    width: auto;
    height: auto;
    max-width: min(100%, 76vw, 560px);
    max-height: min(58vh, 420px);
}

.video-message-preview {
    display: block;
    width: 100%;
    height: 100%;
    max-height: min(58vh, 420px);
    object-fit: contain;
    border-radius: 16px;
    background: #111;
    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.12),
        0 2px 7px rgba(0, 0, 0, 0.08);
}

@media (max-width: 760px) {
    .video-message-card {
        width: min(82vw, 330px);
    }
}

.chat-media-image {
    vertical-align: middle;
}

.message-meta-over-media {
    position: absolute;
    right: 13px;
    bottom: 13px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(10, 12, 18, 0.48);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(12px);
}

.message-meta-over-media .message-time,
.message-meta-over-media .message-status {
    color: inherit;
}

.chat-media-uploading {
    opacity: 0.9;
}

.chat-file-uploading {
    overflow: hidden;
}

.chat-media-pending-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-content: center;
    gap: 8px;
    background: rgba(4, 7, 12, 0.28);
    color: white;
    text-align: center;
    backdrop-filter: blur(2px);
}

.chat-media-progress {
    width: 34px;
    height: 34px;
    margin: 0 auto;
    border: 3px solid rgba(255, 255, 255, 0.34);
    border-top-color: rgba(255, 255, 255, 0.96);
    border-radius: 999px;
    animation: chat-media-spin 900ms linear infinite;
}

.chat-media-upload-label {
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    font-size: 0.76rem;
    font-weight: 650;
}

.chat-media-upload-cancel {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: rgba(10, 12, 18, 0.46);
    color: white;
    cursor: pointer;
    backdrop-filter: blur(12px);
}

.chat-media-failure-actions {
    display: flex;
    gap: 6px;
    padding: 7px 2px 0;
}

.chat-media-failure-actions button {
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 54%, transparent);
    border-radius: 999px;
    background: var(--zn-member-bg-surface-active);
    color: var(--zn-member-text);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
}

.message-row[data-upload-state="failed"] .chat-media-pending-overlay {
    background: rgba(75, 12, 18, 0.42);
}

.message-row[data-upload-state="failed"] .chat-media-progress {
    display: none;
}

.upload-job-card {
    --upload-surface: var(--zn-member-bg-card);
    --upload-surface-strong: var(--zn-member-bg-surface, var(--zn-member-bg-card));
    --upload-overlay: color-mix(in srgb, var(--zn-member-bg-card) 24%, black);
    --upload-border: var(--zn-member-border);
    --upload-text: var(--zn-member-text-primary);
    --upload-text-muted: var(--zn-member-text-secondary);
    --upload-accent: var(--zn-member-accent);
    --upload-accent-soft: color-mix(in srgb, var(--zn-member-accent) 28%, transparent);
    --upload-danger: var(--zn-member-danger-text-soft);
    --upload-success: var(--zn-member-success-text, var(--zn-member-accent));
    --upload-on-overlay: var(--zn-member-accent-contrast, white);
    --upload-shadow: var(--zn-member-shadow-card, var(--zn-member-shadow));
    width: min(88vw, 430px);
    max-width: 100%;
    opacity: 1;
}

.upload-job-card .upload-job-frame {
    width: 100%;
    height: clamp(430px, 58vh, 590px);
    min-height: 430px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--upload-border) 76%, transparent);
    border-radius: 8px;
    background: var(--upload-surface);
    box-shadow: var(--upload-shadow);
}

.upload-job-preview,
.upload-job-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    background: var(--upload-surface);
    box-shadow: none;
}

.upload-job-poster[hidden],
.upload-job-preview[hidden] {
    display: none;
}

.chat-media-pending-overlay.upload-job-overlay {
    display: block;
    place-content: initial;
    padding: 0;
    background: color-mix(in srgb, var(--upload-overlay) 68%, transparent);
    color: var(--upload-on-overlay);
    text-align: initial;
    backdrop-filter: blur(2px);
}

.upload-job-content {
    position: relative;
    z-index: 1;
    display: grid;
    align-content: center;
    gap: 14px;
    width: 100%;
    min-height: 100%;
    padding: 24px 22px 20px;
}

.upload-job-ring {
    position: relative;
    width: 88px;
    height: 88px;
    margin-inline: auto;
}

.upload-job-ring svg {
    display: block;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.upload-job-ring-track,
.upload-job-ring-progress {
    fill: none;
    stroke-width: 4;
}

.upload-job-ring-track {
    stroke: color-mix(in srgb, var(--upload-on-overlay) 22%, transparent);
}

.upload-job-ring-progress {
    stroke: var(--upload-accent);
    stroke-linecap: round;
    stroke-dasharray: 100.53;
    stroke-dashoffset: calc(100.53 - (100.53 * var(--upload-progress-value, 8) / 100));
    transition: stroke-dashoffset 280ms ease;
}

.upload-job-ring-label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--upload-on-overlay);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
}

.upload-job-copy {
    min-width: 0;
    text-align: center;
}

.upload-job-copy h4,
.upload-job-copy p {
    margin: 0;
    color: var(--upload-on-overlay);
    letter-spacing: 0;
}

.upload-job-copy h4 {
    font-size: 1.12rem;
    font-weight: 780;
}

.upload-job-copy p {
    margin-top: 4px;
    color: color-mix(in srgb, var(--upload-on-overlay) 76%, transparent);
    font-size: 0.78rem;
    line-height: 1.35;
}

.upload-job-progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--upload-on-overlay) 22%, transparent);
}

.upload-job-progress-value {
    display: block;
    width: var(--upload-progress, 8%);
    height: 100%;
    border-radius: inherit;
    background: var(--upload-accent);
    transition: width 280ms ease;
}

.upload-job-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.upload-job-steps li {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: color-mix(in srgb, var(--upload-on-overlay) 48%, transparent);
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.upload-job-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: calc(100% + 3px);
    width: 8px;
    height: 1px;
    background: color-mix(in srgb, var(--upload-on-overlay) 32%, transparent);
}

.upload-job-step-status {
    display: block;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-radius: 999px;
}

.upload-job-steps li.is-active {
    color: var(--upload-on-overlay);
}

.upload-job-steps li.is-active .upload-job-step-status {
    border-color: color-mix(in srgb, var(--upload-on-overlay) 38%, transparent);
    border-top-color: var(--upload-accent);
    animation: chat-media-spin 900ms linear infinite;
}

.upload-job-steps li.is-complete {
    color: var(--upload-success);
}

.upload-job-steps li.is-complete .upload-job-step-status {
    display: grid;
    place-items: center;
    border-color: var(--upload-success);
    background: var(--upload-success);
    color: var(--upload-surface-strong);
}

.upload-job-steps li.is-complete .upload-job-step-status::before {
    content: "\2713";
    font-size: 0.65rem;
    font-weight: 900;
    line-height: 1;
}

.upload-job-actions {
    display: flex;
    justify-content: center;
}

.upload-job-cancel-action {
    min-width: 116px;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid color-mix(in srgb, var(--upload-danger) 72%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--upload-danger) 32%, var(--upload-overlay));
    color: var(--upload-on-overlay);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 760;
    cursor: pointer;
}

.upload-job-cancel-action:disabled {
    cursor: wait;
    opacity: 0.56;
}

.upload-job-file {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--upload-border) 48%, transparent);
    border-radius: 7px;
    background: color-mix(in srgb, var(--upload-surface-strong) 88%, transparent);
    color: var(--upload-text);
}

.upload-job-file-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 7px;
    background: var(--upload-accent-soft);
    color: var(--upload-accent);
}

.upload-job-file-icon svg {
    width: 21px;
    height: 21px;
}

.upload-job-file-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

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

.upload-job-file-copy strong {
    color: var(--upload-text);
    font-size: 0.8rem;
}

.upload-job-file-copy span {
    color: var(--upload-text-muted);
    font-size: 0.7rem;
}

.chat-media-upload-cancel.upload-job-close {
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: 1px solid color-mix(in srgb, var(--upload-on-overlay) 18%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--upload-overlay) 82%, transparent);
    color: var(--upload-on-overlay);
    font-size: 1.3rem;
    line-height: 1;
}

.message-row.is-optimistic-upload[data-upload-kind="video"] .message-bubble.has-video-message {
    width: min(88vw, 430px);
    max-width: min(88vw, 430px);
}

.message-row.is-optimistic-upload[data-upload-kind="video"] .message-meta {
    color: var(--zn-member-text-muted);
}

@media (max-width: 760px) {
    .upload-job-card,
    .message-row.is-optimistic-upload[data-upload-kind="video"] .message-bubble.has-video-message {
        width: min(90vw, 390px);
        max-width: min(90vw, 390px);
    }

    .upload-job-card .upload-job-frame {
        height: min(60dvh, 540px);
        min-height: 455px;
    }

    .upload-job-content {
        gap: 12px;
        padding: 20px 16px 16px;
    }

    .upload-job-ring {
        width: 76px;
        height: 76px;
    }

    .upload-job-steps {
        gap: 8px;
    }

    .upload-job-steps li {
        gap: 5px;
        font-size: 0.66rem;
    }
}

@keyframes chat-media-spin {
    to {
        transform: rotate(360deg);
    }
}

.image-message-name,
.image-message-meta,
.audio-message-name,
.audio-message-meta,
.file-message-name,
.file-message-meta {
    margin: 0;
}

.image-message-name,
.audio-message-name,
.file-message-name {
    font-size: 0.86rem;
    font-weight: 560;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.image-message-meta,
.audio-message-meta,
.file-message-meta {
    font-size: 0.74rem;
    color: var(--zn-member-text-muted);
    overflow-wrap: anywhere;
}

.audio-message-player {
    display: none;
}

.audio-message-control {
    --audio-progress: 0%;
    display: grid;
    grid-template-columns: 32px minmax(108px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 6px 9px 6px 6px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 24%, transparent);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.006)),
        color-mix(in srgb, var(--zn-member-bg-surface-active) 48%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.028);
}

.message-row.is-sent .audio-message-control {
    border-color: color-mix(in srgb, var(--zn-member-accent-border) 30%, transparent);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.01)),
        color-mix(in srgb, var(--zn-member-primary) 16%, rgba(7, 11, 19, 0.52));
}

.audio-message-play {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--zn-member-accent) 84%, white 4%);
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--zn-member-accent) 22%, transparent);
}

.audio-message-play:hover {
    background: color-mix(in srgb, var(--zn-member-accent) 92%, white 6%);
}

.audio-message-play svg {
    width: 16px;
    height: 16px;
}

.audio-message-pause-icon,
.audio-message-card.is-playing .audio-message-play-icon {
    display: none;
}

.audio-message-card.is-playing .audio-message-pause-icon {
    display: block;
}

.audio-message-waveform {
    position: relative;
    display: grid;
    grid-template-columns: repeat(32, minmax(1px, 1fr));
    align-items: center;
    gap: 2px;
    min-width: 0;
    height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
    color: color-mix(in srgb, var(--zn-member-text-muted) 52%, transparent);
    cursor: pointer;
}

.audio-message-waveform span {
    display: block;
    height: var(--bar-height);
    min-height: 4px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.78;
    transition: background 140ms ease, opacity 140ms ease;
}

.audio-message-waveform span.is-played {
    background: color-mix(in srgb, var(--zn-member-accent-text) 88%, white 4%);
    opacity: 1;
}

.audio-message-duration {
    color: var(--zn-member-text-secondary);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.attachment-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid color-mix(in srgb, var(--zn-member-border-bright) 70%, transparent);
    border-radius: 8px;
    background: var(--zn-member-bg-surface-active);
    color: var(--zn-member-text);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    cursor: pointer;
}

.attachment-file-icon:disabled {
    cursor: default;
    opacity: 0.72;
}

.attachment-action-menu {
    position: relative;
    margin-left: auto;
    flex: 0 0 auto;
}

.attachment-action-menu summary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: var(--zn-member-text-muted);
    cursor: pointer;
    list-style: none;
    font-size: 1rem;
    line-height: 1;
}

.attachment-action-menu summary::-webkit-details-marker {
    display: none;
}

.attachment-action-menu summary:hover,
.attachment-action-menu[open] summary {
    background: var(--zn-member-bg-surface-active);
    color: var(--zn-member-text);
}

.attachment-action-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    display: grid;
    min-width: 132px;
    padding: 5px;
    border: 1px solid var(--zn-member-border-bright);
    border-radius: 8px;
    background: var(--zn-member-bg-pane, var(--zn-member-bg-panel));
    box-shadow: 0 16px 36px var(--zn-member-shadow);
}

.attachment-action {
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--zn-member-text);
    font: inherit;
    font-size: 0.82rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.attachment-action:hover {
    background: var(--zn-member-bg-surface-active);
}

.attachment-action.is-danger {
    color: var(--zn-member-danger-text-soft);
}

.media-message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.message-delete-form {
    margin: 0;
}

.message-delete-button {
    padding: 6px 10px;
    border: 1px solid var(--zn-danger-border);
    border-radius: 10px;
    background: var(--zn-danger-soft);
    color: var(--zn-member-danger-text-soft);
    cursor: pointer;
}

.message-delete-button:hover {
    background: var(--zn-danger-soft-strong);
}

.file-message-link {
    align-self: flex-start;
    font-size: 0.82rem;
    color: var(--zn-member-text-link);
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--zn-member-border-bright);
    background: var(--zn-member-bg-surface-active);
}

.attachment-viewer {
    position: fixed;
    inset: 0;
    z-index: var(--z-layer-modal, 1600);
    display: grid;
    place-items: center;
    padding: 22px;
}

.attachment-viewer[hidden] {
    display: none;
}

.attachment-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--zn-member-bg-app, #0b1018) 58%, rgba(0, 0, 0, 0.46));
    backdrop-filter: blur(10px);
}

.attachment-viewer-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(96vw, 1040px);
    max-height: 92vh;
    border: 1px solid color-mix(in srgb, var(--zn-member-border) 54%, transparent);
    border-radius: 8px;
    background: var(--zn-member-bg-app, #0b1018);
    box-shadow: 0 24px 80px color-mix(in srgb, var(--zn-member-shadow) 75%, transparent);
    overflow: hidden;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-panel,
.attachment-viewer[data-viewer-kind="video"] .attachment-viewer-panel,
.attachment-viewer[data-viewer-kind="audio"] .attachment-viewer-panel {
    width: fit-content;
    min-width: min(92vw, 280px);
    max-width: 96vw;
    background: color-mix(in srgb, var(--zn-member-bg-panel) 76%, transparent);
}

.attachment-viewer[data-viewer-kind="image"] {
    padding:
        max(14px, env(safe-area-inset-top))
        max(14px, env(safe-area-inset-right))
        max(14px, env(safe-area-inset-bottom))
        max(14px, env(safe-area-inset-left));
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-backdrop {
    background: rgba(2, 4, 9, 0.82);
    backdrop-filter: blur(14px);
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-panel {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    max-height: 100dvh;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-header {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: max(12px, env(safe-area-inset-left));
    z-index: 2;
    border: 0;
    color: white;
    pointer-events: none;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-header strong {
    opacity: 0;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-actions {
    margin-left: auto;
    pointer-events: auto;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-download,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-share,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-save-workspace,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-delete,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-close {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(16px);
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-delete {
    border-color: rgba(255, 126, 112, 0.52);
    background: rgba(150, 38, 34, 0.34);
    color: #ff8a78;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-download:hover,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-share:hover,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-save-workspace:hover,
.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-close:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.46);
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-delete:hover {
    background: rgba(174, 46, 40, 0.44);
    border-color: rgba(255, 140, 128, 0.66);
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-body,
.attachment-viewer[data-viewer-kind="video"] .attachment-viewer-body {
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-body {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100dvh;
}

.attachment-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--zn-member-border) 52%, transparent);
}

.attachment-viewer-header strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 600;
}

.attachment-viewer-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.attachment-viewer-download,
.attachment-viewer-share,
.attachment-viewer-save-workspace,
.attachment-viewer-delete,
.attachment-viewer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--zn-attachment-viewer-control-border);
    border-radius: 8px;
    background: var(--zn-attachment-viewer-control-background);
    color: var(--zn-attachment-viewer-control-text);
    font-size: 0.82rem;
    text-decoration: none;
    cursor: pointer;
}

.attachment-viewer-download:hover,
.attachment-viewer-share:hover,
.attachment-viewer-save-workspace:hover,
.attachment-viewer-close:hover {
    border-color: var(--zn-attachment-viewer-control-hover-border);
    background: var(--zn-attachment-viewer-control-hover-background);
    color: var(--zn-attachment-viewer-control-hover-text);
}

.attachment-viewer-download svg,
.attachment-viewer-share svg,
.attachment-viewer-save-workspace svg,
.attachment-viewer-delete svg,
.attachment-viewer-close svg {
    width: 18px;
    height: 18px;
}

.attachment-viewer-delete-form {
    margin: 0;
}

.attachment-viewer-delete {
    color: var(--zn-member-danger-text-soft);
}

.attachment-viewer-close {
    width: 40px;
    padding: 0;
}

.attachment-action-row {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.attachment-action-success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid color-mix(in srgb, var(--zn-success, #33c27f) 38%, var(--zn-member-border));
    border-radius: 8px;
    background:
        linear-gradient(color-mix(in srgb, var(--zn-success-soft, #33c27f) 26%, transparent), color-mix(in srgb, var(--zn-success-soft, #33c27f) 26%, transparent)),
        var(--zn-member-bg-card);
    color: var(--zn-member-text-primary);
    font-size: 1rem;
    font-weight: 700;
}

.attachment-action-success[hidden] {
    display: none;
}

.attachment-action-success svg {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    color: var(--zn-success, #33c27f);
}

.attachment-action-field {
    display: grid;
    gap: 6px;
}

.attachment-action-field > span {
    color: var(--zn-member-text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.attachment-action-select {
    width: 100%;
    min-height: 44px;
    border-color: var(--zn-member-border-bright);
    color: var(--zn-member-text-primary);
    background:
        linear-gradient(var(--zn-member-bg-surface-active), var(--zn-member-bg-surface-active)),
        var(--zn-member-bg-card);
}

.attachment-action-select[multiple] {
    min-height: 178px;
}

.attachment-action-select option {
    padding: 8px;
    color: var(--zn-member-text-primary);
    background:
        linear-gradient(var(--zn-member-bg-card), var(--zn-member-bg-card)),
        var(--zn-member-bg-app, #0b111a);
}

.attachment-action-choice-list {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow: auto;
    padding-right: 2px;
}

.attachment-action-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 0;
    padding: 10px;
    border: 1px solid var(--zn-member-border);
    border-radius: 8px;
    background: var(--zn-member-bg-card);
    color: var(--zn-member-text-primary);
    overflow: hidden;
}

.attachment-action-choice:has(input:checked) {
    border-color: var(--zn-member-accent-border-muted);
    background: color-mix(in srgb, var(--zn-member-accent-surface) 18%, var(--zn-member-bg-card));
}

.attachment-action-choice input {
    flex: 0 0 auto;
    margin-top: 3px;
    accent-color: var(--zn-member-accent);
}

.attachment-action-choice span {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}

.attachment-action-choice strong,
.attachment-action-choice small {
    display: block;
}

.attachment-action-choice strong {
    max-width: 100%;
    color: var(--zn-member-text-primary);
    font-size: 0.88rem;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.attachment-action-choice small {
    margin-top: 2px;
    max-width: 100%;
    color: var(--zn-member-text-secondary);
    font-size: 0.72rem;
    line-height: 1.18;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 760px) {
    .attachment-action-choice-list {
        max-height: min(330px, 46dvh);
    }

    .attachment-action-choice {
        align-items: flex-start;
        min-height: 0;
        padding: 10px;
    }

    .attachment-action-choice input {
        flex: 0 0 auto;
        margin-top: 4px;
    }

    .attachment-action-choice span {
        flex: 1 1 auto;
    }

    .attachment-action-choice strong {
        font-size: 0.88rem;
        line-height: 1.18;
    }

    .attachment-action-choice small {
        font-size: 0.7rem;
        line-height: 1.2;
    }
}

.attachment-viewer-body {
    min-height: 220px;
    overflow: auto;
    padding: 12px;
}

.attachment-viewer-image,
.attachment-viewer-video {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 86px);
    margin: 0 auto;
    border-radius: 6px;
}

.attachment-viewer[data-viewer-kind="image"] .attachment-viewer-image {
    max-width: calc(100vw - 28px - env(safe-area-inset-left) - env(safe-area-inset-right));
    max-height: calc(100dvh - 28px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
}

.attachment-viewer-frame {
    width: 100%;
    height: calc(92vh - 94px);
    min-height: calc(92vh - 94px);
    border: 0;
    border-radius: 6px;
    background: white;
}

.attachment-viewer-pdf-pages {
    width: min(100%, 1120px);
    margin: 0 auto;
    display: grid;
    gap: 14px;
}

.attachment-viewer-pdf-page {
    margin: 0;
}

.attachment-viewer-pdf-page img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}

.attachment-viewer-audio {
    width: min(100%, 620px);
    margin: 60px auto;
}

.attachment-viewer-text {
    min-height: calc(92vh - 118px);
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 0.84rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--zn-member-text);
}

.attachment-viewer-text.is-csv {
    white-space: pre;
}

.attachment-viewer-fallback {
    min-height: calc(64vh - 88px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 22px;
    border: 1px dashed color-mix(in srgb, var(--zn-member-border) 72%, transparent);
    border-radius: 8px;
    background: var(--zn-member-bg-surface);
    color: var(--zn-member-text);
    text-align: center;
}

.attachment-viewer-fallback strong {
    font-size: 1rem;
}

.attachment-viewer-fallback p {
    max-width: 32rem;
    margin: 0;
    color: var(--zn-member-text-muted);
    font-size: 0.86rem;
    line-height: 1.45;
}

.attachment-viewer-fallback-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.attachment-viewer-fallback-action {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 1px solid var(--zn-member-border-bright);
    border-radius: 8px;
    background: var(--zn-member-bg-surface-active);
    color: var(--zn-member-text);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
}

.file-message-link.is-disabled {
    color: var(--zn-member-text-muted);
    background: var(--zn-member-bg-surface-faint);
    pointer-events: none;
    opacity: 0.72;
}
