/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #ffffff;
  min-height: 100vh;
  font-size: 14px;
}

/* ── Scrollbars ──────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #BF5700; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #D4621A; }

/* ── Header ──────────────────────────────────────────── */
header {
  background: #111111;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #2a2a2a;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

#steps-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-pill {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.06);
  transition: all 0.2s;
  white-space: nowrap;
}

.step-pill.active {
  background: #BF5700;
  color: #fff;
}

.step-pill.done {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.6);
}

.step-arrow {
  color: rgba(255,255,255,0.2);
  font-size: 18px;
}

/* ── Main Layout ──────────────────────────────────────── */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 24px;
}

.step-section { display: none; }
.step-section.active { display: block; }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  background: #BF5700;
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #D4621A; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary.btn-large { padding: 14px 36px; font-size: 16px; border-radius: 10px; }

.btn-secondary {
  background: #2a2a2a;
  color: #fff;
  border: 1px solid #3a3a3a;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: #333333; border-color: #555; color: #fff; }

/* ── Step 1: Dropzone ────────────────────────────────── */
#dropzone {
  background: #1a1a1a;
  border: 3px solid #BF5700;
  border-radius: 16px;
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 28px;
}
#dropzone:hover { border-color: #D4621A; background: #1e1710; }
#dropzone.drag-over {
  border-color: #D4621A;
  background: #1e1710;
}

