:root {
  --bg:       #0f0f1a;
  --bg2:      #1a1a2e;
  --bg3:      #252540;
  --border:   #2e2e50;
  --accent:   #6c63ff;
  --accent2:  #a78bfa;
  --text:     #e2e2f0;
  --muted:    #8888aa;
  --keep:     #22c55e;
  --sell:     #ef4444;
  --unsorted: #6b7280;
  --radius:   8px;
  --card-w:   160px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }

/* ── Header ── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.6rem 1rem;
}
.site-logo { font-size: 1.1rem; font-weight: 700; color: var(--accent2); }
.logout-link { font-size: 0.82rem; padding: 4px 10px; }
.site-nav { display: flex; gap: 1rem; }
.site-nav a { color: var(--muted); padding: 0.3rem 0.6rem; border-radius: var(--radius); transition: color .15s; }
.site-nav a.active, .site-nav a:hover { color: var(--text); background: var(--bg3); }
#globalUndo { margin-left: auto; }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 0.4rem 0.9rem; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 600;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .85; }
.btn-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: 0.35rem 0.75rem; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; transition: color .15s, border-color .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 12px; }
.hidden { display: none !important; }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.75rem 1rem;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 45px; z-index: 90;
}
.toolbar input[type=search] {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 0.4rem 0.75rem; border-radius: var(--radius);
  font-size: 14px; width: 220px;
}
.toolbar input[type=search]:focus { outline: none; border-color: var(--accent); }
.toolbar-filters, .toolbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.toolbar select {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 0.35rem 0.6rem; border-radius: var(--radius); font-size: 13px;
}
.count-badge {
  color: var(--muted); font-size: 12px; white-space: nowrap;
}
.value-badge {
  color: var(--accent2); font-weight: 600;
}

/* ── Progress bar ── */
.progress-wrap {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1rem; background: var(--bg2);
}
.progress-inner {
  flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--accent); transition: width .3s; width: 0%; }
#progressLabel { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ── Comic grid ── */
.comic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 1rem;
  padding: 1rem;
}

.comic-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  position: relative;
  display: flex; flex-direction: column;
}
.comic-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.comic-card.selected { border-color: var(--accent2); box-shadow: 0 0 0 2px var(--accent2); }

.card-cover {
  width: 100%; aspect-ratio: 2/3;
  background: var(--bg3);
  overflow: hidden; position: relative;
}
.card-cover img {
  width: 100%; height: 100%; object-fit: cover;
  transition: opacity .2s;
}
.card-cover .no-cover {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px;
}

