.portal-gallery{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:9px;max-width:700px;margin:14px 0}.portal-image{display:block;min-width:0;max-width:100%;background:#edf3f5;border:1px solid #d8e4e8;border-radius:9px;overflow:hidden;cursor:zoom-in}.portal-image img{display:block;width:100%;height:190px;object-fit:contain}.msg .portal-gallery{max-width:360px}.msg .portal-image img{height:180px}.image-picker{margin:12px 0;padding:12px;border:1px dashed #afcad4;border-radius:9px;background:#f6fafb;color:#123342}.image-picker input{display:block;width:100%;font:14px system-ui;margin:8px 0}.image-help,.image-upload-status{font:14px/1.6 system-ui;color:#637b88;margin:7px 0}.image-previews{display:grid;grid-template-columns:repeat(auto-fill,minmax(100px,1fr));gap:9px}.image-preview{min-width:0;background:white;border:1px solid #d8e4e8;border-radius:7px;padding:6px;overflow-wrap:anywhere;font:14px/1.5 system-ui}.image-preview img{display:block;width:100%;height:90px;object-fit:contain}.image-preview span{display:block}.image-preview button{font:14px/1.5 system-ui;padding:5px 8px;margin-top:5px;min-height:32px}#portal-image-viewer{padding:12px;border:0;border-radius:12px;background:#f7fafb;width:min(96vw,1400px);max-width:96vw;height:94dvh;max-height:94dvh;color:#123342}#portal-image-viewer::backdrop{background:#08212ccc}.image-viewer-tools{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:5px 7px 12px;font:16px system-ui}.image-viewer-tools a{color:#086b83}.image-viewer-tools button{font:inherit;padding:8px 12px;border:1px solid #bfd3db;border-radius:7px;cursor:pointer}.image-viewer-content{height:calc(100% - 56px);overflow:auto;display:grid;place-items:start center}.image-viewer-content img{max-width:100%;height:auto;object-fit:contain}.chat-image-picker{grid-column:1/-1;min-width:0}.chat-image-picker .image-picker{margin:0}.chat-image-picker .image-select{font:14px/1.4 system-ui}.chat-image-picker .image-help{display:none}.chat-image-picker .image-preview img{height:60px}@media(max-width:650px){.portal-gallery{grid-template-columns:repeat(2,minmax(0,1fr))}.portal-image img{height:150px}.image-viewer-tools{font-size:14px}.chat-image-picker .image-previews{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* Keep single-avatar previews and upload errors readable on phones. */
#avatar-picker .image-previews{grid-template-columns:minmax(0,1fr)}#avatar-picker .image-preview{display:grid;grid-template-columns:minmax(0,1fr);gap:6px}#avatar-picker .image-preview img{height:150px}#avatar-picker .image-preview button{justify-self:start}#avatar-picker input{box-sizing:border-box;max-width:100%;min-width:0}
