.ian-attachment-grid { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 0; }
.ian-attachment-tile { width: 200px; max-width: calc(50% - 8px); }
.ian-attachment-section { clear: both; width: 100%; margin: 8px 0 20px; }
.ian-attachment-section > summary { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; box-sizing: border-box; border-radius: 8px; color: #192338; font-size: 18px; font-weight: 600; cursor: pointer; list-style: none; }
.ian-attachment-section > summary::-webkit-details-marker { display: none; }
.ian-attachment-section > summary:hover { background: #f1f7fd; }
.ian-attachment-section > summary:focus-visible { outline: 3px solid #0465ae; outline-offset: 2px; }
.ian-attachment-section > summary .fa-paperclip { color: #0069af; }
.ian-attachment-section > summary .ian-attachment-chevron { margin-left: auto; color: #0069af; font-size: 14px; }
.ian-attachment-section[open] > summary .ian-attachment-chevron { transform: rotate(180deg); }
.ian-attachment-tile.ian-attachment-document { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: 100%; max-width: 100%; padding: 12px; box-sizing: border-box; border: 1px solid #d1dff1; border-radius: 8px; }
.ian-attachment-document-name { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.ian-attachment-document .ian-attachment-download { gap: 8px; margin-left: auto; }
.ian-attachment-thumbnail { display: block; width: 100%; padding: 0; background: #f1f5fa; border: 1px solid #d1dff1; border-radius: 10px; overflow: hidden; cursor: pointer; }
.ian-attachment-thumbnail img { display: block; width: 100%; height: 140px; object-fit: cover; }
.ian-attachment-thumbnail:focus-visible { outline: 3px solid #006aab; outline-offset: 3px; }
body .ian-attachment-preview.ui-dialog { max-width: calc(100vw - 24px); border-radius: 12px; overflow: hidden; }
body .ian-attachment-preview .ui-dialog-content { padding: 16px; max-height: calc(100vh - 110px); overflow: auto; }
.ian-attachment-document-preview { display: none; }
.ian-attachment-document-preview.is-active { display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 12px; }
.ian-attachment-preview-suspended { display: none !important; }
.ian-attachment-preview-page { min-width: 0; color: #223047; background: #fff; }
.ian-attachment-preview-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.ian-attachment-preview-title { flex: 1 1 180px; min-width: 0; margin: 0; overflow-wrap: anywhere; font: 600 18px/1.4 Arial, sans-serif; color: inherit; }
.ian-attachment-preview-back { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid #006aab; border-radius: 8px; background: #006aab; color: #fff; font: 600 14px/1.4 Arial, sans-serif; cursor: pointer; }
.ian-attachment-preview-back:hover { background: #075f9e; }
.ian-attachment-preview-back:focus-visible { outline: 3px solid #006aab; outline-offset: 2px; }
.ian-attachment-preview-page .ui-panel { min-width: 0; max-width: 100%; border: 0; padding: 0; background: transparent; }
.ian-attachment-preview-page .ui-panel-content { padding: 0; }
.ian-attachment-preview-page .pdfdocviewer iframe { display: block; width: 100% !important; max-width: 100%; height: calc(100vh - 210px) !important; height: calc(100dvh - 210px) !important; min-height: 260px; border: 0; }
.ian-attachment-preview-error { flex-basis: 100%; color: #a63232; }
.ian-attachment-preview-error[hidden] { display: none; }
.resident-attachment-gallery .ian-attachment-download[aria-busy="true"] { opacity: .7; cursor: progress; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .ian-attachment-document-preview,
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .ian-attachment-preview-page { background: #182129; color: #edf2f5; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .ian-attachment-preview-back { background: #202a32; border-color: #455460; color: #a9c1d0; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .ian-attachment-preview-back:hover { background: #263641; color: #dbe7ee; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .ian-attachment-preview-back:focus-visible { outline-color: #a9c1d0; }
.ian-attachment-full { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #f6f9fd; }
.ian-attachment-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-top: 16px; }
.ian-attachment-footer > span { flex: 1; min-width: 160px; overflow-wrap: anywhere; font-size: 14px; }
.ian-attachment-download { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid #c4d8ef; border-radius: 8px; color: #006aab; font-size: 14px; overflow-wrap: anywhere; }
.resident-attachment-gallery .ian-attachment-download,
.resident-attachment-gallery .ian-attachment-download.ui-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: max-content; box-sizing: border-box; gap: 8px; margin: 0; padding: 0 16px; border: 1px solid #c4d8ef; border-radius: 8px; background: #fff; color: #006aab; box-shadow: none; text-shadow: none; font: 600 14px/1.4 Arial, sans-serif; white-space: nowrap; overflow-wrap: normal; text-decoration: none; cursor: pointer; }
.resident-attachment-gallery .ian-attachment-download.ui-button .ui-button-text { flex: 0 0 auto; padding: 0; color: inherit; font: inherit; white-space: nowrap; overflow-wrap: normal; }
.resident-attachment-gallery .ian-attachment-download.ui-button .ui-button-icon-left,
.resident-attachment-gallery .ian-attachment-download > svg.svg-inline--fa { flex: 0 0 16px; position: static; width: 16px; height: 16px; min-width: 16px; max-width: 16px; min-height: 16px; max-height: 16px; margin: 0; background: none; color: inherit; font-size: 16px; line-height: 16px; text-indent: 0; text-align: center; }
.resident-attachment-gallery .ian-attachment-download:hover { background: #f1f7fd; border-color: #006aab; }
.resident-attachment-gallery .ian-attachment-download:focus-visible { outline: 3px solid #006aab; outline-offset: 2px; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .resident-attachment-gallery .ian-attachment-download { background: #202a32; border-color: #455460; color: #a9c1d0 !important; }
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .resident-attachment-gallery .ian-attachment-download:hover,
html[data-ian-surface^="pwa-"][data-ian-theme="dark"] body.resident-panel .resident-attachment-gallery .ian-attachment-download:focus-visible { background: #263641; border-color: #526674; color: #dbe7ee !important; outline-color: #a9c1d0; }
.resident-photo-gallery-open,
.resident-photo-gallery-open body { overflow: hidden; }
.resident-photo-gallery { height: 100vh; height: 100dvh; position: fixed; z-index: 12000; inset: 0; display: flex; align-items: stretch; justify-content: center; background: #000; color: #f5f5f7; }
.resident-photo-gallery[hidden] { display: none; }
.resident-photo-gallery-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; cursor: default; }
.resident-photo-gallery-dialog { position: relative; z-index: 1; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(100%, 1280px); height: 100%; min-height: 0; }
.resident-photo-gallery-header,
.resident-photo-gallery-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: max(12px, env(safe-area-inset-top)) 18px 12px; box-sizing: border-box; background: rgba(0, 0, 0, .9); }
.resident-photo-gallery-footer { min-height: 58px; padding: 12px 18px max(12px, env(safe-area-inset-bottom)); }
.resident-photo-gallery-counter { color: #a1a1aa; font-size: 14px; font-weight: 600; }
.resident-photo-gallery-close,
.resident-photo-gallery-nav { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid #48484a; border-radius: 50%; background: #1c1c1e; color: #f5f5f7; font-size: 19px; cursor: pointer; }
.resident-photo-gallery-close:focus-visible,
.resident-photo-gallery-nav:focus-visible,
.resident-photo-gallery-download:focus-visible { outline: 3px solid #0a84ff; outline-offset: 3px; }
.resident-photo-gallery-stage { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 0; padding: 10px; box-sizing: border-box; touch-action: pan-y; }
.resident-photo-gallery-images { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; height: 100%; }
.resident-photo-gallery-images [data-resident-gallery-image] { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; }
.resident-photo-gallery-images [data-resident-gallery-image][hidden] { display: none; }
.resident-photo-gallery-images img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.resident-photo-gallery-nav:disabled { visibility: hidden; }
.resident-photo-gallery-names { min-width: 0; overflow: hidden; color: #f5f5f7; font-size: 14px; }
.resident-photo-gallery-names > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resident-photo-gallery-names > span[hidden],
.resident-photo-gallery-downloads > span[hidden] { display: none; }
.resident-photo-gallery-downloads { margin-left: auto; }
.resident-photo-gallery-download { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid #48484a; border-radius: 50%; background: #1c1c1e; color: #f5f5f7 !important; font-size: 19px; text-decoration: none; }
.resident-photo-gallery-download:hover { background: #303033; color: #fff !important; }
@media (max-width: 640px) {
    .resident-photo-gallery-stage { grid-template-columns: minmax(0, 1fr); padding: 0; }
    .resident-photo-gallery-nav { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; background: rgba(28, 28, 30, .85); }
    .resident-photo-gallery-nav.is-previous { left: 12px; }
    .resident-photo-gallery-nav.is-next { right: 12px; }
    .resident-photo-gallery-footer { gap: 10px; }
}

/* Resident attachment lists reuse the same fullscreen gallery without the legacy zoom rail. */
.ian-files-viewer .ian-file-image-open { border: 0; padding: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ian-files-viewer .ian-file-image-open:focus-visible { outline: 3px solid #006aab; outline-offset: 3px; }
