.document-scan-button{display:block;margin:8px 0;padding:9px 16px}.athar-scanner{box-sizing:border-box;width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;padding:12px;border:0;background:#102c36;color:#fff;overflow:auto}.athar-scanner::backdrop{background:#102c36}.athar-scanner header,.athar-scanner footer{display:flex;align-items:center;justify-content:space-between;gap:8px}.athar-scanner header{font-size:19px}.athar-scanner .scan-status{font-size:13px;min-height:36px;margin:8px 0}.athar-scanner .scan-layout{display:grid;grid-template-columns:minmax(0,1fr) 84px;gap:10px;direction:ltr}.athar-scanner main{min-width:0;direction:rtl}.athar-scanner video,.athar-scanner canvas{width:100%;max-height:65dvh;object-fit:contain;background:#06171e}.athar-scanner canvas{touch-action:none;height:auto;max-height:none}.athar-scanner [hidden]{display:none!important}.athar-scanner .scan-actions{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}.athar-scanner button,.athar-scanner .scan-import{background:#087e7e;color:white;border:1px solid #80b6bb;border-radius:7px;padding:8px;font:inherit;font-size:13px;cursor:pointer;margin:0}.athar-scanner button:disabled{opacity:.45;cursor:default}.athar-scanner aside{overflow:auto;max-height:72dvh;direction:rtl}.athar-scanner aside section{margin-bottom:10px;background:#264651;padding:4px;border-radius:6px;text-align:center}.athar-scanner aside img{width:100%;height:95px;object-fit:contain}.athar-scanner aside span{display:block;font-size:12px}.athar-scanner aside button{font-size:11px;padding:4px;margin:2px}.athar-scanner footer{position:sticky;bottom:0;background:#102c36;padding:10px 0}.athar-scanner footer button{font-weight:bold;padding:12px}

/* Fill the mobile camera workspace; reserve thumbnails only when populated. */
.athar-scanner[open]{display:flex;flex-direction:column;overflow:hidden;padding:12px;padding-bottom:max(12px,env(safe-area-inset-bottom));gap:8px}
.athar-scanner header,.athar-scanner footer,.athar-scanner .scan-status{flex-shrink:0}
.athar-scanner .scan-status{min-height:0;margin:0;line-height:1.5}
.athar-scanner .scan-layout{flex:1;min-height:0;grid-template-columns:minmax(0,1fr) 76px;gap:8px}
.athar-scanner .scan-layout:has(aside:empty){grid-template-columns:minmax(0,1fr)}
.athar-scanner aside:empty{display:none}
.athar-scanner main{min-height:0;display:grid;grid-template-rows:minmax(0,1fr) auto;justify-items:center;overflow:hidden;background:#06171e;border-radius:12px}
.athar-scanner video{width:100%;height:100%;max-height:none;object-fit:cover}
.athar-scanner canvas{width:auto;height:auto;max-width:100%;max-height:100%;align-self:center;object-fit:contain}
.athar-scanner .scan-actions{width:100%;box-sizing:border-box;justify-content:center;align-items:center;margin:0;padding:10px;background:#102c36;gap:8px}
.athar-scanner [data-capture],.athar-scanner [data-keep]{background:#e8fffa;color:#075952;font-weight:bold;min-height:46px;padding:10px 20px;border-radius:24px}
.athar-scanner .scan-import{background:transparent;min-height:42px;box-sizing:border-box;display:flex;align-items:center}
.athar-scanner aside{max-height:none;min-height:0}
.athar-scanner footer{position:static;padding:0;min-height:48px}
.athar-scanner [data-close]{background:transparent}

.athar-scanner main{display:flex;flex-direction:column;min-height:0}
.athar-scanner .scan-camera{position:relative;flex:1;min-height:0;width:100%;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#06171e}
.athar-scanner .scan-camera video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.athar-scanner .scan-camera canvas{position:relative;display:block;max-width:100%;max-height:100%;width:auto;height:auto;min-height:0}
.athar-scanner .scan-actions{flex:0 0 auto;position:relative;z-index:2;min-height:66px}
.athar-scanner .scan-live-outline{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1}
.athar-scanner .scan-live-outline polygon{fill:#ffd64a33;stroke:#ffd64a;stroke-width:2;vector-effect:non-scaling-stroke}
