.attachment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.attachment-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.attachment-preview-modal { box-sizing: border-box; width: min(1100px, calc(100vw - 32px)); max-width: none; height: min(820px, calc(100dvh - 32px)); max-height: none; padding: 0; border: 1px solid var(--line, #dce7f4); border-radius: 18px; background: var(--surface, #fff); color: var(--text, #172033); font-family: var(--font-sans, sans-serif); box-shadow: 0 24px 80px #07172b66; overflow: hidden; }
.attachment-preview-modal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.attachment-preview-modal::backdrop { background: #07172b99; backdrop-filter: blur(4px); }
.attachment-preview-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 20px; border-bottom: 1px solid var(--line, #dce7f4); }
.attachment-preview-header > div { min-width: 0; }
.attachment-preview-caption { color: var(--primary, #1f71dd); font-size: 12px; font-weight: 700; }
.attachment-preview-header h2 { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--heading, #172033); font-size: 17px; line-height: 1.5; }
.attachment-preview-close { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line, #dce7f4); border-radius: 10px; background: var(--surface-soft, #f5f8fc); color: var(--heading, #172033); font-size: 24px; cursor: pointer; }
.attachment-preview-content { display: flex; align-items: center; justify-content: center; min-height: 0; overflow: auto; background: var(--surface-soft, #f5f8fc); }
.attachment-preview-status { max-width: 560px; margin: 0; padding: 26px; text-align: center; font-size: 14px; line-height: 1.8; }
.attachment-preview-viewer { display: block; width: 100%; height: 100%; min-height: 0; border: 0; object-fit: contain; }
img.attachment-preview-viewer, video.attachment-preview-viewer { padding: 16px; box-sizing: border-box; }
.attachment-preview-text { align-self: stretch; width: 100%; margin: 0; padding: 20px; box-sizing: border-box; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.8; }
.attachment-pdf-shell { display: flex; flex-direction: column; align-self: stretch; width: 100%; min-height: 0; }
.attachment-pdf-tools { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px; border-bottom: 1px solid var(--line, #dce7f4); font-size: 13px; }
.attachment-pdf-tools button { padding: 8px 12px; border: 1px solid var(--line, #dce7f4); border-radius: 8px; background: var(--surface, #fff); color: var(--heading, #172033); font: inherit; cursor: pointer; }
.attachment-pdf-tools button:disabled { opacity: .5; cursor: default; }
.attachment-pdf-page { flex: 1; min-height: 0; overflow: auto; padding: 16px; text-align: center; box-sizing: border-box; }
.attachment-pdf-page canvas { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; box-shadow: 0 3px 18px #07172b22; }
.attachment-preview-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--line, #dce7f4); }
.attachment-preview-footer > span { color: var(--muted, #708299); font-size: 12px; }
.attachment-download-button { min-height: 40px; padding: 10px 18px; border: 1px solid var(--primary, #1f71dd); border-radius: 10px; background: var(--primary, #1f71dd); color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.attachment-preview-modal button:focus-visible { outline: 3px solid var(--primary, #1f71dd); outline-offset: 3px; }
.attachment-download-button:disabled { opacity: .6; cursor: wait; }
@media (max-width: 640px) {
  .attachment-preview-modal { width: calc(100vw - 16px); height: calc(100dvh - 16px); border-radius: 12px; }
  .attachment-preview-header, .attachment-preview-footer { padding: 12px; }
  .attachment-preview-footer { align-items: stretch; flex-direction: column; }
  .attachment-preview-header h2 { font-size: 15px; }
}
@media print { .attachment-preview-modal { display: none !important; } }