.dz-icon { font-size: 52px; margin-bottom: 14px; }
.dz-title { font-size: 20px; font-weight: 700; color: #ffffff; margin-bottom: 8px; }
.dz-hint { font-size: 13px; color: #888888; margin-bottom: 24px; }

#select-files-btn {
  background: #BF5700;
  color: #fff;
  border: none;
  padding: 12px 32px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
#select-files-btn:hover { background: #D4621A; }

/* ── Pairs Header ────────────────────────────────────── */
#pairs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
#pairs-header h2 { font-size: 16px; color: #CCCCCC; font-weight: 700; }

#add-more-btn {
  background: #2a2a2a;
  border: 1px solid #BF5700;
  color: #BF5700;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
#add-more-btn:hover { background: #BF5700; color: #fff; }

/* ── Pair Cards Grid ─────────────────────────────────── */
#pairs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.pair-card {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.pair-card:hover { border-color: #333333; }

.pair-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pair-label {
  font-size: 12px;
  font-weight: 800;
  color: #BF5700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.pair-delete {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.pair-delete:hover { background: #2a1010; color: #e00; }

.pair-images {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.pair-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.side-tag {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  color: #fff;
}
.side-tag.front { background: #BF5700; }
.side-tag.back  { background: #444; }

.pair-thumb-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
  background: #111;
  cursor: pointer;
}
.pair-thumb-img:hover { border-color: #BF5700; }

.pair-thumb-missing {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #333;
  border-radius: 6px;
  color: #444;
  font-size: 11px;
  text-align: center;
  padding: 8px;
}

.pair-filename {
  font-size: 9px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  text-align: center;
}

.swap-col {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.swap-btn {
  background: #222;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.swap-btn:hover { background: #2a2a2a; color: #BF5700; }

#step1-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ── Step 2: Progress ────────────────────────────────── */
.center-panel {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 56px 40px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid #2a2a2a;
}

.center-panel h2 {
  font-size: 22px;
  margin-bottom: 28px;
  color: #ffffff;
}

#prog-track {
  background: #2a2a2a;
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}

#prog-bar {
  background: linear-gradient(90deg, #BF5700, #D4621A);
  height: 100%;
  width: 0%;
  border-radius: 100px;
  transition: width 0.35s ease;
}

#prog-text {
  color: #888888;
  font-size: 14px;
  margin-bottom: 20px;
}

#prog-log {
  text-align: left;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-row {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.log-row.waiting  { background: #222; color: #666; }
.log-row.running  { background: #1e1710; color: #BF5700; }
.log-row.ok       { background: #0d1f12; color: #4caf50; }
.log-row.err      { background: #1f0d0d; color: #ef5350; }

/* ── Step 4: Review Table ────────────────────────────── */
.review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 12px;
}

.review-toolbar h2 { font-size: 18px; color: #ffffff; font-weight: 800; }

.review-actions { display: flex; gap: 10px; }

.table-hint {
  font-size: 12px;
  color: #555;
  margin-bottom: 10px;
}

#table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 310px);
  background: #1a1a1a;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  border: 1px solid #2a2a2a;
}

#review-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1500px;
  font-size: 12px;
}

#review-table thead th {
  background: #111111;
  color: rgba(255,255,255,0.75);
  padding: 11px 9px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  border-right: 1px solid rgba(255,255,255,0.05);
  border-bottom: 2px solid #BF5700;
}
#review-table thead th:last-child { border-right: none; }

#review-table tbody tr { transition: background 0.1s; }
#review-table tbody tr:nth-child(odd)  { background: #1a1a1a; }
#review-table tbody tr:nth-child(even) { background: #222222; }
#review-table tbody tr:hover { background: #261c12; }

#review-table td {
  padding: 7px 9px;
  border-bottom: 1px solid #222;
  vertical-align: middle;
  border-right: 1px solid #222;
  color: #CCCCCC;
}
#review-table td:last-child { border-right: none; }

/* Column widths */
.col-thumb  { width: 72px; min-width: 72px; }
.col-title  { min-width: 380px; }
.col-xs     { min-width: 50px; width: 60px; }
.col-sm     { min-width: 70px; width: 80px; }
.col-md     { min-width: 110px; }
.col-player { min-width: 130px; }
.col-sku    { min-width: 90px; width: 100px; }

/* Thumbnails */
.tbl-thumb {
  width: 54px;
  height: 72px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  cursor: pointer;
  display: block;
  background: #111;
}
.tbl-thumb:hover { border-color: #BF5700; }

/* Editable cells */
[contenteditable="true"] {
  display: block;
  outline: none;
  border-radius: 4px;
  padding: 3px 5px;
  min-height: 22px;
  transition: background 0.1s, box-shadow 0.1s;
  white-space: normal;
  word-break: break-word;
  color: #CCCCCC;
}
[contenteditable="true"]:hover:not(:focus) { background: #261c12; }
[contenteditable="true"]:focus {
  background: #1e1710;
  box-shadow: 0 0 0 2px #BF5700;
  color: #ffffff;
}

/* Title cell */
.title-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 5px;
}

.title-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.title-text {
  font-size: 11.5px;
  line-height: 1.4;
}

.source-badge {
  display: inline-block;
  font-size: 10px;
  color: #4caf50;
  background: #0d1f12;
  border: 1px solid #2a4a2a;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.title-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding-top: 3px;
}

.title-counter {
  font-size: 10px;
  color: #4caf50;
  white-space: nowrap;
  font-weight: 700;
}
.title-counter.warn { color: #BF5700; }
.title-counter.over { color: #ef5350; }
td.title-over { background: #1f0d0d !important; }

.regen-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #444;
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.regen-btn:hover { background: #261c12; color: #BF5700; }

/* SKU input */
.sku-input {
  width: 88px;
  border: 1px solid #333;
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 12px;
  font-family: inherit;
  background: #2a2a2a;
  color: #ffffff;
  transition: border-color 0.1s, box-shadow 0.1s;
}
.sku-input:focus {
  outline: none;
  border-color: #BF5700;
  box-shadow: 0 0 0 2px rgba(191,87,0,0.3);
}

/* Selects & checkboxes */
.rc-select {
  border: 1px solid #333;
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  background: #2a2a2a;
  color: #ffffff;
}
.rc-select:focus { outline: none; border-color: #BF5700; }

.ultra-cb {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #BF5700;
}

td.center { text-align: center; }

/* ── Lightbox ─────────────────────────────────────────── */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox[hidden] { display: none; }

#lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.92);
}

#lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  z-index: 1;
}

#lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(191,87,0,0.7);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
#lightbox-close:hover { background: #BF5700; }

/* ── Settings Panel ───────────────────────────────────── */
#settings-panel {
  background: #1a1a1a;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.s-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #888888;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.s-field input[type="date"],
.s-field input[type="time"],
.s-field input[type="number"],
.s-field select {
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  color: #ffffff;
  background: #2a2a2a;
  height: 34px;
  transition: border-color 0.15s;
}

.s-field input:focus,
.s-field select:focus {
  outline: none;
  border-color: #BF5700;
  background: #2a2a2a;
  box-shadow: 0 0 0 2px rgba(191,87,0,0.25);
}

.s-field input[type="number"] { width: 90px; }
.s-field input[type="date"]   { width: 148px; }
.s-field input[type="time"]   { width: 110px; }
.s-field select               { width: 150px; }

.s-input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  background: #2a2a2a;
  height: 34px;
  transition: border-color 0.15s;
}
.s-input-prefix:focus-within {
  border-color: #BF5700;
  box-shadow: 0 0 0 2px rgba(191,87,0,0.25);
}
.s-input-prefix span {
  padding: 0 8px;
  font-size: 13px;
  color: #888;
  font-weight: 700;
  border-right: 1px solid #333;
  height: 100%;
  display: flex;
  align-items: center;
}
.s-input-prefix input {
  border: none !important;
  background: transparent !important;
  width: 70px;
  padding: 6px 8px !important;
  height: 100% !important;
  color: #ffffff;
}

/* ── Settings header (toggle + DB status) ──────────────── */
.settings-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 0;
}

.settings-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #CCCCCC;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.settings-toggle-btn:hover { color: #BF5700; }

#settings-body { margin-top: 12px; }

.db-status-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#db-status-text {
  font-size: 12px;
  color: #888888;
  white-space: nowrap;
}

.btn-refresh {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #CCCCCC;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-refresh:hover { background: #333; border-color: #BF5700; color: #fff; }
.btn-refresh:disabled { opacity: 0.4; cursor: default; }

/* ── Drag-to-reorder ─────────────────────────────────────── */
.col-drag {
  width: 28px;
  min-width: 28px;
}

.drag-handle {
  cursor: grab;
  color: #444;
  font-size: 14px;
  letter-spacing: -2px;
  text-align: center;
  user-select: none;
  transition: color 0.1s;
}
.drag-handle:hover { color: #888; }
.drag-handle:active { cursor: grabbing; }

tr.dragging { opacity: 0.45; }
tr.drag-over td { background: #261c12 !important; border-top: 2px solid #BF5700; }

/* ── Start-time column ───────────────────────────────────── */
.col-endtime {
  min-width: 148px;
  width: 158px;
}

.start-time-input {
  font-size: 11px;
  color: #aaaaaa;
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  width: 144px;
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
}
.start-time-input:hover {
  color: #BF5700;
}

/* ── Per-card Price column ───────────────────────────────── */
.col-price {
  min-width: 90px;
  width: 100px;
}

.price-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  background: #2a2a2a;
  height: 28px;
  transition: border-color 0.15s;
  width: 80px;
}
.price-wrap:focus-within { border-color: #BF5700; }
.price-wrap span {
  padding: 0 6px;
  font-size: 12px;
  color: #888;
  font-weight: 700;
  border-right: 1px solid #333;
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.price-input {
  border: none !important;
  background: transparent !important;
  width: 52px;
  padding: 0 5px !important;
  font-size: 12px;
  font-family: inherit;
  height: 100%;
  outline: none;
  color: #ffffff;
}

/* ── Step 3: Card Identification ─────────────────────────── */
.id-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}
.id-toolbar h2 { font-size: 18px; font-weight: 800; color: #ffffff; }
.id-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.id-hint {
  font-size: 13px;
  color: #888888;
  margin-bottom: 18px;
}

/* Panel */
.id-panel {
  background: #1a1a1a;
  border-radius: 14px;
  border: 2px solid #2a2a2a;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  transition: border-color 0.2s;
}
.id-panel.confirmed { border-color: #2a4a2a; }

.id-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 18px;
  background: #111111;
  border-bottom: 1px solid #2a2a2a;
}
.id-card-label { font-size: 13px; font-weight: 800; color: #ffffff; }

.id-panel-status { display: flex; align-items: center; gap: 10px; }

.id-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.id-status-badge.pending   { background: #222; color: #666; }
.id-status-badge.confirmed { background: #0d1f12; color: #4caf50; }
.id-status-badge.manual    { background: #1e1710; color: #BF5700; }
.id-status-badge.consensus { background: #0d1325; color: #5b8dee; }

.id-comparing-spinner {
  font-size: 11px;
  color: #BF5700;
  font-style: italic;
}

/* Body layout */
.id-panel-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
}

.id-user-col {
  padding: 16px;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #111111;
}
.id-col-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.id-col-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #555;
  align-self: flex-start;
  margin: 0;
}

.id-ebay-img-search {
  font-size: 10px;
  font-weight: 700;
  color: #BF5700;
  text-decoration: none;
  padding: 2px 7px;
  border: 1px solid #BF5700;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.id-ebay-img-search:hover {
  background: #BF5700;
  color: #fff;
}

.id-user-img {
  width: 130px;
  height: 170px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #2a2a2a;
  background: #0f0f0f;
  cursor: pointer;
  transition: border-color 0.15s;
}
.id-user-img:hover { border-color: #BF5700; }
.id-user-img-missing {
  width: 130px; height: 170px;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed #333; border-radius: 6px;
  color: #444; font-size: 12px; text-align: center;
}

.id-ai-summary { font-size: 11px; color: #888888; text-align: center; line-height: 1.5; }
.id-query-lbl  { font-size: 10px; color: #555; text-align: center; line-height: 1.4; word-break: break-word; }

/* Matches column */
.id-matches-col {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.id-no-results {
  font-size: 13px;
  color: #555;
  font-style: italic;
  padding: 20px 0;
}

.id-matches-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual match card */
.id-match {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #2a2a2a;
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}
.id-match:hover          { border-color: #3a3a3a; background: #222; }
.id-match.selected       { border-color: #2a4a2a; background: #0d1f12; }

.id-match-thumb { flex-shrink: 0; }
.id-match-img {
  width: 64px;
  height: 84px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid #2a2a2a;
  background: #111;
  cursor: pointer;
  display: block;
}
.id-match-img:hover { border-color: #BF5700; }
.id-match-img-missing {
  width: 64px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed #333; border-radius: 4px;
  color: #444; font-size: 11px;
}

.id-match-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; }

.id-match-title {
  font-size: 11.5px;
  color: #CCCCCC;
  line-height: 1.4;
  word-break: break-word;
}

.id-match-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.id-match-price { font-size: 12px; font-weight: 800; color: #4caf50; }
.id-trusted-badge {
  font-size: 10px;
  font-weight: 700;
  background: #1e1710;
  border: 1px solid #BF5700;
  color: #BF5700;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.id-seller { font-size: 10px; color: #555; }

/* Confidence bar */
.id-confidence {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 14px;
}
.id-conf-bar {
  height: 6px;
  border-radius: 3px;
  flex: 1;
  background: #2a2a2a;
  overflow: hidden;
  position: relative;
}
.id-conf-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  width: inherit;
  transition: width 0.4s ease;
}
.id-confidence.high .id-conf-bar { background: linear-gradient(90deg, #BF5700, #D4621A); }
.id-confidence.mid  .id-conf-bar { background: linear-gradient(90deg, #7a4400, #BF5700); }
.id-confidence.low  .id-conf-bar { background: #333; }
.id-conf-label { font-size: 10px; font-weight: 700; color: #666; white-space: nowrap; min-width: 28px; }

.id-match-actions { display: flex; align-items: center; gap: 8px; }

.id-select-btn {
  background: #BF5700;
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.id-select-btn:hover { background: #D4621A; }
.id-match.selected .id-select-btn { background: #2a7d32; }
.id-match.selected .id-select-btn:hover { background: #388e3c; }

.id-ebay-link {
  font-size: 11px;
  color: #BF5700;
  text-decoration: none;
  white-space: nowrap;
}
.id-ebay-link:hover { text-decoration: underline; color: #D4621A; }

.id-show-more-btn {
  background: none;
  border: none;
  color: #BF5700;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}
.id-show-more-btn:hover { text-decoration: underline; color: #D4621A; }

.id-none-row { border-top: 1px dashed #2a2a2a; padding-top: 10px; }
.id-none-btn {
  background: none;
  border: none;
  color: #555;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.id-none-btn:hover { color: #888; text-decoration: underline; }

/* eBay badge in review table */
.source-badge.ebay-badge {
  background: #1e1710;
  border-color: #BF5700;
  color: #BF5700;
}

/* ── Alert bar (refractor detected, serial conflict) ─── */
.id-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid #2a2a2a;
}
.id-alert {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.refractor-alert {
  background: linear-gradient(90deg, #0d1f1a, #0d1325);
  color: #5b8dee;
  border: 1px solid #2a4a7a;
}
.conflict-alert {
  background: #1e1710;
  color: #BF5700;
  border: 1px solid #5a3000;
}
.jersey-alert {
  background: #111820;
  color: #6aabde;
  border: 1px solid #1e3a5a;
}

/* ── Refractor match highlighting ───────────────────── */
.id-match.refractor-match {
  border: 1.5px solid #2a4a7a;
  background: linear-gradient(135deg, #0d1325 0%, #0d1f1a 100%);
}
.id-refractor-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: linear-gradient(90deg, #0d1325, #0d1f1a);
  color: #5b8dee;
  border: 1px solid #2a4a7a;
}
.id-base-warn {
  display: inline-block;
  font-size: 10px;
  color: #555;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid #333;
}
.id-visual-match-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  background: #2a1400;
  color: #BF5700;
  border: 1px solid #BF5700;
}

/* ── Serial conflict note in review table ─────────── */
.conflict-note {
  cursor: help;
  font-size: 12px;
}

/* ── Disabled regen button ───────────────────────── */
.regen-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Mouse-drag reorder ──────────────────────────── */
tr.drag-source {
  opacity: 0.25;
  background: #111;
}
tr.drag-over {
  outline: 2px solid #BF5700;
  background: #261c12;
}
tr.drag-over td { background: transparent; }
.drag-handle {
  cursor: grab;
  user-select: none;
}
.drag-handle:active {
  cursor: grabbing;
}

/* ── Dashboard ───────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.dashboard-nav-btn {
  background: transparent;
  border: 1.5px solid #BF5700;
  color: #BF5700;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.dashboard-nav-btn:hover { background: #BF5700; color: #fff; }
.dashboard-nav-btn.active { background: #BF5700; color: #fff; }

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-title {
  font-size: 22px;
  font-weight: 700;
  color: #f0f0f0;
  margin: 0;
}
.dash-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-updated-text {
  font-size: 12px;
  color: #555;
}
.dash-local-badge {
  font-size: 11px;
  background: #2a1a00;
  color: #e07000;
  border: 1px solid #5a3000;
  border-radius: 4px;
  padding: 2px 8px;
}

/* Summary cards row */
.dash-summary-row {
  display: flex;
  gap: 14px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.dash-card {
  flex: 1 1 160px;
  background: #161616;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 18px 20px;
}
.dash-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
  margin-bottom: 8px;
}
.dash-card-value {
  font-size: 26px;
  font-weight: 700;
  color: #bbb;
  line-height: 1;
  margin-bottom: 6px;
}
.dash-card-value.primary { color: #BF5700; }
.dash-card-value.secondary { color: #888; }
.dash-card-sub {
  font-size: 12px;
  color: #444;
}

/* Sections */
.dash-section {
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.dash-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555;
  margin: 0 0 16px 0;
}
.dash-period {
  font-weight: 400;
  font-size: 11px;
  text-transform: none;
  color: #444;
}

/* Bar chart */
.dash-chart-wrap { position: relative; }
.dash-bar-wrap   { height: 200px; }

/* Bottom two-column layout */
.dash-bottom-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.dash-donut-section {
  flex: 0 1 280px;
  min-width: 220px;
}
.dash-donut-wrap {
  height: 180px;
  max-width: 180px;
  margin: 0 auto 16px;
}
.dash-right-section {
  flex: 1 1 300px;
}

/* Donut legend */
.dash-legend { display: flex; flex-direction: column; gap: 8px; }
.dash-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.dash-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-legend-label { flex: 1; color: #888; }
.dash-legend-val   { color: #BF5700; font-weight: 600; font-size: 11px; }

/* Weekly comparison */
.dash-wk-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
}
.dash-wk-col { flex: 1; }
.dash-wk-label { font-size: 11px; color: #555; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.dash-wk-val   { font-size: 22px; font-weight: 700; color: #bbb; }
.dash-wk-val.secondary { color: #555; }
.dash-wk-sub   { font-size: 11px; color: #444; margin-top: 4px; }
.dash-wk-arrow { font-size: 18px; font-weight: 700; text-align: center; min-width: 52px; color: #555; }
.dash-wk-arrow.dash-up   { color: #CC2200; }
.dash-wk-arrow.dash-down { color: #2a8a3a; }

.dash-wk-detail { border-top: 1px solid #1e1e1e; padding-top: 12px; }
.dash-stat-row  { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.dash-stat-lbl  { font-size: 12px; color: #555; }
.dash-stat-val  { font-size: 13px; font-weight: 600; color: #BF5700; }
.dash-stat-val.secondary { color: #444; }

/* Top sessions */
.dash-sessions-wrap { display: flex; flex-direction: column; gap: 6px; }
.dash-session-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #181818;
  font-size: 12px;
}
.dash-session-row:last-child { border-bottom: none; }
.dash-session-date  { flex: 1; color: #777; }
.dash-session-cards { color: #555; min-width: 70px; }
.dash-session-cost  { font-weight: 600; color: #BF5700; min-width: 80px; text-align: right; }

.dash-empty {
  color: #444;
  font-size: 13px;
  margin: 0;
  padding: 12px 0;
}

.btn-sm {
  font-size: 11px;
  padding: 4px 10px;
}

/* ── Condition column ────────────────────────────────── */
.col-condition { width: 90px; text-align: center; }
.col-adspend   { width: 76px; text-align: center; }

.condition-select, .adspend-select {
  background: #1a1a1a;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  width: 70px;
  appearance: none;
  -webkit-appearance: none;
  text-align: center;
  outline: none;
}
.condition-select:hover,  .adspend-select:hover  { border-color: #BF5700; }
.condition-select:focus,  .adspend-select:focus  { border-color: #BF5700; box-shadow: 0 0 0 2px rgba(191,87,0,0.25); }
.condition-select option, .adspend-select option { background: #1a1a1a; color: #e0e0e0; }

/* ── Extra Photos (multi-photo per card) ─────────────── */
.pair-extras {
  padding: 8px 10px;
  border-top: 1px solid #222;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
}
.pair-extras-strip {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.extra-thumb-wrap {
  position: relative;
  display: inline-block;
}
.extra-thumb-img {
  width: 36px !important;
  height: 36px !important;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid #444;
  cursor: pointer;
}
.extra-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 14px;
  height: 14px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.extra-remove:hover { background: #e74c3c; }
.add-extra-btn {
  background: #1e1e1e;
  color: #BF5700;
  border: 1px dashed #BF5700;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.add-extra-btn:hover { background: #2a2a2a; }
.extra-full-label { font-size: 11px; color: #666; }

.extra-add-btn {
  width: 26px; height: 26px; border-radius: 50%;
  background: #BF5700; color: #fff; border: none;
  font-size: 17px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s; padding: 0;
}
.extra-add-btn:hover { background: #d96200; }
.extra-count-label { font-size: 11px; color: #BF5700; white-space: nowrap; }

/* ── Extra Photos Modal ───────────────────────────────────── */
#extra-modal {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
#extra-modal[hidden] { display: none; }
#extra-modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.82); }
#extra-modal-box {
  position: relative; z-index: 1;
  background: #1a1a1a; border: 1px solid #333; border-radius: 12px;
  padding: 24px 28px; width: 480px; max-width: 94vw;
  display: flex; flex-direction: column; gap: 16px;
}
#extra-modal-title { margin: 0; font-size: 15px; color: #e0e0e0; font-weight: 600; }
#extra-dz {
  border: 2px dashed #444; border-radius: 8px;
  padding: 36px 16px; text-align: center;
  color: #666; font-size: 13px; cursor: default;
  transition: border-color 0.15s, background 0.15s;
}
#extra-dz.drag-over { border-color: #BF5700; background: rgba(191,87,0,0.06); color: #BF5700; }
#extra-thumb-row { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; }
.extra-modal-wrap { position: relative; }
.extra-modal-thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 4px; border: 1px solid #444; cursor: pointer; display: block;
}
.extra-modal-remove {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px; background: #c0392b; color: #fff;
  border: none; border-radius: 50%; font-size: 10px;
  cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.extra-modal-remove:hover { background: #e74c3c; }
#extra-modal-footer { display: flex; justify-content: flex-end; }
#extra-done-btn {
  background: #BF5700; color: #fff; border: none;
  border-radius: 6px; padding: 8px 24px; font-size: 13px; cursor: pointer;
}
#extra-done-btn:hover { background: #d96200; }

/* ── Photo classification loading notice ─────────────────── */
.classifying-notice {
  font-size: 12px;
  color: #BF5700;
  padding: 8px 12px;
  font-style: italic;
  animation: pulse-opacity 1s ease-in-out infinite alternate;
}
@keyframes pulse-opacity { from { opacity: 0.5; } to { opacity: 1; } }

/* ── Extras toggle button (review table back cell) ───────── */
.extras-toggle {
  display: block;
  margin-top: 4px;
  width: 100%;
  background: none;
  border: 1px dashed #444;
  border-radius: 4px;
  color: #888;
  font-size: 10px;
  padding: 2px 4px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.extras-toggle:hover { border-color: #BF5700; color: #BF5700; }

/* ── Extras expanded row ─────────────────────────────────── */
.extras-row-cell {
  padding: 6px 12px !important;
  background: #141414;
}
.extras-thumb-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.extra-tbl-thumb {
  width: 40px;
  height: 54px;
  object-fit: contain;
  border-radius: 3px;
  border: 1px solid #2a2a2a;
  cursor: pointer;
  background: #111;
}
.extra-tbl-thumb:hover { border-color: #BF5700; }

/* ── Toast notification ──────────────────────────────── */
#toast-msg {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e1e1e;
  color: #f97316;
  border: 1px solid #f97316;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
}
#toast-msg.toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
