.record-fields{border:0;margin:0;padding:0;min-width:0}
#scan-editor{width:min(680px,calc(100% - 16px));max-height:calc(100dvh - 16px);border:1px solid #dfe3dc;border-radius:18px;padding:0;background:#fafbf8;color:#202620;overflow:hidden;overscroll-behavior:contain}
#scan-editor button{font:inherit;cursor:pointer;min-height:44px;touch-action:manipulation}
#scan-editor button:disabled{opacity:.45;cursor:default}
#scan-editor .primary,#scan-editor .secondary{display:flex;align-items:center;justify-content:center;border-radius:10px;font-weight:650;padding:12px 14px;border:1px solid #dfe3dc;line-height:1.35;text-align:center}
#scan-editor .primary{background:#222c26;color:white;width:100%}
#scan-editor .secondary{background:white;color:#36413a}
#scan-editor h2{font-size:20px;margin:0;letter-spacing:-.5px}
#scan-editor .text-button{border:0;background:none;color:#76613b;font-size:12px;padding:10px;font-weight:600}
#scan-editor-error{color:#923c31;font-size:13px;margin:0 0 8px}
#scan-editor [hidden]{display:none!important}
#scan-documents{margin:24px 0;padding:20px;border:1px solid var(--line,#dfe3dc);border-radius:14px;background:#fafaf6}
#scan-documents h3{margin:0}#scan-documents .scan-heading{display:flex;gap:10px;align-items:center;justify-content:space-between}
#scan-documents .scan-count{font-size:13px;border-radius:20px;padding:3px 9px;background:#e9e9df}
#scan-documents .scan-capture{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}
#scan-documents .scan-hint{font-size:12px;color:#667065;margin-top:10px}
#scan-documents [data-scan-message]{font-size:13px;color:#52644b;margin:12px 0}
#scan-documents [data-scan-message].error{color:#973d30}
#scan-documents [data-scan-pages]{display:grid;gap:12px}
#scan-documents .scan-page{display:flex;gap:14px;padding-top:14px;border-top:1px solid #e1e3d9}
#scan-documents .scan-page>div{min-width:0}#scan-documents .scan-page h4{margin:0;font-size:14px}
#scan-documents .scan-page p{font-size:12px;overflow-wrap:anywhere;margin:4px 0}
#scan-documents .scan-page img{width:64px;height:90px;object-fit:contain;background:#eeeee7;border-radius:6px;flex:none}
#scan-documents .scan-page-tools{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
#scan-documents .scan-page-tools .button{font-size:12px;min-height:40px;padding:7px 9px}
@media(max-width:420px){#scan-documents{padding:14px}.scan-capture .button{flex:1}#scan-editor .editor-tools{flex-wrap:wrap}}

#scan-editor[open]{display:flex;flex-direction:column}
#scan-editor::backdrop{background:#132019d6}
#scan-editor .editor-header{display:flex;align-items:center;gap:12px;justify-content:space-between;padding:18px;flex-shrink:0}
#scan-editor .compact{width:auto;font-size:13px;margin:0;padding:10px 14px}
#scan-editor .editor-body{padding:0 18px 8px;overflow-y:auto;min-height:0;overscroll-behavior:contain}
#scan-editor .crop-help{font-size:13px;line-height:1.4;margin:0 0 12px;min-height:36px;color:#546050}
#scan-editor .editor-preview{position:relative;touch-action:none;height:clamp(200px,44dvh,430px);background:#242c27;border:1px solid #37453b;border-radius:12px;padding:0;overflow:hidden}
#scan-editor #scan-crop-stage{position:absolute;flex:none;touch-action:none;user-select:none;-webkit-user-select:none}
#scan-editor #scan-edit-canvas{display:block;width:100%;height:100%;box-shadow:0 2px 16px #0005}
#scan-editor #scan-crop-overlay{position:absolute;inset:0;touch-action:none}
#scan-editor .crop-guides{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible;z-index:1}
#scan-editor #scan-crop-shade{fill:#1023199c}
#scan-editor #scan-crop-outline{fill:none;stroke:#f0d48e;stroke-width:2.5;stroke-linejoin:round}
#scan-editor .crop-move{position:absolute;inset:0;width:100%;height:100%;min-height:0;border:0;padding:0;background:transparent;cursor:move;touch-action:none;border-radius:0}
#scan-editor .crop-handle{position:absolute;width:48px;height:48px;min-height:48px;border:0;padding:0;background:transparent;touch-action:none;border-radius:50%;transform:translate(-50%,-50%);z-index:2}
#scan-editor .crop-handle::after{content:"";position:absolute;width:19px;height:19px;top:50%;left:50%;transform:translate(-50%,-50%);background:#fff7dd;border:3px solid #b48a36;border-radius:50%;box-shadow:0 1px 5px #0008}
#scan-editor .crop-handle{cursor:grab}
#scan-editor .crop-handle:active{cursor:grabbing}
#scan-editor .crop-handle:focus-visible{outline:2px solid #fff;outline-offset:-5px}
#scan-editor .crop-move:focus-visible{outline:2px solid #fff;outline-offset:5px}
#scan-editor .crop-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 0 8px;border-bottom:1px solid var(--line)}
#scan-editor .editor-tools{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:12px 0 2px}
#scan-editor .check-label{display:flex;align-items:center;font-size:13px;min-height:44px;gap:6px}
#scan-editor .check-label input{width:20px;height:20px;accent-color:#334b3a}
#scan-editor .editor-footer{padding:12px 18px max(14px,env(safe-area-inset-bottom));border-top:1px solid var(--line);background:#fafbf8;flex-shrink:0}
#scan-editor .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#scan-editor .page-shape{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px;margin:10px 0 6px}
#scan-editor .page-shape select{font:inherit;font-size:16px;padding:10px 30px 10px 12px;min-height:44px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#28382c;max-width:65%}
#scan-editor .zoom-toolbar{display:flex;align-items:center;gap:8px;margin-top:10px}
#scan-editor .zoom-step{width:44px;min-height:44px;padding:3px;font-size:25px;font-weight:500;margin:0;flex-shrink:0}
#scan-editor .zoom-toolbar output{min-width:40px;text-align:center;color:#52604f;font-size:13px;font-variant-numeric:tabular-nums}
#scan-editor .zoom-toolbar #scan-fit-photo{margin-left:auto;min-height:44px}
#scan-editor .editor-preview.zoomed,#scan-editor .editor-preview.zoomed .crop-move{cursor:grab}
#scan-editor .editor-preview.zoomed:active{cursor:grabbing}
/* Scan, review, save: common controls for standalone PDFs and daily attachments. */
.scan-steps{display:flex;gap:14px;font-weight:650;color:var(--muted);margin:0}.scan-steps span{color:#b19a65}
#scan-documents [data-scan-pages]{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:16px}
#scan-documents .scan-page{display:block;min-width:0;padding:12px;border:1px solid #deded5;border-radius:12px;background:white}
#scan-documents .scan-page-preview{display:flex;align-items:center;justify-content:center;width:100%;height:180px;padding:6px;background:#f0f0e9;border:0;border-radius:8px;font:inherit;cursor:pointer;margin-bottom:12px}
#scan-documents .scan-page-preview img{width:100%;height:100%;border-radius:0;object-fit:contain}
#scan-documents .scan-warning{color:#815c20;font-weight:600}
#scan-documents .scan-page-tools .button{min-height:44px;flex:auto}
#scan-documents .scan-drag{touch-action:none;border:0;background:transparent;color:#5a615b;min-height:44px;cursor:grab;font:inherit;font-size:13px;width:100%;margin-top:5px}
#scan-documents .scan-review-heading{margin:20px 0 12px}
#scan-documents [hidden]{display:none!important}
#scan-editor .scan-advanced{margin-top:12px}#scan-editor .scan-advanced summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-size:14px}
#scan-editor .editor-tools{flex-wrap:wrap}#scan-editor .editor-tools .page-shape{flex:1;min-width:200px}
#scan-editor .editor-tools select{max-width:none;flex:1}
#scan-camera-dialog{width:min(900px,100%);height:100dvh;max-height:100dvh;max-width:100%;border:0;border-radius:0;padding:18px;background:#111714;color:#fff;overflow:hidden}
#scan-camera-dialog[open]{display:flex;flex-direction:column;gap:12px}
#scan-camera-dialog::backdrop{background:#000d}
#scan-camera-dialog [hidden]{display:none!important}
#scan-camera-dialog header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex:none}
#scan-camera-dialog h2{font-size:20px;margin:0;color:#fff}
#scan-camera-dialog button{font:inherit;color:#fff;background:#28332d;border:1px solid #59665b;border-radius:10px;min-height:46px;padding:10px 14px;cursor:pointer}
#scan-camera-dialog button:disabled{opacity:.45;cursor:default}
#scan-camera-dialog .scan-live-view{min-height:0;flex:1;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#050806;border-radius:12px}
#scan-camera-dialog .scan-live-paper{position:relative;max-width:100%;max-height:100%}
#scan-camera-dialog video{display:block;width:100%;height:100%;object-fit:contain}
#scan-camera-dialog svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#scan-camera-dialog polygon{fill:#efca5c25;stroke:#efca5c;stroke-width:.7;vector-effect:non-scaling-stroke}
#scan-camera-status{min-height:48px;margin:0;text-align:center;font-size:14px;line-height:1.5}
#scan-camera-dialog footer{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-bottom:env(safe-area-inset-bottom);flex:none}
#scan-camera-dialog footer>div{display:flex;align-items:center;gap:8px}
#scan-camera-thumbnail{width:36px;height:48px;object-fit:cover;border:1px solid #aaa;border-radius:4px}
#scan-camera-shutter{width:72px;height:72px;border-radius:50%!important;border:3px solid white!important;padding:5px!important;flex:none}
#scan-camera-shutter span{display:block;border-radius:50%;background:white;width:100%;height:100%}
#scan-camera-fallback{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin:auto 0}
@media(max-width:480px){#scan-camera-dialog{padding:12px}#scan-camera-dialog footer{gap:6px}#scan-camera-dialog footer button{font-size:12px;padding:8px}#scan-camera-thumbnail{display:none}#scan-documents [data-scan-pages]{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}#scan-documents .scan-page{padding:8px}#scan-documents .scan-page-preview{height:145px}#scan-documents .scan-page-tools{gap:4px}#scan-documents .scan-page-tools .button{font-size:11px;padding:5px}}
