.attachment-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.attachment-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 7px 10px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 650; border: 1px solid var(--accent-border); }
.attachment-action .icon { width: 16px; height: 16px; }
.attachment-action.attachment-icon { flex: 0 0 44px; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 12px; }
.attachment-action.attachment-icon .icon { width: 21px; height: 21px; }
.attachment-action.attachment-icon:hover, .attachment-action.attachment-icon:focus-visible { background: #e1f5fc; border-color: #66c6dd; }
.attachment-action.attachment-icon:focus-visible { outline: 2px solid #22b4d9; outline-offset: 2px; }
.pending-status { font-size: 11px; color: var(--muted); margin-left: auto; }
.pending-attachments { display: flex; gap: 9px; overflow-x: auto; padding: 3px 2px 5px; max-height: 123px; }
.pending-tile { flex: 0 0 108px; min-width: 0; position: relative; border: 1px solid #dfeef3; background: #f7fbfd; border-radius: 12px; overflow: hidden; }
.pending-thumb { width: 100%; height: 66px; padding: 0; display: grid; place-items: center; color: #4a9ab3; background: #eaf6fa; }
.pending-thumb img { width: 100%; height: 66px; min-height: 0; object-fit: cover; display: block; }
.pending-thumb .icon { width: 25px; height: 25px; }
.pending-name { margin: 0; padding: 5px 8px; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.remove-attachment { position: absolute; right: 2px; top: 2px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #365b70; background: #ffffffeb; box-shadow: 0 2px 6px #315b721a; }
.remove-attachment .icon { width: 15px; height: 15px; }
.has-attachments { width: min(340px, 88%); max-width: 88%; }
.file-attachments { display: grid; gap: 6px; margin-top: 7px; }
.file-attachment { display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid #d9eaf0; background: white; border-radius: 12px; color: var(--ink); text-decoration: none; min-width: 0; }
.file-attachment > .icon { width: 16px; height: 16px; color: #4c9caf; }
.file-attachment[aria-disabled="true"] { opacity: .7; }
.attachment-note { font-size: 10px; color: #9b6d36; margin: 6px 1px 0; }
#image-dialog { width: 1000px; height: min(860px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); background: #193744; color: #edfaff; }
.viewer-layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; flex-shrink: 0; background: #204351; }
.viewer-title-group { min-width: 0; }
#image-viewer-title { font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#image-counter { display: block; font-size: 11px; color: #b9d7e2; margin-top: 3px; }
.viewer-bar .close-button { color: white; background: #ffffff16; }
.viewer-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 16px; overflow: auto; overscroll-behavior: contain; }
.viewer-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 7px; }
.viewer-stage.is-zoomed { display: block; }
.viewer-stage.is-zoomed img { width: 200%; max-width: none; max-height: none; height: auto; }
.viewer-status { font-size: 13px; text-align: center; color: #d0e6ef; }
.viewer-controls { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 14px max(14px, env(safe-area-inset-bottom)); flex-shrink: 0; background: #204351; }
.viewer-control { min-height: 44px; min-width: 44px; padding: 10px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 12px; font-size: 11px; font-weight: 650; color: #e5f8fc; text-decoration: none; background: #ffffff14; }
.viewer-control[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.viewer-control .icon { width: 18px; height: 18px; }
.next-image .icon { transform: rotate(180deg); }
#camera-dialog { height: min(760px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px); }
.camera-layout { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.camera-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; background: white; flex-shrink: 0; }
.camera-stage { position: relative; flex: 1; min-height: 100px; display: grid; place-items: center; background: #e7f4f8; overflow: hidden; }
.camera-stage video { width: 100%; height: 100%; object-fit: contain; background: #1e3f4e; }
.camera-status { padding: 24px; text-align: center; font-size: 13px; color: #547c8e; max-width: 380px; }
.camera-footer { padding: 17px 20px max(20px, env(safe-area-inset-bottom)); background: white; flex-shrink: 0; }
.camera-footer .attachment-action { width: 100%; margin-top: 10px; min-height: 44px; }

@media (max-width: 600px) {
  #image-dialog, #camera-dialog { width: 100%; max-width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .viewer-bar, .camera-heading { padding-top: max(14px, env(safe-area-inset-top)); }
}
