/* Barcode scanner overlay and comp results. Shared by the homepage (site.css tokens) and the member app (app.css tokens). */
dialog.scan-ov {
  --cx-acc: var(--accent, var(--green));
  --cx-acc-ink: var(--accent-ink, var(--on-green));
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; box-shadow: none;
  background: rgba(0, 0, 0, .86); padding: 16px; box-sizing: border-box;
}
dialog.scan-ov[open] { display: flex; align-items: center; justify-content: center; }
dialog.scan-ov::backdrop { background: transparent; }
.scan-box { width: min(480px, 100%); display: flex; flex-direction: column; gap: 12px; color: #fff; font-family: var(--f-body, system-ui, sans-serif); }
.scan-cam { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: #000; }
.scan-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 22% 10%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-frame i { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #ff4d4d; box-shadow: 0 0 8px #ff4d4d; animation: scan-line 1.8s ease-in-out infinite; }
@keyframes scan-line { 0%, 100% { transform: translateY(-34px); } 50% { transform: translateY(34px); } }
@media (prefers-reduced-motion: reduce) { .scan-frame i { animation: none; } }
.scan-msg { margin: 0; font-size: 15px; line-height: 1.45; text-align: center; min-height: 2.9em; }
.scan-cam.hit .scan-frame { border-color: #3DDC97; }
.scan-cam.hit .scan-frame i { display: none; }
.scan-torch { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(0, 0, 0, .55); color: #fff; }
.scan-torch svg { width: 16px; height: 16px; fill: currentColor; }
.scan-torch[aria-pressed="true"] { background: #FFD84D; color: #1a1a1a; }
.scan-torch[hidden] { display: none; }
.scan-btn { font: inherit; font-weight: 600; font-size: 15px; padding: 11px 16px; border-radius: 10px; border: 0; cursor: pointer; }
.scan-bar { display: flex; gap: 8px; }
.scan-btn { flex: 1; text-align: center; background: rgba(255, 255, 255, .14); color: #fff; }
.scan-btn:hover, .scan-btn:focus-within { background: rgba(255, 255, 255, .24); }

/* Results */
.cx {
  --cx-acc: var(--accent, var(--green));
  --cx-acc-ink: var(--accent-ink, var(--on-green));
  --cx-soft: var(--accent-soft, var(--green-soft));
  --cx-card: var(--surface, var(--paper));
  --cx-card-2: var(--surface-2, var(--panel));
  --cx-bad: var(--bad, var(--was));
  display: flex; flex-direction: column; gap: 14px; color: var(--ink); text-align: left;
}
.cx-head { display: flex; gap: 14px; align-items: flex-start; }
.cx-img { flex: none; width: 84px; height: 84px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.cx-img img { width: 100%; height: 100%; object-fit: contain; }
.cx-img svg { width: 40px; height: 40px; fill: none; stroke: var(--faint); stroke-width: 1.6; }
.cx-head h3 { margin: 0 0 4px; font-family: var(--f-display, inherit); font-size: 18px; line-height: 1.25; overflow-wrap: anywhere; }
.cx-sub, .cx-src { margin: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.cx-src { color: var(--faint); font-size: 12px; margin-top: 2px; }
.cx-sold { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-go { flex: 1 1 220px; text-align: center; text-decoration: none; font-weight: 700; padding: 12px 14px; border-radius: 10px; background: var(--cx-acc); color: var(--cx-acc-ink); }
.cx-go.alt { flex: 0 1 auto; font-weight: 600; background: var(--cx-soft); color: var(--ink); }
.cx-go:hover { filter: brightness(1.06); }
.cx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cx-stats > div { background: var(--cx-card-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-stats span, .cx-stats small { font-size: 12px; color: var(--muted); }
.cx-stats b { font-size: 20px; font-variant-numeric: tabular-nums; }
.cx-fine, .cx-none { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.cx-none { margin: 0; font-size: 14px; }
.cx-calc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--cx-card); }
.cx-calc label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cx-in { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); color: var(--ink); font-weight: 600; }
.cx-in input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 16px; padding: 9px 0; outline: none; }
.cx-in:focus-within { border-color: var(--cx-acc); }
.cx-out { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.45; }
.cx-pos { color: var(--cx-acc); }
.cx-neg { color: var(--cx-bad); }
.cx-items summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.cx-items ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow: auto; }
.cx-items a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 6px; border-radius: 8px; }
.cx-items a:hover { background: var(--cx-card-2); }
.cx-items img, .cx-items a > span:first-child { flex: none; width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 6px; }
.cx-it { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.cx-it > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-it small { color: var(--muted); font-weight: 400; }
.cx-more { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.cx-more a { color: var(--muted); }
.cx-more a:hover { color: var(--ink); }
.cx-load { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 8px 0; }
.cx-load::before { content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent, var(--green)); animation: cx-spin .8s linear infinite; }
@keyframes cx-spin { to { transform: rotate(360deg); } }
.cx-err { color: var(--bad, var(--was)); font-size: 14px; margin: 0; }
@media (max-width: 520px) {
  .cx-stats { grid-template-columns: 1fr 1fr; }
  .cx-stats > div:last-child { grid-column: 1 / -1; }
  .cx-calc { grid-template-columns: 1fr; }
  .cx-img { width: 64px; height: 64px; }
}

/* Homepage comp checker section */
section.check { padding: 56px 0; }
.check-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px 48px; align-items: start; }
@media (min-width: 900px) { .check-in { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
section.check h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; margin-top: 10px; }
.check-copy > p:last-child { margin-top: 12px; color: var(--muted); max-width: 34em; }
.check-tool { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; display: grid; gap: 16px; }
.check-form { display: grid; gap: 10px; }
.check-tool, .check-form { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 380px) { .check-tool { padding: 14px; } }
.check-scan { width: 100%; font-size: 17px; padding: 14px 18px; }
.check-scan svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.check-q { display: flex; gap: 8px; }
.check-q input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.check-q input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.check-hint, .check-more { margin: 0; font-size: 13.5px; color: var(--muted); }
.scan-auto { display: flex; align-items: center; gap: 9px; font-size: 14.5px; color: var(--ink); cursor: pointer; user-select: none; }
.scan-auto input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent, var(--green)); }
.check-more { margin-top: 14px; }
.check-more a { color: var(--green); font-weight: 600; }