.status-badge {
  position: absolute; top: 6px; right: 6px;
  padding: 2px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.status-keep    { background: var(--keep);     color: #fff; }
.status-sell    { background: var(--sell);     color: #fff; }
.status-unsorted{ background: var(--unsorted); color: #fff; }

.card-info {
  padding: 0.5rem; flex: 1; display: flex; flex-direction: column; gap: 2px;
}
.card-series { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-issue  { font-size: 11px; color: var(--muted); }
.card-values { display: flex; justify-content: space-between; font-size: 11px; margin-top: 4px; }
.card-values .clz  { color: var(--muted); }
.card-values .ebay { color: var(--accent2); font-weight: 600; }

.card-actions {
  display: flex; gap: 4px; padding: 0.4rem; border-top: 1px solid var(--border);
}
.card-actions button {
  flex: 1; font-size: 10px; padding: 3px 4px; border-radius: 4px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: color .1s;
}
.card-actions button:hover { color: var(--text); border-color: var(--accent); }

/* ── Load more ── */
.load-more { text-align: center; padding: 1.5rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200;
}
.modal {
  position: fixed; inset: 0; z-index: 201;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.modal:not(.hidden) { pointer-events: all; }
.modal-body {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; width: min(92vw, 980px);
  max-height: 90vh; overflow: hidden;
  display: grid; grid-template-columns: 320px 1fr;
  position: relative;
}
.modal-close {
  position: absolute; top: 8px; right: 8px; z-index: 10;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--muted); font-size: 18px; cursor: pointer;
  line-height: 1; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
.modal-cover {
  background: var(--bg3); padding: 1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  border-right: 1px solid var(--border);
}
.modal-cover img { width: 100%; border-radius: 6px; }
.modal-meta {
  font-size: 12px; color: var(--muted); text-align: left;
  width: 100%; overflow-y: auto; max-height: 320px;
}
.meta-row { display: grid; grid-template-columns: 80px 1fr; gap: 6px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.meta-label { color: var(--muted); }
.meta-val { color: var(--text); word-break: break-word; }
.modal-status-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.status-btn {
  padding: 4px 12px; border-radius: 20px; border: none;
  font-size: 12px; font-weight: 700; cursor: pointer; transition: opacity .15s;
}
.status-btn:hover { opacity: .85; }

.modal-ai {
  display: flex; flex-direction: column; padding: 1.25rem; overflow: hidden;
}
.ai-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; flex-shrink: 0; }
.ai-badge {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
}
.ai-disclaimer { color: var(--muted); font-size: 11px; margin-left: auto; }
.ai-output {
  flex: 1; overflow-y: auto; font-size: 13px; line-height: 1.7;
  color: var(--text); white-space: pre-wrap;
  background: var(--bg3); border-radius: var(--radius);
  padding: 0.75rem; min-height: 200px; max-height: 50vh;
}
.ai-followup {
  display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-shrink: 0;
}
.ai-followup input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 0.4rem 0.75rem; border-radius: var(--radius); font-size: 13px;
}
.ai-followup input:focus { outline: none; border-color: var(--accent); }

/* ── Sell table ── */
.sell-table {
  width: 100%; border-collapse: collapse; margin: 0;
}
.sell-table th {
  background: var(--bg2); color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  padding: 0.6rem 0.75rem; text-align: left;
  border-bottom: 1px solid var(--border); position: sticky; top: 90px;
}
.sell-table td {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.sell-table tr:hover td { background: var(--bg2); }
.cover-cell { width: 50px; }
.table-thumb { width: 36px; height: 54px; object-fit: cover; border-radius: 3px; display: block; }
.series-cell { max-width: 260px; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 0.6rem 1.25rem; border-radius: 20px;
  font-size: 13px; z-index: 500; white-space: nowrap;
  animation: fadeIn .2s ease;
}
.toast.error { border-color: var(--sell); color: var(--sell); }
@keyframes fadeIn { from { opacity:0; transform: translateX(-50%) translateY(8px); } }

/* ── Dashboard ── */
.dash-header {
  background: var(--bg2); border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem; display: flex; flex-wrap: wrap; gap: 1rem;
  align-items: center; justify-content: space-between;
}
.dash-totals { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; }
.dash-stat { text-align: center; }
.dash-stat .stat-num { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text); }
.dash-stat .stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dash-stat.highlight .stat-num { color: var(--accent2); font-size: 1.5rem; }
.dash-stat.green  .stat-num { color: var(--keep); }
.dash-stat.yellow .stat-num { color: #f59e0b; }
.dash-stat.grey   .stat-num { color: var(--muted); }

.dash-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dash-actions input[type=search] {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 0.35rem 0.7rem; border-radius: var(--radius); font-size: 13px; width: 160px;
}
.dash-actions input[type=search]:focus { outline: none; border-color: var(--accent); }
.btn-ghost.active { color: var(--text); border-color: var(--accent2); }

.flag-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.flag-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.flag-dot.green  { background: var(--keep); }
.flag-dot.yellow { background: #f59e0b; }
.flag-dot.red    { background: var(--sell); }
.flag-dot.grey   { background: var(--unsorted); }

.dash-table {
  width: 100%; border-collapse: collapse;
}
.dash-table th {
  background: var(--bg2); color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  padding: 0.55rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border);
  position: sticky; top: 45px; white-space: nowrap; cursor: default;
}
.dash-table th.sortable { cursor: pointer; }
.dash-table th.sortable:hover, .dash-table th.sort-active { color: var(--text); }
.dash-table td {
  padding: 0.45rem 0.75rem; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.dash-table tr:hover td { background: var(--bg2); }
.num-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.series-name { font-weight: 600; color: var(--text); }
.issue-sub   { font-size: 11px; color: var(--muted); }

.flag-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.flag-pill.green  { background: rgba(34,197,94,.2);  color: var(--keep); }
.flag-pill.yellow { background: rgba(245,158,11,.2); color: #f59e0b; }
.flag-pill.red    { background: rgba(239,68,68,.2);  color: var(--sell); }
.flag-pill.grey   { background: var(--bg3);          color: var(--muted); }

.override-cell { display: flex; align-items: center; gap: 4px; }
.override-input {
  width: 72px; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 3px 6px; border-radius: 4px; font-size: 12px;
  text-align: right;
}
.override-input:focus { outline: none; border-color: var(--accent); }
.clear-override {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 0 2px; line-height: 1;
}
.clear-override:hover { color: var(--sell); }

.eff-override { color: var(--accent2); font-weight: 700; }
.eff-ebay     { color: var(--text); }
.eff-clz      { color: var(--muted); }

.fetch-btn { min-width: 28px; text-align: center; }

.no-results {
  text-align: center; color: var(--muted); padding: 3rem 1rem; font-size: 14px;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  :root { --card-w: 130px; }
  .toolbar { gap: 0.5rem; }
  .toolbar input[type=search] { width: 140px; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-cover { border-right: none; border-bottom: 1px solid var(--border); flex-direction: row; }
  .modal-cover img { width: 80px; }
  .ai-output { max-height: 30vh; }
}

/* ── Scan page ── */
.scan-page { max-width: 1400px; margin: 0 auto; padding: 2rem 1.25rem; }
.scan-header { margin-bottom: 1.75rem; }
.scan-header h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.scan-subtitle { color: var(--muted); font-size: 1rem; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 2rem;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108,99,255,0.06);
}
.drop-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.drop-text { font-size: 1.1rem; margin-bottom: 0.4rem; }
.drop-link { color: var(--accent2); cursor: pointer; text-decoration: underline; }
.drop-hint { color: var(--muted); font-size: 0.9rem; }

/* Scan queue */
.scan-queue { display: flex; flex-direction: column; gap: 1.75rem; }

/* Desktop: 4-column grid */
.scan-card {
  display: grid;
  grid-template-columns: 170px 1fr 1fr 200px;
  gap: 1.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: opacity 0.3s, border-color 0.2s;
}
.scan-card.scan-confirmed          { border-color: var(--keep); }
.scan-card.scan-skipped            { opacity: 0.3; pointer-events: none; }
.scan-card.scan-card--needs-review { border-color: #f97316; box-shadow: 0 0 0 2px rgba(249,115,22,0.25); }

.scan-col { display: flex; flex-direction: column; gap: 0.6rem; }
.scan-col-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.scan-thumb {
  width: 150px;
  height: 216px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--bg3);
  display: block;
}
.scan-filename { font-size: 0.8rem; color: var(--muted); word-break: break-all; }

/* Vision table */
.vision-table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.vision-table td { padding: 5px 6px; vertical-align: middle; }
.vision-table td:first-child {
  color: var(--muted);
  white-space: nowrap;
  padding-right: 0.75rem;
  font-size: 0.85rem;
  width: 90px;
}
.vision-edit {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 0.95rem;
  width: 100%;
}
.vision-edit:focus { outline: none; border-color: var(--accent); }
.re-search-btn { margin-top: 0.75rem; align-self: flex-start; }

/* Match column */
.match-primary { display: flex; gap: 1rem; }
.match-thumb {
  width: 86px;
  height: 124px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg3);
}
.match-no-thumb {
  width: 86px;
  height: 124px;
  background: var(--bg3);
  border-radius: 4px;
  flex-shrink: 0;
}
.match-info { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.95rem; }
.match-info strong { color: var(--text); font-size: 1rem; line-height: 1.3; }
.match-meta { color: var(--muted); font-size: 0.85rem; }
.match-score { font-size: 0.85rem; font-weight: 700; margin-top: 0.2rem; }
.score-green  { color: var(--keep); }
.score-yellow { color: #facc15; }
.score-red    { color: var(--sell); }
.match-status { font-size: 0.85rem; color: var(--muted); }

.status-chip { font-weight: 700; padding: 2px 8px; border-radius: 99px; font-size: 0.8rem; }
.status-chip.sell     { background: rgba(239,68,68,0.2);  color: var(--sell); }
.status-chip.keep     { background: rgba(34,197,94,0.2);  color: var(--keep); }
.status-chip.unsorted { background: rgba(107,114,128,0.2); color: var(--muted); }

.alt-matches { margin-top: 0.75rem; font-size: 0.9rem; }
.alt-matches summary { cursor: pointer; color: var(--muted); }
.alt-match {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.alt-match .match-thumb { width: 40px; height: 56px; }

/* Pass status spinner */
.pass-status { display: flex; align-items: center; gap: 0.6rem; padding: 0.4rem 0; }
.pass-status-text { font-size: 0.85rem; color: var(--muted); }

/* Google reverse image search match badge */
.google-match-badge {
  background: rgba(52,168,83,0.15);
  border: 1px solid rgba(52,168,83,0.45);
  color: #34a853;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.google-fields-note {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--bg3);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.5rem;
}

/* Manual Google search button */
.google-reverse-btn { color: #34a853; border-color: rgba(52,168,83,0.4); }
.google-reverse-btn:hover { background: rgba(52,168,83,0.1); }

/* Google search result card (manual trigger) */
.google-results { margin-top: 0.75rem; }
.google-match-result {
  background: var(--bg2);
  border: 1px solid rgba(52,168,83,0.3);
  border-radius: 8px;
  padding: 0.75rem;
}
.google-match-inner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0.5rem 0;
}

/* Pass 2 visual match badge */
.pass2-badge {
  background: rgba(167,139,250,0.15);
  border: 1px solid rgba(167,139,250,0.4);
  color: var(--accent2);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Artist cross-reference note */
.artist-xref-note {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--bg3);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.5rem;
}


.none-of-these-btn {
  margin-top: 0.75rem;
  width: 100%;
  color: var(--muted);
  font-size: 0.88rem;
  border-color: var(--border);
}
.none-of-these-btn:hover { color: var(--text); border-color: var(--accent2); }

.match-none-msg { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.5rem; }

.manual-search-wrap { position: relative; margin-top: 0.75rem; }
.manual-search-input {
  width: 100%;
  background: var(--bg3);
  border: 2px solid var(--accent);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 1rem;
}
.manual-search-input:focus { outline: none; border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(108,99,255,0.2); }
.manual-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
}
.search-result-item {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.search-result-item:hover { background: var(--bg3); }
.search-result-empty { color: var(--muted); cursor: default; }
.search-result-thumb {
  width: 36px;
  height: 52px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--bg3);
}
.search-result-thumb--empty { background: var(--bg3); }
.search-result-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.search-result-info strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-variant { font-size: 0.78rem; color: var(--accent2); }
.search-result-meta { font-size: 0.78rem; color: var(--muted); }

/* Visual mismatch banner */
.visual-mismatch-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.4);
  color: var(--sell);
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Low-confidence banner */
.match-low-conf-banner {
  background: rgba(249,115,22,0.15);
  border: 1px solid rgba(249,115,22,0.4);
  color: #f97316;
  border-radius: 4px;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Actions column */
.scan-actions-body { display: flex; flex-direction: column; gap: 0.65rem; }
.scan-actions-body .btn-primary,
.scan-actions-body .btn-ghost {
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  text-align: center;
}
.ebay-locked  { opacity: 0.5; cursor: not-allowed; }
.action-feedback { font-size: 0.88rem; color: var(--keep); }
.scan-none  { color: var(--muted); font-size: 0.9rem; }
.scan-error { color: var(--sell);  font-size: 0.9rem; }

/* Spinner */
.scan-spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0.75rem 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── No-title banner ── */
.no-title-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  color: var(--sell);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

/* ── Vector search (Pass 3) ── */
.vector-search-wrap {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.vector-search-wrap--setup { opacity: 0.85; }
.vector-setup-hint {
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--bg3);
  border-radius: 4px;
  padding: 0.4rem 0.65rem;
  line-height: 1.4;
}
.vector-setup-hint code {
  font-family: monospace;
  color: var(--accent2);
  background: rgba(108,99,255,0.12);
  padding: 1px 4px;
  border-radius: 3px;
}
.vector-search-btn { color: var(--accent2); border-color: rgba(108,99,255,0.4); font-size: 0.88rem; }
.vector-search-btn:hover { border-color: var(--accent2); }
.google-lens-btn   { font-size: 0.85rem; color: var(--muted); }

.vector-searching {
  display: flex; align-items: center; gap: 0.6rem;
  color: var(--muted); font-size: 0.85rem; padding: 0.35rem 0;
}

.vector-results-header {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); margin-bottom: 0.6rem; font-weight: 700;
}

.vector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.65rem;
}
.vector-hit {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}
.vector-hit:hover { border-color: var(--accent2); }
.vector-thumb {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  display: block;
  background: var(--bg2);
}
.vector-thumb--empty { background: var(--bg2); }
.vector-hit-info {
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.vector-hit-title { font-size: 0.78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vector-hit-issue { font-size: 0.75rem; color: var(--muted); }
.vector-hit-info .btn-sm { margin-top: 0.3rem; width: 100%; text-align: center; font-size: 0.75rem; padding: 3px 0; }

/* ── Pricing panel (post-confirm) ── */
.scan-pricing-panel {
  display: block;
  background: var(--bg2);
  border: 1px solid var(--keep);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.pricing-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.pricing-confirmed-badge {
  background: rgba(34,197,94,0.15);
  color: var(--keep);
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 99px;
  padding: 3px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.pricing-title { font-size: 1.15rem; font-weight: 700; margin: 0; }

.pricing-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; display: block; margin-bottom: 0.4rem; }

.pricing-query-row { margin-bottom: 1.25rem; }
.pricing-query-wrap { display: flex; gap: 0.75rem; align-items: stretch; }
.pricing-query-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 1rem;
}
.pricing-query-input:focus { outline: none; border-color: var(--accent); }
.search-ebay-btn { white-space: nowrap; }

/* Results area */
.pricing-results { margin-bottom: 1.5rem; }
.pricing-hint { color: var(--muted); font-size: 0.9rem; }
.pricing-spinner { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.9rem; padding: 0.5rem 0; }

/* Stats grid */
.pricing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.pricing-stat {
  background: var(--bg3);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.pricing-stat--highlight { border: 1px solid rgba(108,99,255,0.5); background: rgba(108,99,255,0.1); }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-val   { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.pricing-stat--highlight .stat-val { color: var(--accent2); }

.pricing-slow-badge {
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.35);
  color: #f97316;
  border-radius: 6px;
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Sales table */
.pricing-table-wrap { overflow-x: auto; }
.pricing-table-header {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pricing-source-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.72rem;
  color: var(--accent2);
  text-transform: none;
  letter-spacing: 0;
}
.pricing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.pricing-table th {
  text-align: left;
  padding: 6px 10px;
  background: var(--bg3);
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.pricing-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.pricing-table tr:last-child td { border-bottom: none; }
.pricing-table td:first-child { font-weight: 700; color: var(--accent2); }
.listing-title-cell { color: var(--muted); font-size: 0.82rem; max-width: 260px; }
.listing-type-badge { font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.listing-type-bin     { background: rgba(34,197,94,0.15);  color: var(--keep); }
.listing-type-auction { background: rgba(108,99,255,0.15); color: var(--accent2); }

/* Price + condition row */
.pricing-actions-row {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.pricing-price-wrap, .pricing-condition-wrap { flex: 1 1 180px; }
.pricing-price-input-row { display: flex; align-items: center; gap: 0; }
.pricing-currency {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-right: none;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: 6px 0 0 6px;
  font-size: 1rem;
}
.pricing-price-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0 6px 6px 0;
  padding: 9px 12px;
  font-size: 1.1rem;
  font-weight: 700;
}
.pricing-price-input:focus { outline: none; border-color: var(--accent); }
.pricing-condition-select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 0.95rem;
}
.pricing-condition-select:focus { outline: none; border-color: var(--accent); }

/* Footer buttons */
.pricing-footer { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.pricing-footer .btn-primary,
.pricing-footer .btn-ghost { flex: 1 1 180px; text-align: center; padding: 0.75rem 1rem; font-size: 0.95rem; }

/* ── Scan responsive: tablet (601-900px) ── */
@media (max-width: 900px) {
  .scan-card {
    grid-template-columns: 170px 1fr;
    grid-template-rows: auto;
  }
  /* Photo stays left; Vision, Match, Actions stack in right column */
  .scan-col-photo    { grid-row: 1 / 4; }
  .scan-col-id       { grid-column: 2; }
  .scan-col-match    { grid-column: 2; }
  .scan-col-actions  { grid-column: 2; }
  .scan-actions-body {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .scan-actions-body .btn-primary,
  .scan-actions-body .btn-ghost { flex: 1 1 140px; }
}

/* ── Scan responsive: mobile (≤600px) ── */
@media (max-width: 600px) {
  .scan-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 1.25rem;
    gap: 1.25rem;
  }
  .scan-col-photo { grid-row: unset; align-items: center; }
  .scan-col-id    { grid-column: 1; }
  .scan-col-match { grid-column: 1; }
  .scan-col-actions { grid-column: 1; order: 4; }
  .scan-thumb {
    width: 100%;
    max-width: 320px;
    height: auto;
    aspect-ratio: 2 / 3;
  }
  .scan-actions-body { flex-direction: column; }
  .scan-actions-body .btn-primary,
  .scan-actions-body .btn-ghost {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
  }
  .vision-table td:first-child { width: 80px; }
}

/* ── Scan intent + grade step ────────────────────────────────────────────────── */
.scan-intent {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.scan-intent .btn-primary,
.scan-intent .btn-ghost { width: 100%; text-align: center; }
.scan-new-badge {
  font-size: 0.75rem;
  color: var(--accent2);
  margin: 0.15rem 0 0;
  line-height: 1.3;
}
.scan-grade-step { display: flex; flex-direction: column; gap: 0.5rem; }
.scan-grade-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}
.scan-grade-skip {
  color: var(--accent2);
  cursor: pointer;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  text-decoration: underline;
}
.grade-row { display: flex; gap: 0.4rem; }
.grade-input {
  flex: 1;
  min-width: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.9rem;
}
.grade-input:focus { outline: none; border-color: var(--accent); }
.scan-confirming {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.25rem 0;
}

/* ── Barcode / UPC lookup ───────────────────────────────────────────────────── */
.barcode-lookup-section {
  margin-bottom: 1.25rem;
}
.barcode-lookup-inner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.barcode-lookup-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}
.barcode-input {
  flex: 1;
  min-width: 220px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: monospace;
}
.barcode-input:focus { outline: none; border-color: var(--accent); }
.barcode-searching {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* ── ComicVine panel ─────────────────────────────────────────────────────────── */
.scan-cv-row {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.25rem;
}
.comicvine-panel {
  background: rgba(108, 99, 255, 0.06);
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}
.comicvine-panel--standalone {
  margin-top: 0.75rem;
}
.cv-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent2);
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 0.5rem;
}
.cv-panel-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.cv-inner {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.cv-cover {
  width: 70px;
  height: 107px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.cv-cover--empty {
  background: var(--bg3);
}
.cv-info { flex: 1; min-width: 0; }
.cv-title { font-size: 0.95rem; margin-bottom: 0.2rem; }
.cv-story-title { font-size: 0.82rem; color: var(--muted); font-style: italic; }
.cv-date { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.cv-credits { font-size: 0.82rem; margin-top: 0.3rem; }
.cv-credit-label { color: var(--muted); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }
.cv-description {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cv-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent2);
}
