/* Files Momo sends (public/files.js): cards on replies and updates, and the PDF viewer. The file icon, name and
   size reuse .file-icon / .file-name / .file-size from styles.css; the viewer buttons reuse .canvas-btn. */
.sent-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sent-file { display: flex; align-items: stretch; width: 300px; max-width: 100%; border-radius: 14px; border: 1px solid var(--line-2); background: var(--card); overflow: hidden; }
.sent-file:hover { border-color: var(--pen); }
.sent-file-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--ink); text-decoration: none; text-align: left; }
.sent-file-open:focus-visible, .sent-file-dl:focus-visible { outline: 2px solid var(--pen); outline-offset: -2px; }
.sent-file-thumb { flex: none; width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--paper); }
.sent-file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sent-file-dl { flex: none; width: 44px; display: grid; place-items: center; border-left: 1px solid var(--line); color: var(--ink-3); }
.sent-file-dl:hover { color: var(--ink); background: var(--paper); }
.urow .sent-files { width: 100%; }
/* Update rows style every <b> as a title; the type badge keeps its own size there. */
.sent-file .file-icon b { font-size: 9px; line-height: 14px; font-weight: 700; overflow-wrap: normal; }

.pdf-viewer { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 12px; border: 0; background: transparent; overflow: hidden; }
.pdf-viewer::backdrop { background: rgba(29, 26, 22, .82); }
.pdf-viewer[open] { display: flex; animation: rise .3s var(--ease) both; }
html:has(.pdf-viewer[open]) { overflow: hidden; }
.pdf-sheet { flex: 1; min-width: 0; display: flex; flex-direction: column; max-width: 1100px; margin: 0 auto; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 28px 64px -28px rgba(0, 0, 0, .7); }
.pdf-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
.pdf-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pdf-title { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-meta { font-size: 12px; color: var(--ink-3); }
.pdf-head .canvas-btn { text-decoration: none; }
.pdf-stage { flex: 1; min-height: 0; display: flex; background: #525659; }
.pdf-stage iframe { flex: 1; width: 100%; height: 100%; border: 0; }
/* A markdown or text file reads like a canvas body (canvas.css), in a column narrow enough to follow. */
.pdf-stage.is-text { background: var(--card); }
.canvas-body.file-read { padding-left: max(24px, calc((100% - 760px) / 2)); padding-right: max(24px, calc((100% - 760px) / 2)); }
.file-read-note { color: var(--ink-3); }
.canvas-body .file-plain { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 860px) {
  .sent-file { width: 100%; }
  .pdf-viewer { padding: 0; }
  .pdf-sheet { border-radius: 0; }
  .pdf-head { padding: calc(10px + env(safe-area-inset-top)) 10px 10px 14px; }
  .pdf-head .canvas-btn { height: 44px; }
  .pdf-head .canvas-btn.icon-only { width: 44px; }
  .canvas-body.file-read { padding-left: 16px; padding-right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pdf-viewer[open] { animation: none; }
}
