/* core/scan.js's camera document scanner — a near-fullscreen dialog, unlike
   the padded .editor-form dialogs (see base.css), so the camera/crop stage
   gets the room it needs. Everything else (buttons, backdrop) comes from
   .editor-dialog / .button / .icon-button unmodified. */
.scan-dialog { width: min(720px, calc(100% - 16px)); max-height: min(920px, calc(100dvh - 16px)); }
.scan-shell { display: flex; flex-direction: column; height: 100%; max-height: min(920px, calc(100dvh - 16px)); }
.scan-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.scan-head h2 { flex: 1; margin: 0; font: 400 20px/1 var(--serif); letter-spacing: -.01em; }
.scan-ocr-toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.scan-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; background: #111; }
.scan-stage[hidden] { display: none; }
.scan-stage video { display: block; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; }
.scan-status { position: absolute; margin: 0; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; }
/* The crop review screen: a canvas (photo + guide quad, redrawn on every
   drag) with 4 draggable corner handles positioned in the same box by
   percentage, so they stay aligned regardless of how much the canvas is
   scaled down to fit. */
.scan-review { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; }
.scan-crop-frame { position: relative; display: inline-block; max-width: 100%; max-height: 100%; touch-action: none; }
.scan-crop-frame canvas { display: block; max-width: 100%; max-height: calc(100dvh - 380px); }
.scan-crop-handle { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid #fff; border-radius: 50%; background: #5cc98a; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); cursor: grab; touch-action: none; }
.scan-crop-handle:active { cursor: grabbing; }
.scan-hint { position: static; background: none; color: var(--muted); padding: 0; }
.scan-pages { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; }
.scan-page-thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.scan-page-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-page-thumb button { position: absolute; top: 0; right: 0; width: 18px; height: 18px; border: 0; border-radius: 0 0 0 4px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.scan-text-wrap { padding: 0 16px 10px; }
.scan-text-wrap label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.scan-text-wrap textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 4px; padding: 8px; font: 12px/1.4 var(--mono, monospace); color: var(--ink); background: var(--paper); }
.scan-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.scan-foot-group { display: flex; align-items: center; gap: 10px; }
.scan-foot-group[hidden] { display: none; }
