:root {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f7f7f5;
    background: #111311;
    font-synthesis: none;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; width: 100%; min-height: 100%; background: #111311; }
body { min-height: 100dvh; overflow-x: hidden; }
button { font: inherit; }
.app-shell { min-height: 100dvh; background: #111311; }

.home-screen { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 28px 20px max(28px, env(safe-area-inset-bottom)); gap: 42px; }
.home-brand { text-align: center; }
.brand-mark { margin: 0 auto 12px; width: 58px; height: 58px; display: grid; place-items: center; border: 2px solid #dfe6db; border-radius: 20px; font-size: 34px; color: #dfe6db; }
.home-brand h1 { margin: 0; font-size: clamp(26px, 7vw, 38px); letter-spacing: -.035em; }
.home-brand p { margin: 8px 0 0; color: #9ca59b; font-size: 15px; }
.home-actions { display: grid; gap: 16px; width: min(100%, 520px); margin: 0 auto; }
.home-action { min-height: 150px; border: 0; border-radius: 26px; padding: 24px; display: flex; align-items: center; justify-content: center; gap: 18px; font-size: clamp(23px, 6vw, 32px); font-weight: 850; letter-spacing: .03em; cursor: pointer; box-shadow: 0 18px 40px rgba(0,0,0,.22); }
.home-action.capture { background: #e8f0e4; color: #172016; }
.home-action.audit { background: #dddfd9; color: #181b18; }
.home-action-icon { font-size: 1.25em; }

.workflow-screen, .session-screen { min-height: 100dvh; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.capture-workflow { min-height: 100dvh; height: auto; overflow: visible; }
.workflow-header { min-height: 68px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; background: #151815; position: sticky; top: 0; z-index: 10; }
.workflow-title { font-size: 17px; font-weight: 850; letter-spacing: .035em; }
.workflow-subtitle { margin-top: 2px; color: #929b91; font-size: 12px; }
.icon-button, .finish-button { border: 0; cursor: pointer; }
.icon-button { width: 44px; height: 44px; border-radius: 14px; background: #252a25; color: white; font-size: 31px; line-height: 1; }
.finish-button { min-height: 44px; background: #f0f2ed; color: #161916; font-weight: 800; border-radius: 13px; padding: 11px 14px; font-size: 13px; }

.camera-panel { position: relative; background: black; }
.camera-shell { position: relative; width: 100%; max-width: 640px; margin: 0 auto; background: #050505; }
.camera-view { width: 100%; min-height: 240px; overflow: hidden; background: #050505; position: relative; transition: box-shadow .12s ease; }
.camera-view.scan-hit { box-shadow: inset 0 0 0 6px #aee69f; }
/* The decoder maps pixels using video.clientWidth/clientHeight. Keep the
   native aspect ratio so the preview and the decoded QR region stay aligned. */
.camera-view video { width: 100% !important; height: auto !important; object-fit: contain !important; }
.camera-view > div { border: 0 !important; }
.camera-view img[alt*="Camera"] { display: none !important; }
.capture-workflow > .camera-panel { height: 33dvh; max-height: 33dvh; overflow: hidden; }
.capture-workflow .camera-shell,
.capture-workflow .camera-view { height: 100%; max-height: 33dvh; min-height: 0; }
.capture-workflow .camera-view { display: grid; place-items: center; }
.capture-workflow .camera-view video {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 33dvh !important;
    object-fit: contain !important;
}
.camera-controls { position: absolute; z-index: 5; right: 10px; bottom: 10px; display: flex; gap: 7px; pointer-events: none; }
.camera-control { pointer-events: auto; min-width: 44px; min-height: 44px; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; padding: 7px 10px; background: rgba(16,18,16,.78); color: #f2f4ef; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 800; backdrop-filter: blur(8px); cursor: pointer; }
.camera-control.active { background: rgba(218,232,206,.92); color: #142014; border-color: rgba(255,255,255,.36); }
.camera-control:disabled { opacity: .42; cursor: default; }
.camera-control-icon { font-size: 17px; line-height: 1; }
.camera-hint { position: absolute; z-index: 4; left: 10px; bottom: 12px; max-width: calc(100% - 210px); padding: 6px 8px; border-radius: 9px; background: rgba(8,10,8,.68); color: #b7beb5; font-size: 10px; line-height: 1.25; pointer-events: none; }
.camera-error { position: absolute; z-index: 6; left: 10px; right: 10px; top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid rgba(255,177,166,.28); border-radius: 12px; background: rgba(59,33,30,.9); color: #ffd0c9; font-size: 11px; line-height: 1.35; backdrop-filter: blur(8px); }
.camera-error button { flex: 0 0 auto; min-height: 44px; border: 0; border-radius: 9px; padding: 7px 10px; background: #f1e7e4; color: #2a1715; font-size: 11px; font-weight: 850; cursor: pointer; }
.camera-error button:disabled { opacity: .55; cursor: default; }
.capture-flash { pointer-events: none; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(172, 234, 151, .20); color: #c5ffb3; font-size: 84px; font-weight: 900; text-shadow: 0 4px 24px rgba(0,0,0,.5); }
.capture-status { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 12px; color: #aab2a8; font-size: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #89d77c; box-shadow: 0 0 0 4px rgba(137,215,124,.12); }

.thumbnail-strip { display: flex; gap: 9px; overflow-x: auto; padding: 8px 12px 2px; scrollbar-width: none; }
.thumbnail-strip::-webkit-scrollbar { display: none; }
.thumbnail-card { flex: 0 0 108px; height: 92px; border-radius: 15px; overflow: hidden; background: #232623; position: relative; border: 1px solid #343934; }
.thumbnail-card img, .thumbnail-pending { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-pending { display: grid; place-items: center; color: #8d958c; font-weight: 900; letter-spacing: 4px; }
.thumbnail-card span { position: absolute; left: 5px; bottom: 5px; padding: 3px 6px; border-radius: 7px; background: rgba(0,0,0,.66); color: white; font-size: 10px; }

.session-list { padding: 14px 12px 40px; display: grid; gap: 10px; }
.new-session-button { min-height: 62px; border: 0; border-radius: 18px; background: #e8f0e4; color: #172016; padding: 14px 16px; display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 850; cursor: pointer; }
.new-session-button span { font-size: 24px; line-height: 1; }
.session-card { width: 100%; border: 1px solid #333833; border-radius: 18px; background: #1d211d; color: white; padding: 17px 16px; display: grid; grid-template-columns: 1fr auto 24px; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.session-date { font-weight: 780; }
.session-meta { color: #9da79b; font-size: 13px; }
.session-meta small { display: block; margin-top: 4px; color: #c1c8bf; font-size: 11px; }
.session-arrow { color: #909990; font-size: 26px; }
.empty-state { padding: 40px 24px; color: #9ba39a; text-align: center; }
.empty-state.compact { padding: 22px 24px; }
.audit-session-entry { display: grid; gap: 8px; }
.audit-history-list { margin: -1px 8px 5px; padding: 9px; display: grid; gap: 7px; border: 1px solid #2b302b; border-radius: 0 0 15px 15px; background: #171a17; }
.audit-history-title { color: #8e978d; font-size: 10px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.audit-history-card { width: 100%; min-height: 46px; border: 1px solid #303530; border-radius: 12px; background: #202420; color: #eef1eb; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; text-align: left; cursor: pointer; }
.audit-history-card span { font-size: 12px; font-weight: 800; }
.audit-history-card small { color: #929a91; font-size: 10px; }
.audit-history-card strong { color: #b9dfb5; font-size: 10px; white-space: nowrap; }
.readonly-badge { padding: 7px 9px; border: 1px solid #566257; border-radius: 10px; background: #252b25; color: #c9d4c6; font-size: 10px; font-weight: 900; letter-spacing: .05em; }

.audit-workflow { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.audit-workflow .workflow-header { flex: 0 0 auto; }
.audit-main { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.audit-compare-grid { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 8px 10px 6px; }
.audit-camera-cell, .reference-panel { height: clamp(128px, 24dvh, 260px); max-height: 33dvh; min-width: 0; min-height: 0; border-radius: 16px; overflow: hidden; border: 1px solid #333933; background: #080908; }
.audit-camera-cell { position: relative; }
.audit-camera-panel, .audit-camera-panel .camera-shell, .audit-camera-panel .camera-view { width: 100%; height: 100%; max-width: none; min-height: 0; }
.audit-camera-panel .camera-shell, .audit-camera-panel .camera-view { display: grid; place-items: center; }
.audit-camera-panel .camera-view { container-type: size; }
.audit-camera-panel .camera-view video {
    width: min(100cqw, 133.333333cqh) !important;
    height: min(100cqh, 75cqw) !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain !important;
}
.audit-camera-cell .camera-controls { right: 6px; bottom: 6px; gap: 5px; }
.audit-camera-cell .camera-control { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 12px; }
.audit-camera-cell:not(.expanded) .camera-control > span:not(.camera-control-icon) { display: none; }
.audit-camera-cell .camera-hint { display: none; }
.camera-expand-button { position: absolute; z-index: 7; top: 6px; right: 6px; min-width: 44px; height: 44px; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; background: rgba(16,18,16,.82); color: #f2f4ef; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; font-size: 12px; cursor: pointer; backdrop-filter: blur(8px); }
.camera-expand-button span { font-size: 19px; line-height: 1; }
.camera-expand-button strong { display: none; }
.audit-camera-cell.expanded { z-index: 60; transform: scale(1.8); transform-origin: top left; border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.88), 0 20px 70px rgba(0,0,0,.55); }
.audit-camera-cell.expanded .camera-expand-button { top: 10px; right: 10px; min-width: 94px; }
.audit-camera-cell.expanded .camera-expand-button strong { display: inline; }
.audit-camera-cell.expanded .camera-control { width: auto; min-width: 44px; padding-inline: 10px; }
.audit-camera-cell.expanded .camera-control > span:not(.camera-control-icon) { display: inline; }
.reference-panel { display: grid; place-items: center; }
.reference-panel img { display: block; width: 100%; height: 100%; object-fit: contain; background: #090a09; }
.reference-image-button { width: 100%; height: 100%; min-width: 0; min-height: 44px; padding: 0; border: 0; background: #090a09; cursor: zoom-in; overflow: hidden; }
.reference-image-button img { width: 100%; height: 100%; object-fit: contain; }
.reference-panel.unexpected { border-color: #b95d50; background: #321b18; }
.reference-placeholder, .no-reference-image { text-align: center; color: #9da59c; padding: 14px; font-size: 12px; line-height: 1.35; }
.no-reference-image small { color: #737b72; }
.unexpected-message { display: grid; place-items: center; gap: 7px; padding: 10px; color: #ffb4a7; text-align: center; font-size: 11px; }
.unexpected-message span { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #733229; color: white; font-size: 25px; font-weight: 900; }
.audit-history-note { margin: 9px 10px 7px; padding: 10px 12px; border: 1px solid #374037; border-radius: 13px; background: #1e231e; display: grid; gap: 3px; }
.audit-history-note strong { font-size: 12px; }
.audit-history-note span { color: #9ba49a; font-size: 10px; line-height: 1.35; }
.audit-scan-feedback, .audit-scan-error { flex: 0 0 auto; margin: 0 10px 6px; padding: 8px 10px; border-radius: 11px; font-size: 11px; line-height: 1.35; }
.audit-scan-feedback { border: 1px solid #385b3c; background: #203522; color: #bde6b8; }
.audit-scan-error { border: 1px solid rgba(255,177,166,.28); background: #3b211e; color: #ffd0c9; }
.audit-controls-block { flex: 0 0 auto; }
.audit-action-row { display: grid; grid-template-columns: minmax(0, .78fr) 52px minmax(0, 1.22fr); gap: 8px; padding: 0 10px 8px; }
.audit-ready-hint { min-height: 46px; margin: 0 10px 8px; padding: 10px 12px; display: grid; place-items: center; border: 1px solid #303530; border-radius: 13px; color: #9fa79e; font-size: 11px; text-align: center; }
.quick-complete-button { min-width: 0; min-height: 56px; border: 1px solid #47704b; border-radius: 15px; background: #274229; color: #bff0ba; font-size: 25px; font-weight: 950; cursor: pointer; }
.quick-complete-button.missing { border-color: #775d2d; background: #3a2e19; color: #f4d17a; font-size: 11px; letter-spacing: .02em; }
.wrong-button { width: 100%; min-width: 0; min-height: 56px; margin: 0; border: 0; border-radius: 15px; background: #e05045; color: white; padding: 8px 10px; font-size: clamp(13px, 3.8vw, 17px); font-weight: 900; line-height: 1.1; letter-spacing: .01em; cursor: pointer; }
.wrong-button span { margin-right: 5px; }
.wrong-button.corrected { background: #29362a; color: #b9e8b5; }
.audit-results { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; overflow-anchor: none; scrollbar-gutter: stable; padding: 0 10px 10px; display: grid; align-content: start; gap: 7px; }
.audit-group { border: 1px solid #303530; border-radius: 14px; overflow: hidden; background: #191d19; }
.audit-group.not-seen-group { border-color: #584b2d; }
.audit-group.action-group { border-color: #654036; }
.audit-group.ok-group { border-color: #315238; }
.audit-group-header { width: 100%; min-height: 44px; border: 0; background: transparent; color: #eef1eb; padding: 7px 9px; display: grid; grid-template-columns: 30px 1fr auto 22px; align-items: center; gap: 7px; text-align: left; cursor: pointer; }
.audit-group-header strong { font-size: 13px; }
.audit-group-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: #2b302b; color: #c6ccc4; font-weight: 900; }
.not-seen-group .audit-group-icon { background: #40371f; color: #f1ce7f; }
.action-group .audit-group-icon { background: #482824; color: #ffaaa0; }
.ok-group .audit-group-icon { background: #233b25; color: #9ee49b; }
.audit-group-count { min-width: 28px; padding: 4px 7px; border-radius: 999px; background: #2a2f2a; color: #f1f3ee; text-align: center; font-size: 11px; font-weight: 850; }
.audit-group-toggle { color: #929a91; text-align: center; font-size: 14px; }
.audit-group-list { border-top: 1px solid #2b302b; display: grid; }
.audit-group-empty { padding: 10px 12px; color: #737b72; font-size: 11px; }
.audit-list-item { min-height: 45px; padding: 6px 9px; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; border-top: 1px solid #262b26; }
.audit-list-item:first-child { border-top: 0; }
.audit-list-status { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #303530; color: #c4cac2; font-weight: 900; }
.audit-list-copy { min-width: 0; }
.audit-list-item strong, .audit-list-item small { display: block; }
.audit-list-item strong { font-size: 12px; }
.audit-list-item small { margin-top: 2px; color: #8f978e; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-list-item.not-seen .audit-list-status, .audit-list-item.missing .audit-list-status { background: #473b20; color: #f1ce7f; }
.audit-list-item.excess .audit-list-status { background: #4b3521; color: #f4bd7b; }
.audit-list-item.wrong .audit-list-status { background: #572722; color: #ffaaa0; }
.audit-list-item.unexpected-icon .audit-list-status { background: #4a371d; color: #ffd18b; }
.audit-list-item.ok .audit-list-status { background: #233b25; color: #9ee49b; }
.audit-list-actions { display: flex; align-items: center; justify-content: flex-end; }
.list-complete-button, .list-missing-button { min-width: 44px; min-height: 44px; border: 1px solid #426847; border-radius: 11px; background: #263d28; color: #b6eab2; font-size: 17px; font-weight: 900; cursor: pointer; }
.list-missing-button { min-width: 52px; border-color: #6e572f; background: #352b1b; color: #f1cc78; font-size: 10px; }
.readonly-results { padding-top: 2px; }

.update-link { align-self: center; border: 0; background: transparent; color: #8f988e; padding: 8px 14px; font-size: 13px; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }

.thumbnail-missing { width: 100%; height: 100%; display: grid; place-items: center; padding: 10px; background: #292d29; color: #aeb5ad; font-size: 12px; font-weight: 750; text-align: center; }
.thumbnail-missing.large { min-height: 210px; font-size: 16px; }
.thumbnail-card .thumbnail-time { left: 5px; right: auto; bottom: 5px; }
.thumbnail-card .quantity-badge { position: absolute; top: 5px; right: 5px; min-width: 30px; padding: 4px 7px; border-radius: 9px; background: rgba(10,12,10,.82); color: #f5f7f2; font-size: 12px; line-height: 1; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.64); backdrop-filter: blur(2px); }
.edit-sheet, .issues-sheet, .missing-sheet, .all-items-sheet, .detail-sheet, .summary-sheet { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; width: min(100%, 720px); max-height: min(92dvh, 780px); margin: 0 auto; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 10px 16px max(18px, env(safe-area-inset-bottom)); border: 1px solid #353a35; border-bottom: 0; border-radius: 24px 24px 0 0; background: #191d19; box-shadow: 0 -20px 60px rgba(0,0,0,.38); }
.sheet-handle { width: 46px; height: 5px; border-radius: 999px; margin: 2px auto 14px; background: #4b514a; }
.missing-sheet > strong { display: block; font-size: 17px; }
.missing-sheet > small { display: block; margin-top: 5px; color: #99a298; font-size: 12px; line-height: 1.4; }
.missing-sheet > input { width: 100%; margin-top: 14px; border: 1px solid #414741; border-radius: 14px; background: #101210; color: white; padding: 12px; font: inherit; font-size: 20px; font-weight: 850; text-align: center; outline: none; }
.edit-preview { min-height: 210px; max-height: 38dvh; border-radius: 18px; overflow: hidden; background: #0b0c0b; border: 1px solid #303530; }
.edit-preview img { display: block; width: 100%; height: 100%; max-height: 38dvh; object-fit: contain; }
.quantity-edit-row { display: grid; grid-template-columns: 52px 1fr 52px; gap: 9px; align-items: stretch; margin-top: 14px; }
.quantity-edit-row > button, .seen-editor > button { min-width: 44px; min-height: 44px; border: 1px solid #3a403a; border-radius: 14px; background: #272c27; color: white; font-size: 25px; font-weight: 800; cursor: pointer; }
.quantity-edit-row label { min-width: 0; display: grid; gap: 5px; color: #9da59c; font-size: 12px; }
.quantity-edit-row input, .seen-editor input { width: 100%; min-width: 0; border: 1px solid #3a403a; border-radius: 14px; background: #101210; color: white; padding: 11px 12px; font: inherit; font-size: 18px; font-weight: 800; text-align: center; outline: none; }
.sheet-primary, .update-apply { width: 100%; min-height: 44px; margin-top: 10px; border: 0; border-radius: 15px; padding: 12px 16px; background: #e8f0e4; color: #172016; font-weight: 850; cursor: pointer; }
.sheet-primary:disabled, .update-apply:disabled { opacity: .55; cursor: default; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.sheet-actions button, .file-action { min-height: 46px; display: grid; place-items: center; border: 1px solid #3a403a; border-radius: 14px; background: #242824; color: #eef1eb; font-weight: 750; cursor: pointer; }
.hidden-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sheet-message { margin: 10px 2px 0; color: #aeb6ad; font-size: 13px; text-align: center; line-height: 1.4; }
.sheet-message.error, .inline-field-error { color: #ffb1a6; }
.inline-field-error { margin-top: 8px; padding: 8px 10px; border: 1px solid #6c3b35; border-radius: 11px; background: #34201d; font-size: 12px; line-height: 1.35; }
.immediate-save-note { margin-top: 6px; color: #8f988e; font-size: 11px; text-align: center; }
.sheet-delete { width: 100%; min-height: 44px; margin-top: 16px; border: 1px solid #693a35; border-radius: 14px; padding: 12px; background: #321e1b; color: #ffaaa0; font-weight: 800; cursor: pointer; }
.sheet-close { min-height: 44px; border: 0; background: transparent; color: #aeb5ad; padding: 10px 14px; cursor: pointer; }
.sheet-close:not(.compact) { width: 100%; margin-top: 2px; }
.sheet-close.compact { padding: 8px; }

.audit-quantity { width: 100%; min-width: 0; min-height: 56px; margin: 0; border: 1px solid #3b413b; border-radius: 15px; padding: 8px 10px; background: #202420; color: white; display: grid; grid-template-columns: auto auto 1fr; align-items: center; column-gap: 4px; cursor: pointer; }
.audit-quantity strong { font-size: 25px; line-height: 1; }
.audit-quantity span { color: #b5bcb4; font-size: 16px; font-weight: 750; }
.audit-quantity small { justify-self: end; align-self: center; font-size: 10px; font-weight: 800; text-align: right; }
.audit-quantity.ok { border-color: #315a35; background: #1e3020; }
.audit-quantity.ok small { color: #9ee49b; }
.audit-quantity.missing, .audit-quantity.not-seen { border-color: #725c2b; background: #332a18; }
.audit-quantity.missing small, .audit-quantity.not-seen small { color: #f2cd75; }
.audit-quantity.excess { border-color: #76512d; background: #342418; }
.audit-quantity.excess small { color: #f4bb79; }
.audit-quantity.wrong { border-color: #7d3f38; background: #351f1c; }
.audit-quantity.wrong small { color: #ffaaa0; }
.seen-editor { display: grid; grid-template-columns: 52px minmax(80px,1fr) 52px; gap: 7px; margin: 14px 0 0; }
.seen-editor > button { min-height: 46px; }

.view-all-button { width: calc(100% - 24px); min-height: 44px; margin: 8px 12px 14px; border: 1px solid #353b35; border-radius: 14px; background: #202420; color: #dfe5dc; font-weight: 800; cursor: pointer; }
.all-items-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.all-items-header strong { display: block; font-size: 17px; }
.all-items-header small { display: block; margin-top: 3px; color: #929a91; font-size: 11px; }
.search-label { display: grid; gap: 6px; margin-top: 14px; color: #9ca49b; font-size: 12px; }
.search-label input { width: 100%; min-height: 44px; border: 1px solid #3b413b; border-radius: 13px; background: #101210; color: white; padding: 9px 12px; font: inherit; outline: none; }
.all-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; margin-top: 12px; }
.all-item-card { min-width: 0; min-height: 154px; padding: 8px; border: 1px solid #343934; border-radius: 15px; background: #222622; color: white; display: grid; grid-template-rows: 106px auto auto; gap: 6px; text-align: left; cursor: pointer; }
.all-item-image { min-width: 0; overflow: hidden; border-radius: 11px; background: #0b0c0b; }
.all-item-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.all-item-card > strong { font-size: 14px; }
.all-item-card > small { min-width: 0; color: #9aa299; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-qr { margin-top: 10px; color: #aab2a9; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }

.detail-sheet > .thumbnail-missing.large { margin-bottom: 12px; }
.detail-grid { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 9px 12px; margin-top: 13px; padding: 12px; border: 1px solid #303530; border-radius: 14px; background: #151815; }
.detail-grid span { color: #909990; font-size: 11px; }
.detail-grid strong { min-width: 0; font-size: 12px; text-align: right; }
.full-qr { overflow-wrap: anywhere; user-select: text; }
.detail-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.detail-actions button { min-height: 44px; border: 1px solid #3b413b; border-radius: 13px; background: #252a25; color: #eef1eb; padding: 8px; font-weight: 800; cursor: pointer; }

.summary-sheet > strong { display: block; font-size: 18px; }
.summary-sheet > small { display: block; margin-top: 4px; color: #929a91; font-size: 11px; }
.summary-grid { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 0; margin-top: 14px; overflow: hidden; border: 1px solid #303530; border-radius: 15px; }
.summary-grid span, .summary-grid strong { min-height: 44px; padding: 11px 13px; display: flex; align-items: center; border-top: 1px solid #2a2f2a; }
.summary-grid span:nth-child(-n+2), .summary-grid strong:nth-child(-n+2) { border-top: 0; }
.summary-grid span { color: #b0b7ae; }
.summary-grid strong { justify-content: flex-end; font-size: 17px; }
.summary-actions { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 9px; margin-top: 13px; }
.summary-actions > button { min-height: 46px; margin-top: 0; border: 1px solid #3c433c; border-radius: 14px; background: #252a25; color: #e9ede6; font-weight: 850; cursor: pointer; }
.summary-actions > .sheet-primary { border: 0; background: #e8f0e4; color: #172016; }

.image-zoom-overlay { position: fixed; z-index: 90; inset: 0; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); background: rgba(0,0,0,.93); display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 12px; place-items: center; }
.image-zoom-overlay img { display: block; width: 100%; height: 100%; max-width: min(96vw, 1100px); max-height: calc(100dvh - 86px); object-fit: contain; }
.image-zoom-overlay button { min-width: 88px; min-height: 44px; border: 1px solid #555d55; border-radius: 13px; background: #252a25; color: white; font-weight: 800; cursor: pointer; }

.issues-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.issues-header strong { display: block; font-size: 15px; letter-spacing: .025em; }
.issues-header small { display: block; margin-top: 3px; color: #949d93; font-size: 12px; }
.summary-results { max-height: min(62dvh, 520px); overflow-y: auto; padding: 0; }

.update-screen { min-height: 100dvh; }
.update-card { width: min(calc(100% - 28px), 520px); margin: clamp(36px, 10dvh, 100px) auto 30px; padding: 24px; border: 1px solid #343a34; border-radius: 24px; background: #1b1f1b; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.22); }
.update-symbol { width: 62px; height: 62px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 20px; background: #292e29; color: #e3e9df; font-size: 34px; }
.update-card h2 { margin: 0; font-size: 21px; }
.update-card p { margin: 8px 0 20px; color: #99a298; font-size: 14px; line-height: 1.5; }
.update-apply { background: #b8e7ae; }
.update-progress { margin-top: 16px; color: #b5bdb4; font-size: 13px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.update-progress span { width: 9px; height: 9px; border-radius: 50%; background: #a8df9d; animation: update-pulse 1s ease-in-out infinite alternate; }
.update-message { margin-top: 14px; padding: 11px 12px; border-radius: 13px; background: #252a25; color: #c4cbc2; font-size: 13px; line-height: 1.45; }
.update-message.success { background: #203421; color: #b7e8b3; }
.update-message.warning { background: #3a301c; color: #efd089; }
.update-message.error { background: #3b211e; color: #ffb1a6; }
@keyframes update-pulse { from { opacity: .35; transform: scale(.8); } to { opacity: 1; transform: scale(1.1); } }

#blazor-error-ui { display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; padding: 12px; border-radius: 12px; background: #7d2e29; color: white; z-index: 1000; }
.loading-progress { position: absolute; display: block; width: 72px; height: 72px; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.loading-progress circle { fill: none; stroke: #464d46; stroke-width: .55rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: #dfe7dc; stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%)), 500%; transition: stroke-dasharray .05s ease-in-out; }
.loading-progress-text { position: absolute; inset: calc(50% + 48px) auto auto 50%; transform: translateX(-50%); color: #aab1a9; }

@media (min-width: 760px) {
    .workflow-screen, .session-screen { width: min(720px, 100%); margin: 0 auto; border-inline: 1px solid #222722; }
    .home-action { min-height: 168px; }
    .wrong-button { font-size: 17px; }
}

@media (max-height: 660px) {
    .capture-workflow, .audit-workflow { height: auto; min-height: 100dvh; overflow: visible; }
    .audit-main { min-height: auto; flex: 0 0 auto; }
    .audit-compare-grid { flex: 0 0 auto; }
    .audit-camera-cell, .reference-panel { height: clamp(118px, 29dvh, 190px); }
    .audit-results { flex: 0 0 auto; min-height: 170px; max-height: 42dvh; }
}

@media (max-width: 380px) {
    /* Keep the visible preview half-width while giving html5-qrcode a slightly
       larger logical render surface on very narrow phones. The outer cell still
       clips to its normal bounds, so controls and the reference image do not move. */
    .audit-camera-panel .camera-view {
        width: 120%;
        height: 120%;
        transform: scale(.8333333333);
        transform-origin: center;
    }
}

@media (max-width: 430px) {
    .audit-quantity {
        grid-template-columns: auto 1fr;
        row-gap: 5px;
    }

    .audit-quantity small {
        grid-column: 1 / -1;
        justify-self: start;
        width: 100%;
        min-width: 0;
        text-align: left;
        white-space: nowrap;
        line-height: 1.2;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    .audit-camera-cell, .reference-panel { height: 33dvh; max-height: 33dvh; }
    .audit-camera-panel .camera-view {
        width: 88dvh;
        height: 65dvh;
        transform: scale(.5);
        transform-origin: top center;
    }
    .audit-camera-panel .camera-view video {
        width: min(100cqw, 133.333333cqh) !important;
        height: min(100cqh, 75cqw) !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: contain !important;
    }
    .audit-results { max-height: 46dvh; }
    .edit-preview { min-height: 150px; max-height: 42dvh; }
    .edit-preview img { max-height: 42dvh; }
}
