.attachment-section{display:grid;gap:12px}
.attachment-gallery{display:flex;flex-wrap:wrap;gap:12px}
.attachment-thumb{display:grid;gap:7px;width:112px;padding:0;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
.attachment-thumb-image{position:relative;display:block;width:112px;aspect-ratio:1;overflow:hidden;border:1px solid rgba(128,145,152,.28);border-radius:12px;background:#eef2f3}
.attachment-thumb-image::after{position:absolute;right:7px;bottom:7px;width:28px;height:28px;border-radius:50%;background:rgba(16,30,35,.74);color:#fff;font-size:18px;line-height:28px;text-align:center;content:"+"}
.attachment-thumb img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .18s ease}
.attachment-thumb-name{display:block;overflow:hidden;color:inherit;font-size:12px;font-weight:650;line-height:1.35;text-overflow:ellipsis;white-space:nowrap}
.attachment-thumb:hover img{transform:scale(1.04)}
.attachment-thumb:focus-visible{outline:3px solid rgba(0,175,201,.45);outline-offset:4px;border-radius:12px}
.attachment-files{display:grid;gap:8px;margin:0;padding:0;list-style:none}
.attachment-file{display:flex;align-items:center;justify-content:space-between;gap:12px;min-width:0;padding:10px 12px;border:1px solid rgba(128,145,152,.22);border-radius:10px;background:rgba(128,145,152,.06)}
.attachment-file-info{display:flex;align-items:center;gap:8px;min-width:0}
.attachment-file-info svg{flex:none;width:16px;height:16px}
.attachment-file-name{min-width:0;overflow-wrap:anywhere;font-weight:700}
.attachment-file-size{flex:none;color:#839096;font-size:12px;font-weight:500}
.attachment-file-download{flex:none}

.attachment-modal[hidden]{display:none}
.attachment-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:24px;background:rgba(5,12,16,.88)}
.attachment-modal-panel{position:relative;display:grid;grid-template-columns:52px minmax(0,1fr) 52px;grid-template-rows:minmax(0,1fr) auto;align-items:center;width:min(1120px,100%);height:min(86vh,860px);outline:0}
.attachment-modal-stage{display:grid;place-items:center;grid-column:2;grid-row:1;min-width:0;min-height:0;height:100%}
.attachment-modal-image{display:block;max-width:100%;max-height:100%;object-fit:contain;box-shadow:0 12px 45px rgba(0,0,0,.35)}
.attachment-modal-close,.attachment-modal-nav{display:grid;place-items:center;border:0;border-radius:50%;background:rgba(255,255,255,.14);color:#fff;cursor:pointer;transition:background .15s ease}
.attachment-modal-close:hover,.attachment-modal-nav:hover{background:rgba(255,255,255,.28)}
.attachment-modal-close:focus-visible,.attachment-modal-nav:focus-visible,.attachment-modal-download:focus-visible{outline:3px solid #54d7ea;outline-offset:3px}
.attachment-modal-close{position:absolute;z-index:2;top:-12px;right:0;width:44px;height:44px;font-size:28px;line-height:1}
.attachment-modal-nav{width:44px;height:44px;font-size:34px;line-height:1}
.attachment-modal-prev{grid-column:1;grid-row:1}
.attachment-modal-next{grid-column:3;grid-row:1;justify-self:end}
.attachment-modal-nav[hidden]{display:none}
.attachment-modal-caption{display:flex;align-items:center;justify-content:center;gap:14px;grid-column:1 / -1;grid-row:2;min-width:0;padding-top:16px;color:#fff;font-size:14px}
.attachment-modal-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.attachment-modal-count{flex:none;color:rgba(255,255,255,.65)}
.attachment-modal-download{flex:none;padding:7px 11px;border:1px solid rgba(255,255,255,.42);border-radius:8px;color:#fff;font-size:13px;font-weight:700;text-decoration:none}
.attachment-modal-download:hover{background:rgba(255,255,255,.12);color:#fff}
body.attachment-modal-open{overflow:hidden}

@media (max-width:640px){
  .attachment-thumb{width:92px}
  .attachment-thumb-image{width:92px}
  .attachment-modal{padding:14px}
  .attachment-modal-panel{grid-template-columns:44px minmax(0,1fr) 44px;height:88vh}
  .attachment-modal-close{top:0;right:0}
  .attachment-modal-nav{width:38px;height:38px}
  .attachment-modal-caption{flex-wrap:wrap;gap:8px 12px;padding-top:10px}
  .attachment-modal-name{max-width:calc(100vw - 130px)}
}

@media (prefers-reduced-motion:reduce){.attachment-thumb img{transition:none}}
