.message-file[data-attachment-id],.file-item[data-attachment-id]{cursor:pointer}
.message-file.attachment-image{display:flex;flex-direction:column;align-items:flex-start;max-width:min(340px,100%);overflow:hidden}
.message-file.attachment-image .file-thumb{width:auto;height:auto;max-width:100%;background:transparent}
.message-file.attachment-image .file-thumb img{display:block;max-width:100%;max-height:260px;width:auto;height:auto;object-fit:contain;border-radius:8px}
.file-item .file-thumb img[data-cache-image]{width:100%;height:100%;object-fit:cover}
.attachment-viewer{width:min(860px,calc(100vw - 24px));max-height:calc(100dvh - 28px);padding:20px;border:1px solid var(--line);border-radius:16px;color:var(--text);background:var(--panel);overflow:auto}
.attachment-viewer::backdrop{background:#0009}
.attachment-viewer header{display:flex;align-items:center;gap:12px}.attachment-viewer h2{flex:1;min-width:0;font-size:17px;overflow-wrap:anywhere}
.attachment-viewer button{min-height:40px;border:1px solid var(--line);border-radius:8px;background:var(--accent-soft);color:var(--text);padding:8px 12px;cursor:pointer}
.attachment-viewer header button{font-size:22px}.attachment-viewer-image{display:block;max-width:100%;max-height:60dvh;width:auto;height:auto;object-fit:contain;margin:16px auto}
.attachment-viewer footer{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.attachment-viewer-status,.attachment-viewer-note{font-size:12px;line-height:1.65;color:var(--muted)}
.preview-chip .preview-image{width:44px;height:36px;object-fit:cover;border-radius:4px;flex:0 0 auto}.preview-file-name{min-width:0;overflow-wrap:anywhere}
@media(max-width:720px){.attachment-viewer{padding:14px}.message-file.attachment-image{max-width:100%}}
