/* Transparent attachment overlay. The editor keeps a measured bottom scroll inset. */
.note-attachments { position:absolute; z-index:3; bottom:0; left:0; right:0; min-width:0; padding:6px 0 12px; background:transparent; pointer-events:none; }
.editor-paper.has-note-attachments #note-editor, .editor-paper.has-note-attachments .editor-highlight { padding-bottom:max(64px,calc(var(--attachment-inset,0px) + 12px)); scroll-padding-bottom:calc(var(--attachment-inset,0px) + 12px); }
.note-attachments[hidden] { display:none; }
.attachment-strip { display:flex; align-items:center; gap:9px; overflow-x:auto; overflow-y:hidden; padding:3px 0 7px; pointer-events:auto; scrollbar-width:thin; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; direction:ltr; }
.attachment-item { position:relative; flex:0 0 76px; width:76px; height:76px; }
.attachment-item>.attachment-tile { width:100%; height:100%; }
.attachment-tile { position:relative; display:flex; flex:0 0 76px; flex-direction:column; align-items:center; width:76px; height:76px; padding:0; border:1px solid var(--border,#e5e7eb); border-radius:11px; overflow:hidden; background:var(--surface,#f6f7f9); color:var(--ink-soft,#5f6370); cursor:pointer; text-align:center; transition:border-color .15s,background .15s,transform .15s; }
.attachment-tile:hover { border-color:var(--accent,#6c78a9); transform:translateY(-1px); }
.attachment-tile:focus-visible { outline:2px solid var(--accent,#6c78a9); outline-offset:2px; }
.attachment-tile:disabled { opacity:.5; cursor:wait; }
.attachment-art { position:relative; width:100%; height:100%; min-height:0; flex:1 1 auto; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.attachment-art>svg { width:29px; height:29px; }
.attachment-art.attachment-pdf { color:#ad5757; }
.attachment-art.attachment-audio { color:#8c6ba5; }
.attachment-art.attachment-video { color:#668b9e; }
.attachment-extension { position:absolute; bottom:0; right:4px; font:600 7px/1.5 system-ui,sans-serif; letter-spacing:.035em; color:var(--ink-soft,#676c78); }
.attachment-thumbnail { width:100%; height:100%; object-fit:cover; }
.attachment-play { position:absolute; inset:0; display:grid; place-content:center; color:#fff; font-size:19px; text-shadow:0 1px 6px #000; background:#0000000a; }
.attachment-add { justify-content:center; background:transparent; border-style:dashed; }
.attachment-add>svg { width:23px; height:23px; }
.attachment-upload-status { pointer-events:auto; display:flex; align-items:center; gap:9px; margin-top:3px; font-size:11px; color:var(--ink-soft,#5f6370); }
.attachment-upload-status[hidden] { display:none; }
.attachment-upload-status>span { min-width:0; max-width:50%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.attachment-upload-status progress { width:100px; height:4px; accent-color:var(--accent,#7380ad); }
.attachment-viewer { position:fixed; inset:0; width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; padding:0; border:0; border-radius:0; color:#f8f9fc; background:#101217f5; overflow:hidden; overscroll-behavior:contain; }
.attachment-viewer[open] { display:flex; flex-direction:column; }
.attachment-viewer::backdrop { background:#101217; }
.attachment-viewer-toolbar { display:flex; align-items:center; gap:8px; padding:max(12px,env(safe-area-inset-top)) 18px 12px; min-height:65px; flex:0 0 auto; z-index:2; background:linear-gradient(#101217,#10121700); }
.attachment-icon { display:grid; place-items:center; flex:0 0 40px; width:40px; height:40px; border:0; border-radius:10px; background:transparent; color:inherit; cursor:pointer; }
.attachment-icon svg { width:23px; height:23px; }
.attachment-icon:hover { background:#ffffff18; }
.attachment-icon:focus-visible { outline:2px solid currentColor; outline-offset:1px; }
.attachment-icon:disabled { opacity:.3; cursor:default; }
.attachment-viewer-title { flex:1; min-width:0; display:flex; flex-direction:column; gap:3px; }
.attachment-viewer-title strong { font-size:14px; font-weight:500; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; unicode-bidi:plaintext; }
.attachment-viewer-title span { font-size:11px; color:#b4b9c4; }
.attachment-stage { flex:1; min-height:0; display:flex; align-items:center; justify-content:center; overflow:hidden; transform-origin:center; touch-action:pan-x; }
.attachment-stage[data-kind="image"] { touch-action:none; }
.attachment-media { display:block; max-width:100%; max-height:100%; border:0; }
.attachment-media-image { width:100%; height:100%; object-fit:contain; user-select:none; -webkit-user-select:none; will-change:transform; }
.attachment-media-video { width:100%; height:100%; object-fit:contain; }
.attachment-media-pdf { width:min(100%,1100px); height:100%; background:#fff; }
.attachment-audio-cover { display:flex; align-items:center; flex-direction:column; justify-content:center; width:min(90%,550px); gap:30px; }
.attachment-audio-cover>svg { width:90px; height:90px; color:#b6b9d8; }
.attachment-audio-cover>strong { font-size:18px; font-weight:500; text-align:center; overflow-wrap:anywhere; }
.attachment-media-audio { width:100%; }
.attachment-viewer-footer { display:flex; justify-content:center; align-items:center; gap:15px; flex:0 0 auto; min-height:58px; padding:7px 18px max(10px,env(safe-area-inset-bottom)); color:#d8dbe4; z-index:2; }
.attachment-viewer-footer>span { min-width:55px; text-align:center; font-size:12px; font-variant-numeric:tabular-nums; }
.attachment-file-card { max-width:580px; padding:30px; display:flex; flex-direction:column; align-items:center; gap:20px; text-align:center; }
.attachment-file-symbol>svg { width:70px; height:70px; color:#b6bdce; }
.attachment-file-card h2 { font-size:20px; line-height:1.4; font-weight:500; margin:0; overflow-wrap:anywhere; }
.attachment-file-card p,.attachment-viewer-message { color:#b7becd; line-height:1.6; margin:0; }
.attachment-management { width:min(calc(100vw - 32px),520px); }
.attachment-management .attachment-icon { color:var(--ink-soft,#5f6370); }
.attachment-management-body { display:flex; flex-direction:column; gap:16px; }
.attachment-management-body p { margin:0; line-height:1.6; }
.attachment-usage { font-weight:600; }
.attachment-renewal { color:var(--danger,#ad5555); }
@media(max-width:650px) { .note-attachments { padding:4px 0 8px; } .attachment-item { flex-basis:68px; width:68px; height:68px; } .attachment-tile { flex-basis:68px; width:68px; height:68px; } .attachment-viewer-toolbar { padding-left:6px; padding-right:6px; gap:3px; } .attachment-icon { width:36px; height:40px; flex-basis:36px; } }
@media(prefers-reduced-motion:reduce) { .attachment-tile { transition:none; } }
@media print { .note-attachments,.attachment-viewer,.attachment-management { display:none !important; } }

.attachment-renewal-notice { pointer-events:auto; display:block; padding:3px 0; border:0; background:transparent; color:var(--ink-soft,#666b77); font:11px/1.4 system-ui,sans-serif; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.attachment-renewal-notice[hidden] { display:none; }

/* Sibling buttons avoid nested controls and keep delete separate from opening a file. */
.attachment-remove.attachment-icon { position:absolute; top:4px; right:4px; z-index:2; width:21px; height:21px; min-width:21px; min-height:21px; padding:3px; border:0; border-radius:50%; color:#fff; background:#20232bc2; box-shadow:0 1px 3px #0002; cursor:pointer; }
.attachment-remove.attachment-icon svg { width:13px; height:13px; }
.attachment-remove.attachment-icon:hover { background:#20232be8; }
.attachment-remove.attachment-icon:disabled { opacity:.45; cursor:wait; }
.attachment-pending>.attachment-tile { cursor:default; background:color-mix(in srgb,var(--surface,#f6f7f9) 65%,transparent); }
.attachment-pending-meter { position:absolute; left:9px; right:9px; bottom:9px; width:calc(100% - 18px); height:3px; accent-color:var(--accent,#7380ad); }

/* DNP3_NOTE_COLORED_ATTACHMENT_ROW_V1 */
/* The editor supplies its stored note background, with the original white fallback. */
#note-attachments { background-color:var(--dnp-attachment-paper,#fff); }
/* The compact empty-note shelf and floating add tile share the same color. */
#note-attachments.is-empty #attachment-strip { background-color:var(--dnp-attachment-paper,#fff); }
#note-attachments.is-empty .attachment-add { background-color:var(--dnp-attachment-paper,#fff); opacity:1; }
