.attachment-viewer[hidden] { display: none !important; }
.attachment-viewer { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 24px; background: rgba(24,25,22,.48); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.attachment-viewer-open { overflow: hidden; }
.attachment-viewer-panel { width: min(1160px,100%); height: min(850px,calc(100vh - 48px)); height: min(850px,calc(100dvh - 48px)); display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; background: rgba(255,255,255,.96); border-radius: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.2); }
.attachment-viewer-panel header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid #e9e9e6; }
.attachment-viewer-panel header div { display: grid; min-width: 0; }
.attachment-viewer-panel header strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-viewer-panel header small { color: #757671; }
.attachment-viewer-panel button { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 1px solid #e1e1de; border-radius: 50%; background: #fff; color: #222; cursor: pointer; font: inherit; font-size: 30px; line-height: 1; }
.attachment-viewer-panel button:hover { background: #f5f5f3; }
.attachment-viewer-panel button img { width: 20px; height: 20px; }
.attachment-viewer-stage { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 16px; background: rgba(245,245,243,.76); }
.attachment-viewer-stage [hidden] { display: none !important; }
.attachment-viewer-stage img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.attachment-viewer-stage iframe { width: 100%; height: 100%; min-width: 0; min-height: 0; border: 0; background: #fff; }
.attachment-viewer-loading { display: inline-flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 999px; background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.08); color: #444; font-size: 14px; }
.attachment-viewer-spinner { width: 20px; height: 20px; border: 2px solid #d9dad4; border-top-color: #566044; border-radius: 50%; animation: attachment-spin .8s linear infinite; }
@keyframes attachment-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .attachment-viewer-spinner { animation-duration: 2s; } }
.attachment-viewer-panel footer { min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 22px; }
.attachment-viewer-panel footer button[hidden] { display: none; }
.attachment-viewer-panel footer [data-attachment-next] img { transform: rotate(180deg); }
.form-grid input[type="file"]:not(.drop-zone input):not(.upload-drop input), .modal-card input[type="file"]:not(.drop-zone input) { max-width: 100%; padding: 10px; border: 1px solid #dededb; border-radius: 12px; background: #fff; color: #222; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 9px 14px; border: 1px solid #dededb; border-radius: 999px; background: #f4f4f2; color: #222; font: inherit; cursor: pointer; }
.attachment-upload-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.attachment-upload-list:empty { display: none; }
.attachment-upload-item { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; padding: 5px 6px 5px 12px; border-radius: 999px; background: #f3f3f1; font-size: 13px; }
.attachment-upload-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-upload-item button { flex: none; width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; cursor: pointer; font-size: 18px; line-height: 1; }
.attachment-upload-error { width: 100%; color: #b4233f; font-size: 13px; }
@media (max-width: 640px) { .attachment-viewer { padding: 10px; } .attachment-viewer-panel { height: calc(100dvh - 20px); border-radius: 18px; } .attachment-viewer-stage { padding: 8px; } .attachment-viewer-panel header { padding: 12px 16px; } }
