.attachment-card { display:grid; gap:0; width:min(320px, 58vw); max-width:100%; margin:5px 0 0; }
.attachment-preview { display:grid; position:relative; width:100%; aspect-ratio:4/3; padding:0; border:0; border-radius:12px; overflow:hidden; background:#00000016; cursor:zoom-in; color:inherit; isolation:isolate; }
.attachment-preview img { width:100%; height:100%; object-fit:cover; display:block; opacity:0; transition:opacity .18s; }
.attachment-card.is-ready .attachment-preview img { opacity:1; }
.attachment-status { position:absolute; inset:0; display:grid; place-items:center; padding:24px; font-size:12px; text-align:center; line-height:1.6; }
.is-ready .attachment-status { display:none; }
.attachment-expand { position:absolute; bottom:10px; right:10px; display:grid; place-items:center; width:30px; height:30px; background:#1616169c; color:#fff; border-radius:9px; opacity:0; transition:opacity .16s; }
.attachment-preview:hover .attachment-expand, .attachment-preview:focus-visible .attachment-expand { opacity:1; }
.attachment-info { display:flex; gap:10px; align-items:center; padding:9px 0 2px; }
.attachment-label { display:grid; flex:1; gap:3px; min-width:0; }
.attachment-name { font-size:12px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-weight:550; }
.attachment-size { font-size:10px; opacity:.65; }
.attachment-download { display:grid; place-items:center; width:35px; height:35px; border:1px solid #ffffff22; border-radius:10px; color:inherit; background:#ffffff08; cursor:pointer; }
.mine .attachment-download { border-color:#26262625; background:#26262608; }
.attachment-download:hover { background:#ffffff20; }
.attachment-download:disabled { opacity:.3; cursor:default; }
.attachment-card svg, .image-viewer svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.attachment-preview:focus-visible, .attachment-download:focus-visible, .image-viewer button:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.mine .attachment-preview:focus-visible, .mine .attachment-download:focus-visible { outline-color:#262626; }
.composer { grid-template-columns:40px minmax(0,1fr) 46px; }
#pick-file { height:47px; width:40px; margin-bottom:1px; }
.attached-files { grid-column:1/-1; order:-1; display:flex; gap:10px; overflow-x:auto; padding:4px 2px 7px; min-width:0; }
.attached-files:empty { display:none; }
.draft-image { width:84px; flex-shrink:0; position:relative; border-radius:12px; }
.draft-image > img { width:84px; height:76px; display:block; object-fit:cover; border-radius:12px; border:1px solid #ffffff20; }
.draft-image-name { display:block; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:10px; color:var(--muted); padding-top:5px; }
.draft-image-remove { position:absolute; top:3px; right:3px; display:grid; place-items:center; width:25px; height:25px; font-size:21px; line-height:1; color:white; background:#171717c9; border:1px solid #ffffff30; border-radius:50%; cursor:pointer; }
.draft-image-remove:disabled { opacity:.4; cursor:default; }
.draft-image-loading { position:absolute; top:0; height:76px; inset-inline:0; display:grid; align-items:end; padding:7px 4px; background:linear-gradient(transparent,#000b); color:white; border-radius:12px; font-size:10px; text-align:center; pointer-events:none; }
.viewing-image { overflow:hidden; }
dialog.image-viewer { position:fixed; inset:0; width:100%; height:100%; width:100dvw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; border-radius:0; background:#141414f7; color:#f4f3ed; overflow:hidden; box-shadow:none; }
.image-viewer[open] { display:grid; grid-template-rows:auto minmax(0,1fr); }
.image-viewer::backdrop { background:#141414; backdrop-filter:none; }
.image-viewer-header { display:flex; gap:20px; align-items:center; justify-content:space-between; padding:18px max(20px,env(safe-area-inset-right)) 18px max(24px,env(safe-area-inset-left)); border-bottom:1px solid #ffffff10; background:#1d1d1d; z-index:2; }
.image-viewer-label { min-width:0; display:grid; gap:5px; }
.image-viewer-label strong { font-weight:550; font-size:14px; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.image-viewer-label > span { font-size:11px; color:#a7a79d; }
.image-viewer-actions { display:flex; gap:8px; flex-shrink:0; }
.image-viewer button { display:grid; place-items:center; color:inherit; background:#ffffff0b; border:1px solid #ffffff14; border-radius:12px; cursor:pointer; padding:0; width:42px; height:42px; transition:background .15s; }
.image-viewer button:hover { background:#ffffff20; }
.image-viewer button:disabled { opacity:.35; cursor:default; }
.image-viewer-stage { display:grid; place-items:center; position:relative; overflow:auto; padding:24px 70px max(24px,env(safe-area-inset-bottom)); min-height:0; min-width:0; }
.image-viewer-stage > img { display:block; max-width:100%; max-height:100%; min-height:0; object-fit:contain; border-radius:3px; user-select:none; -webkit-user-drag:none; }
.image-viewer-stage > img:not([src]) { display:none; }
.image-viewer-status { position:absolute; text-align:center; font-size:13px; color:#c8c8b9; max-width:300px; padding:20px; }
.image-viewer-status:empty { display:none; }
.image-viewer.is-zoomed .image-viewer-stage { display:block; padding:24px; }
.image-viewer.is-zoomed .image-viewer-stage > img { max-width:none; max-height:none; width:auto; height:auto; margin:auto; cursor:zoom-out; }
.image-viewer .image-viewer-prev, .image-viewer .image-viewer-next { position:absolute; top:calc(50% + 35px); background:#262626cc; width:44px; height:52px; z-index:1; }
.image-viewer-prev { left:16px; } .image-viewer-next { right:16px; }
@media (max-width:600px) {
  .image-viewer-header { padding:12px; gap:8px; }
  .image-viewer-label strong { font-size:12px; }
  .image-viewer-actions { gap:5px; }
  .image-viewer-actions button { width:36px; height:38px; border-radius:10px; }
  .image-viewer-stage { padding:14px 12px 68px; }
  .image-viewer .image-viewer-prev, .image-viewer .image-viewer-next { top:auto; bottom:max(12px,env(safe-area-inset-bottom)); height:38px; width:44px; }
  .image-viewer-prev { left:calc(50% - 52px); } .image-viewer-next { right:calc(50% - 52px); }
  .attachment-expand { opacity:1; }
}
@media (prefers-reduced-motion:reduce) { .attachment-preview img, .attachment-expand, .image-viewer button { transition:none; } }
.processing-link { border:0; background:transparent; color:inherit; text-decoration:underline; font:inherit; font-size:11px; cursor:pointer; padding:8px 3px; }
.processing-panel { width:min(900px,94vw); max-height:90dvh; padding:0; border:1px solid #ffffff25; border-radius:20px; background:#262626; color:#f4f3ed; }
.processing-panel::backdrop { background:#000a; }
.processing-panel section { padding:24px; }
.processing-panel header,.processing-summary { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.processing-panel header { margin-bottom:24px; }
.processing-panel h2 { margin:0; font-size:21px; }
.processing-panel h3 { font-size:14px; margin-top:26px; }
.processing-panel button,.processing-results a { background:#ffffff0b; color:inherit; border:1px solid #ffffff25; border-radius:8px; padding:8px 12px; cursor:pointer; }
.processing-summary strong { overflow-wrap:anywhere; }
.processing-badge { color:#ffe135; white-space:nowrap; }
.processing-steps { display:flex; padding:0; list-style:none; gap:8px; margin:24px 0; }
.processing-steps li { flex:1; border-top:3px solid #ffffff20; padding-top:10px; font-size:12px; color:#aaa; }
.processing-steps .reached { border-color:#ffe135; color:#ffe135; }
.processing-history { padding-left:20px; color:#c3c3b8; font-size:12px; line-height:2; }
.processing-results { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.processing-results article { background:#ffffff05; border:1px solid #ffffff15; border-radius:12px; padding:14px; }
.processing-results img { display:block; width:100%; height:150px; object-fit:contain; margin-bottom:12px; background:#151515; border-radius:6px; }
.processing-results p { font-size:12px; color:#c3c3b8; }
.processing-results a { display:inline-block; text-decoration:none; font-size:12px; margin:4px 8px 0 0; }
.processing-error { color:#ffaaa0; }
@media(max-width:550px) { .processing-panel section {padding:16px;} .processing-results {grid-template-columns:1fr;} .processing-panel h2 {font-size:17px;} }
@media(prefers-reduced-motion:no-preference) {
  dialog.image-viewer[open] {animation:image-viewer-enter .2s ease-out;}
  .image-viewer-stage > img[src] {animation:image-content-enter .2s ease-out;}
  .image-viewer-actions button {transition:background .18s ease,transform .18s ease;}
  .image-viewer-actions button:active {transform:scale(.95);}
}
@keyframes image-viewer-enter {from{opacity:0}to{opacity:1}}
@keyframes image-content-enter {from{opacity:0;transform:scale(.985)}to{opacity:1;transform:scale(1)}}
