/* QR Code Scanner — the same look as OCR and as the dev tools (/tools/dev/app.css): dark by default, light when the system is light. */
[hidden] { display: none !important; }
:root {
  --bg: #0e0f11; --panel: #131416; --panel2: #17181b; --hover: #1c1d21; --active: #22242a; --border: #25272c; --border2: #2f3238;
  --fg: #e8e9eb; --muted: #8b9098; --faint: #5d626b; --accent: #6e79d6; --accent-fg: #fff; --accent-soft: rgba(110,121,214,.16);
  --ok: #4cb782; --warn: #f2c94c; --err: #eb5757; --code: #0b0c0e; --sel: rgba(110,121,214,.28);
  --fs: 13px; --row: 30px; --sidebar: 232px;
  color-scheme: dark;
}
html.sys-light {
  --bg: #fbfbfc; --panel: #f4f5f7; --panel2: #ffffff; --hover: #eceef1; --active: #e4e7ec; --border: #e3e5ea; --border2: #d3d7de;
  --fg: #1c1d20; --muted: #5f6672; --faint: #8e95a1; --accent: #5561c7; --accent-soft: rgba(85,97,199,.12); --code: #f1f2f5; --sel: rgba(85,97,199,.2);
  --ok: #1f8f5f; --warn: #a77a00; --err: #cc3a3a; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--fs)/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
::selection { background: var(--sel); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
h2 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* shell */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.app.collapsed { grid-template-columns: minmax(0, 1fr); }
.app.collapsed .sidebar { display: none; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 600; }
.brand .logo { width: 20px; height: 20px; border-radius: 5px; flex: none; }
.brand small { color: var(--faint); font-weight: 400; margin-left: auto; }
.nav { overflow: auto; padding: 0 6px 8px; flex: 1; min-height: 0; }
.nav h6 { margin: 14px 8px 4px; font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; }
.nav a { display: flex; align-items: center; gap: 8px; height: var(--row); padding: 0 8px; border-radius: 6px; color: var(--muted); white-space: nowrap; text-decoration: none; }
.nav a:hover { background: var(--hover); color: var(--fg); }
.nav a[aria-current="page"] { background: var(--active); color: var(--fg); }
.nav .dot { width: 6px; height: 6px; border-radius: 2px; background: var(--accent); flex: none; visibility: hidden; }
.nav a[aria-current="page"] .dot { visibility: visible; }
.nav .nt { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav .cnt { color: var(--faint); font-size: 11.5px; }
.nav .cnt:not(:empty) { background: var(--panel2); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.sidefoot { border-top: 1px solid var(--border); padding: 6px; display: grid; gap: 4px; }
.sidepromo { margin: 4px 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel2); display: grid; gap: 4px; }
.sidepromo .sp-head { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.sidepromo .sp-link { display: grid; gap: 1px; text-decoration: none; color: inherit; padding: 3px 4px; border-radius: 6px; }
.sidepromo .sp-link b { font-size: 12.5px; color: var(--accent); } .sidepromo .sp-link span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.sidepromo .sp-link:hover { background: var(--hover); }
.back { padding: 4px 8px; font-size: 12.5px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 8px; border-bottom: 1px solid var(--border); flex: none; min-width: 0; }
.crumb { color: var(--muted); display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 1 auto; white-space: nowrap; }
.crumb a { color: var(--muted); } .crumb b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.crumbnote { color: var(--muted); font-size: 12.5px; min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbnote:not(:empty)::before { content: "—"; margin-right: 8px; color: var(--faint); }
.spacer { flex: 1; }
.topacts { display: flex; gap: 6px; flex: none; }
.view { flex: 1; min-height: 0; overflow: auto; padding: 20px 24px 32px; outline: none; }
.scrim { position: fixed; inset: 0; z-index: 19; background: rgba(0,0,0,.45); }
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 20; transform: translateX(-100%); transition: transform .15s; }
  .app.navopen .sidebar { transform: none; }
  .crumbnote { display: none; }
  .view { padding: 14px 12px 24px; }
  .topacts .btn { padding: 0 8px; }
}

/* buttons, inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border2); background: var(--panel2); border-radius: 6px; cursor: pointer; white-space: nowrap; color: var(--fg); text-decoration: none; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 500; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--fg); }
.btn.danger { color: var(--err); }
.btn.mini { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.big { height: 36px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
input[type=search], input[type=number] { height: 30px; background: var(--bg); border: 1px solid var(--border2); border-radius: 6px; padding: 0 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.next { margin-top: 12px; }
.seggrp { display: inline-flex; flex-wrap: wrap; }
.seg { height: 28px; padding: 0 10px; border: 1px solid var(--border2); background: var(--panel2); color: var(--fg); cursor: pointer; margin-left: -1px; }
.seg:first-child { border-radius: 6px 0 0 6px; margin-left: 0; } .seg:last-child { border-radius: 0 6px 6px 0; }
.seg[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); position: relative; }
.seg[disabled] { opacity: .45; cursor: not-allowed; }
.keep { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }

/* cards, callouts */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin: 0 0 16px; }
.card p { margin: 0 0 10px; color: var(--muted); }
.callout { border: 1px solid var(--border); border-left: 3px solid var(--warn); background: var(--panel); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.callout b { color: var(--fg); }
.callout.ok { border-left-color: var(--ok); }
.empty { color: var(--muted); padding: 30px 0; }
h3.sec { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin: 18px 0 8px; }
.consentnote { font-size: 12.5px; border: 1px solid var(--border); border-left: 3px solid var(--warn); background: var(--panel); border-radius: 8px; padding: 10px 12px; color: var(--muted); max-width: 820px; }

/* Scan */
.drop { border: 2px dashed var(--border2); border-radius: 12px; padding: 48px 18px; text-align: center; cursor: pointer; margin: 0 0 12px; background: var(--panel); }
.drop:hover, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop .dicon { font-size: 30px; color: var(--accent); line-height: 1; margin-bottom: 8px; }
.drop .dt { font-weight: 600; font-size: 15px; }
.drop .ds { color: var(--muted); margin-top: 4px; }
.drop.locked { opacity: .5; cursor: not-allowed; border-style: dotted; }
.drop.locked:hover { border-color: var(--border2); }
.limits { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.dropcover { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--accent) 22%, transparent); border: 3px dashed var(--accent); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; color: var(--fg); pointer-events: none; }

/* Results */
.fbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.fbar input[type=search] { flex: 1; min-width: 200px; max-width: 420px; }
.keepnote { margin: 0 0 12px; max-width: 900px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.fcard { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: inherit; text-decoration: none; }
.fcard:hover { border-color: var(--accent); text-decoration: none; }
.fthumb { width: 72px; height: 90px; object-fit: cover; object-position: top; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }
.fmeta { display: grid; gap: 2px; min-width: 0; align-content: start; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsnip { color: var(--faint); font-size: 12px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* settings */
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); max-width: 1000px; }
.srow .stext { display: grid; gap: 2px; }
.srow.flash { background: var(--accent-soft); border-radius: 6px; }
@media (max-width: 760px) { .srow { grid-template-columns: 1fr; gap: 8px; } }

/* link check */
.linktip { position: fixed; z-index: 60; max-width: 330px; padding: 6px 10px; border-radius: 8px; background: var(--panel2); color: var(--fg); border: 1px solid var(--border2); border-left: 3px solid var(--faint); box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 12px; pointer-events: none; }
.linktip.v-ok { border-left-color: var(--ok); } .linktip.v-warn { border-left-color: var(--warn); } .linktip.v-danger { border-left-color: var(--err); }
.dlg { border: 1px solid var(--border2); border-radius: 12px; background: var(--panel); color: var(--fg); padding: 16px 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.dlg-head h2 { flex: 1; margin: 0; }
.dlg .x { border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
.dlg-foot { margin-top: 14px; }
.ld-url { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; background: var(--code); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; }
.ld-state { padding: 10px 12px; border-radius: 6px; border-left: 3px solid var(--faint); background: var(--panel2); }
.ld-state.v-ok { border-left-color: var(--ok); } .ld-state.v-warn { border-left-color: var(--warn); } .ld-state.v-danger { border-left-color: var(--err); }
.ld-state ul, .ld-state ol { margin: 6px 0 0; padding-left: 20px; font-size: 12.5px; }
.hops li { overflow-wrap: anywhere; }

/* footer: 3 lines like the dev tools */
.status { display: flex; flex-direction: column; padding: 2px 16px; border-top: 1px solid var(--border); color: var(--faint); font-size: 11.5px; flex: none; }
.status .ft-line { display: flex; gap: 14px; align-items: center; height: 22px; min-width: 0; white-space: nowrap; }
.status .ft-line > * { flex: none; }
.status .ft-t, .status .spacer { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status .ft-note, .status .ft-promo { color: var(--muted); }
.status .ft-promo b { color: var(--fg); font-weight: 600; }
.status .ft-ic { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 9.5px; font-weight: 700; border: 1px solid currentColor; color: var(--faint); }
.status .ft-promo .ft-ic { border: 0; color: var(--accent); font-size: 11px; }
.status .ft-bar { border-top: 1px dashed var(--border); }
.status .lock { color: var(--ok); flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status .ft-btn { border: 0; background: none; color: inherit; font: inherit; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
.status .ft-ver { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
@media (max-width: 1150px) { .status .ft-kept { display: none; } }
@media (max-width: 760px) { .status { padding: 2px 10px; } .status .lock, .status .ft-engine { display: none; } .status .ft-line { gap: 10px; } }

/* folders, new files */
.fcrumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 10px; color: var(--faint); }
.fcard.folder { border-style: dashed; }
.ficon { font-size: 26px; color: var(--accent); }
.chip { justify-self: start; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border2); color: var(--muted); }
.chip.new, .nav .cnt.new { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
details summary { cursor: pointer; color: var(--muted); }
pre { overflow: auto; font-size: 12px; background: var(--code); border: 1px solid var(--border); border-radius: 6px; padding: 10px; max-height: 320px; }

/* scan results: the picture with numbered boxes beside the codes */
.scanview { max-width: 1400px; }
.drop.compact { padding: 18px; }
.drop.compact .dicon { display: none; }
.busy { color: var(--muted); margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.busy::before { content: "◌"; color: var(--accent); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 14px; }
.scan.none { grid-template-columns: 120px minmax(0, 1fr); align-items: center; }
@media (max-width: 900px) { .scan, .scan.none { grid-template-columns: 1fr; } }
.shead { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; min-width: 0; }
.shead b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 100%; }
.pic { position: relative; align-self: start; background: #fff; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); line-height: 0; }
.pic img, .pic canvas { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.pic svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pic svg polygon { fill: rgba(110,121,214,.18); stroke: #4f5bd5; stroke-width: 3; vector-effect: non-scaling-stroke; }
.pic svg polygon.hl { fill: rgba(242,201,76,.35); stroke: #e0a800; }
.pic svg circle { fill: #4f5bd5; }
.pic svg text { fill: #fff; font-weight: 700; font-family: Inter, system-ui, sans-serif; }
.codes { display: grid; gap: 10px; min-width: 0; align-content: start; }
.code { border: 1px solid var(--border); border-radius: 8px; background: var(--panel2); padding: 10px 12px; min-width: 0; }
.code.hl { border-color: var(--accent); }
.chead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.num { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #4f5bd5; color: #fff; font-weight: 700; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.kind { font-weight: 600; }
.chip { justify-self: start; font-size: 11px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--border2); color: var(--muted); }
.flds { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0 0 8px; }
.flds dt { color: var(--muted); } .flds dd { margin: 0; overflow-wrap: anywhere; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 520px) { .flds { grid-template-columns: 1fr; } .flds dd { margin-bottom: 4px; } }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 8px; }
.raw { font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin: 0; max-height: 220px; overflow: auto; }
.rawhead { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 2px 0 4px; color: var(--faint); font-size: 11.5px; }
.rawhead .rl { text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
@media (max-width: 760px) { .crumb a, .crumb span { display: none; } }
.warnline { color: var(--warn); font-size: 12.5px; margin: 0 0 6px; }

/* camera */
.cam { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; max-width: 1400px; }
@media (max-width: 900px) { .cam { grid-template-columns: 1fr; } }
.cam.off { grid-template-columns: 1fr; }
.stage[hidden] { display: none; }
.camctl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 10px; }
.camctl select { height: 28px; max-width: 100%; background: var(--panel2); border: 1px solid var(--border2); border-radius: 6px; padding: 0 6px; }
.stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; line-height: 0; min-height: 200px; }
.stage video { width: 100%; height: auto; display: block; }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage svg polygon { fill: rgba(76,183,130,.25); stroke: #4cb782; stroke-width: 4; vector-effect: non-scaling-stroke; }
.stage .aim { position: absolute; inset: 18% 22%; border: 2px dashed rgba(255,255,255,.45); border-radius: 12px; pointer-events: none; }
.camstate { color: var(--muted); margin: 8px 0; }
.cammode { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; margin: 0 0 10px; }
.cammode .modehelp { flex-basis: 100%; margin: 0; }
.stage:not(.live) .aim { display: none; }
.stage:not(.live):not(.still) { min-height: 96px; }
.stage:not(.live) video { display: none; }
.stage.still video { display: none; }
.stage img.still { width: 100%; height: auto; display: block; }
.camvid { margin: 0 0 14px; }
.vprog { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 10px 12px; }
.vprog .vhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin: 0 0 6px; }
.vprog progress { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 5px; background: var(--active); overflow: hidden; accent-color: var(--accent); }
.vprog progress::-webkit-progress-bar { background: var(--active); border-radius: 5px; }
.vprog progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
.vprog progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.vprog p { margin: 6px 0 0; }
.vfile .acts { margin: 8px 0; }
.vfile .pic img { max-height: 360px; width: auto; max-width: 100%; }

/* history */
.fbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.hcard { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px; color: inherit; text-decoration: none; align-items: start; }
.hcard:hover { border-color: var(--accent); text-decoration: none; }
.hthumb { width: 72px; height: 72px; object-fit: contain; border-radius: 4px; background: #fff; border: 1px solid var(--border); }
.hmeta { display: grid; gap: 2px; min-width: 0; }
.hsnip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.foundhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.foundhead .sec { margin: 0; }
