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

:root {
  --brand:       #1C5858;
  --brand-light: #2a7a7a;
  --brand-dim:   #e8f2f2;
  --accent:      #e8a020;
  --accent-dim:  #fdf3e0;
  --text:        #1a2233;
  --text-muted:  #6b7694;
  --bg:          #f4f6fb;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --confirm:     #16a34a;
  --confirm-bg:  #dcfce7;
  --reject:      #dc2626;
  --reject-bg:   #fee2e2;
  --pending:     #d97706;
  --pending-bg:  #fef3c7;
  --sidebar-w:   240px;
  --sidebar-collapsed-w: 52px;
  --radius:      12px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
}

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

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--brand);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 300;
  transition: width .22s ease;
  overflow: hidden;
}

.sidebar-logo {
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  min-height: 60px;
}

.sidebar-logo img {
  flex: 1;
  min-width: 0;
  filter: brightness(0) invert(1);
  opacity: .92;
  transition: opacity .2s, width .22s;
}

body.sidebar-collapsed .sidebar-logo {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-logo img {
  display: none;
}

.sidebar-toggle {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  color: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  position: relative;
  top: -2px;
  right: -5px;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.sidebar-toggle svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.nav-item svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-item span { overflow: hidden; transition: opacity .15s; }

.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.18); color: #fff; }

.sidebar-footer {
  padding: 12px 16px;
  flex-shrink: 0;
  overflow: hidden;
}


/* ── Collapsed sidebar ────────────────────────────────────────── */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-w);
}
body.sidebar-collapsed .nav-item span {
  opacity: 0;
  width: 0;
}
body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 9px;
  gap: 0;
}
body.sidebar-collapsed .main {
  margin-left: var(--sidebar-collapsed-w);
}

/* ── Main ─────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  padding: 32px;
  overflow-x: hidden;
  transition: margin-left .22s ease;
}

/* ── Views ────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

.view-header {
  margin-bottom: 28px;
}

.view-header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.view-header p {
  color: var(--text-muted);
  font-size: 13.5px;
}

/* ── Stats Grid ───────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; fill: currentColor; }
.stat-icon.remix                       { background: #dbeafe; color: #1d4ed8; }
.stat-icon.aboutyou                    { background: #fce7f3; color: #9d174d; }
/* Dynamic source icons cycle through a palette by nth-of-type */
.stat-icon.source-icon                 { background: #dbeafe; color: #1d4ed8; }
.stat-card:nth-child(2) .source-icon   { background: #fce7f3; color: #9d174d; }
.stat-card:nth-child(3) .source-icon   { background: #dcfce7; color: #166534; }
.stat-card:nth-child(4) .source-icon   { background: #fef9c3; color: #854d0e; }
.stat-icon.embed     { background: var(--brand-dim); color: var(--brand); }
.stat-icon.matches   { background: var(--pending-bg); color: var(--pending); }
.stat-icon.confirmed { background: var(--confirm-bg); color: var(--confirm); }
.stat-icon.rejected  { background: var(--reject-bg); color: var(--reject); }

.stat-value {
  font-size: 26px; font-weight: 700; color: var(--text); line-height: 1;
}

.stat-label {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* ── Action Panel ─────────────────────────────────────────────── */
.action-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
}

.action-panel h2 {
  font-size: 16px; font-weight: 600; margin-bottom: 4px;
}
.action-panel > p {
  color: var(--text-muted); font-size: 13px; margin-bottom: 20px;
}

.action-buttons {
  display: flex; gap: 12px; flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary  { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--brand-dim); color: var(--brand); }
.btn-accent   { background: var(--accent); color: #fff; }
.btn-confirm  { background: var(--confirm-bg); color: var(--confirm); padding: 6px 14px; font-size: 12.5px; }
.btn-reject   { background: var(--reject-bg); color: var(--reject); padding: 6px 14px; font-size: 12.5px; }
.btn-sm       { padding: 5px 12px; font-size: 12px; }

/* ── Progress ─────────────────────────────────────────────────── */
.progress-container {
  margin-top: 20px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
}

.progress-header {
  display: flex; justify-content: space-between;
  font-size: 13px; font-weight: 500; margin-bottom: 10px;
  color: var(--text);
}

.progress-bar-bg {
  height: 8px; border-radius: 99px;
  background: var(--border); overflow: hidden;
}

.progress-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: 99px;
  transition: width .3s ease;
}

.progress-detail {
  margin-top: 8px; font-size: 12px; color: var(--text-muted);
}

/* ── Filters Row ──────────────────────────────────────────────── */
.filters-row {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}

.filter-tabs {
  display: flex; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px;
}

.tab-btn {
  padding: 6px 16px; border-radius: 6px;
  border: none; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; transition: background .15s, color .15s;
}
.tab-btn.active { background: var(--brand); color: #fff; }
.tab-btn:not(.active):hover:not(:disabled) { background: var(--bg); color: var(--text); }
.tab-btn:disabled { opacity: .35; cursor: not-allowed; }

.filter-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

.filter-select, .filter-input {
  height: 36px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--brand); }
.filter-input { width: 200px; }

.score-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.score-label input[type=range] { width: 100px; accent-color: var(--brand); }

/* ── Products Grid ────────────────────────────────────────────── */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.product-img {
  aspect-ratio: 3/4;
  background: #f8f8f8;
  overflow: hidden;
  position: relative;
}
.product-img img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .3s;
}
.product-card:hover .product-img img { transform: scale(1.04); }
.product-img .no-img {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--border); font-size: 32px;
}

.source-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 8px; border-radius: 99px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.source-badge.remix    { background: #dbeafe; color: #1d4ed8; }
.source-badge.aboutyou { background: #fce7f3; color: #9d174d; }

.product-info {
  padding: 10px 12px 12px;
}
.product-name {
  font-size: 12.5px; font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 4px; line-height: 1.4;
}
.product-brand {
  font-size: 11px; color: var(--text-muted); margin-bottom: 6px;
}
.product-price {
  font-size: 14px; font-weight: 700; color: var(--brand);
}
.product-old-price {
  font-size: 11px; color: var(--text-muted); text-decoration: line-through; margin-left: 6px;
}

/* ── Matches List ─────────────────────────────────────────────── */
.matches-list {
  display: flex; flex-direction: column; gap: 16px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.match-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.match-score-wrap {
  display: flex; align-items: center; gap: 12px;
}

.score-badge {
  padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 700;
}
.score-badge.high   { background: var(--confirm-bg); color: var(--confirm); }
.score-badge.medium { background: var(--pending-bg); color: var(--pending); }
.score-badge.low    { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

.score-bar-inline {
  width: 100px; height: 6px; border-radius: 99px;
  background: var(--border); overflow: hidden;
}
.score-bar-inline-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
}

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

.status-chip {
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.status-chip.pending   { background: var(--pending-bg); color: var(--pending); }
.status-chip.confirmed { background: var(--confirm-bg); color: var(--confirm); }
.status-chip.rejected  { background: var(--reject-bg); color: var(--reject); }

.match-body {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
}

.match-divider {
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px;
  color: var(--text-muted);
}
.match-divider svg { width: 20px; height: 20px; fill: currentColor; }

.match-product {
  padding: 16px;
  display: flex; gap: 14px;
}

.match-product-img {
  width: 80px; height: 100px;
  border-radius: 8px; overflow: hidden;
  background: #f8f8f8; flex-shrink: 0;
}
.match-product-img img {
  width: 100%; height: 100%; object-fit: contain;
}

.match-product-info { flex: 1; min-width: 0; }
.match-product-source {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 4px;
}
.match-product-source.remix    { color: #1d4ed8; }
.match-product-source.aboutyou { color: #9d174d; }

.match-product-name {
  font-size: 13px; font-weight: 500; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 6px; line-height: 1.4;
}
.match-product-meta {
  display: flex; flex-direction: column; gap: 3px;
}
.match-product-meta span {
  font-size: 11.5px; color: var(--text-muted);
}
.match-product-price {
  font-size: 14px; font-weight: 700; color: var(--brand); margin-top: 6px;
}

/* ── Product Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0; bottom: 0;
  background: rgba(0,0,0,.35);
  z-index: 200;
  display: flex; align-items: stretch;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, left .22s ease;
}
body.sidebar-collapsed .modal-overlay {
  left: var(--sidebar-collapsed-w);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  background: var(--surface);
  border-radius: 0;
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  width: 100%;
  height: 100%;
  display: flex; flex-direction: column;
  transform: translateX(24px);
  transition: transform .2s;
  overflow: hidden;
  position: relative;
}
.modal-overlay.open .modal { transform: translateX(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-header p { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.modal-header .tab-btn { padding: 5px 10px; font-size: 12px; }
.modal-header .filter-tabs { gap: 3px; }

/* ── Mix weight controls ──────────────────────────────────────── */
.mix-weights {
  display: flex; gap: 10px; align-items: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s;
}
.mix-weights--active {
  opacity: 1;
  pointer-events: auto;
  border-color: var(--brand);
}
.mix-label-left,
.mix-label-right {
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; display: flex; align-items: center; gap: 3px;
}
.mix-label-left span,
.mix-label-right span {
  display: inline-block; width: 2.4ch;
  text-align: right; font-variant-numeric: tabular-nums;
}
.mix-weights input[type=range] {
  width: 120px; accent-color: var(--brand); cursor: pointer;
}

/* ── Filter drawer button ─────────────────────────────────────── */
.filter-drawer-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap; flex-shrink: 0;
}
.filter-drawer-btn:hover { background: var(--brand-dim); color: var(--brand); border-color: var(--brand); }
.filter-drawer-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.filter-drawer-btn.has-active { border-color: var(--brand); color: var(--brand); }
.filter-drawer-btn.has-active.active { background: var(--brand); color: #fff; }

.filter-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; font-size: 10px; font-weight: 700;
  background: var(--accent); color: #fff; line-height: 1;
}
.filter-count-badge:empty { display: none; }

/* ── Filter drawer ────────────────────────────────────────────── */
.filter-drawer-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.18);
  z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity .22s ease;
}
.filter-drawer-overlay.open { opacity: 1; pointer-events: auto; }

.filter-drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 300px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,.10);
  z-index: 11;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s ease;
}
.filter-drawer.open { transform: translateX(0); }

.filter-drawer-header {
  display: flex; align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 8px;
}
.filter-drawer-title {
  font-size: 14px; font-weight: 700; flex: 1;
}
.filter-clear-all {
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--brand);
  padding: 2px 6px; border-radius: 6px;
  transition: background .12s;
}
.filter-clear-all:hover { background: var(--brand-dim); }
.filter-drawer-close {
  width: 28px; height: 28px; border-radius: 7px;
  border: none; background: var(--bg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; line-height: 1;
  transition: background .15s; flex-shrink: 0;
}
.filter-drawer-close:hover { background: var(--border); color: var(--text); }

.filter-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 20px;
}

.filter-section {
  display: flex; flex-direction: column; gap: 10px;
}
.filter-section-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
}
.filter-chips-row {
  display: flex; flex-wrap: wrap; gap: 7px;
}
.filter-chip {
  padding: 5px 12px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text-muted);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-dim); }
.filter-chip.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

.price-inputs-wrap {
  flex: 1; display: flex; align-items: center; gap: 10px;
}
.price-input-group {
  display: flex; flex-direction: column; gap: 3px;
}
.price-input-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px;
}
.price-stepper {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--bg);
}
.stepper-btn {
  width: 28px; height: 32px; border: none; background: transparent;
  color: var(--text-muted); font-size: 16px; line-height: 1;
  cursor: pointer; flex-shrink: 0; transition: background .12s, color .12s;
}
.stepper-btn:hover { background: var(--border); color: var(--text); }
.price-input-field {
  display: flex; align-items: center;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
}
.price-currency {
  padding: 0 2px 0 6px; font-size: 12px; color: var(--text-muted);
}
.price-input-field input[type=number] {
  width: 64px; height: 32px; border: none; background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 0 6px 0 2px; outline: none;
  -moz-appearance: textfield;
}
.price-input-field input[type=number]::-webkit-outer-spin-button,
.price-input-field input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.price-inputs-sep {
  font-size: 14px; color: var(--text-muted); padding-top: 16px;
}

.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: var(--bg); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 18px; line-height: 1;
  transition: background .15s;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  overflow: hidden;
  flex: 1;
}

.modal-product-panel {
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.modal-product-img {
  width: 100%; aspect-ratio: 3/4;
  border-radius: 10px; overflow: hidden;
  background: #f8f8f8; margin-bottom: 14px;
}
.modal-product-img img { width: 100%; height: 100%; object-fit: contain; }

.modal-product-name {
  font-size: 14px; font-weight: 600; margin-bottom: 4px; line-height: 1.4;
}
.modal-product-brand {
  font-size: 12px; color: var(--text-muted); margin-bottom: 10px;
}
.modal-product-attrs {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
}
.modal-product-attrs .attr {
  display: flex; gap: 6px; font-size: 12px;
}
.modal-product-attrs .attr-key {
  color: var(--text-muted); width: 70px; flex-shrink: 0;
}
.modal-product-attrs .attr-val { color: var(--text); font-weight: 500; }
.modal-product-price {
  font-size: 18px; font-weight: 700; color: var(--brand);
}
.modal-product-sku {
  font-size: 11px; color: var(--text-muted);
  margin-top: 4px; font-family: monospace;
}

.llm-desc-block {
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.llm-desc-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}
.llm-desc-block p {
  font-size: 12.5px; line-height: 1.7;
  color: var(--text);
}

.modal-similar-panel {
  overflow-y: auto; padding: 20px;
}

.modal-similar-panel h3 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 14px;
}

.similar-sort-bar {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.similar-sort-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-right: 2px; white-space: nowrap;
}

.sort-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  background: var(--bg); color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.sort-btn:hover {
  background: var(--brand-dim); color: var(--brand);
  border-color: var(--brand);
}
.sort-btn.active {
  background: var(--brand); color: #fff;
  border-color: var(--brand);
}

.sort-arrow {
  width: 12px; height: 12px; flex-shrink: 0;
  fill: currentColor;
}

.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.similar-card {
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  cursor: default;
  transition: box-shadow .15s;
  position: relative;
}
.similar-card:hover { box-shadow: var(--shadow-md); }
.similar-card { cursor: pointer; }
.similar-card.selected {
  box-shadow: 0 0 0 2px var(--brand), var(--shadow-md);
  background: var(--brand-dim);
}

.similar-card-img {
  aspect-ratio: 3/4;
  background: #f8f8f8; overflow: hidden;
  margin: 8px 8px 0;
  border-radius: 6px;
}
.similar-card-img img {
  width: 100%; height: 100%; object-fit: contain;
  transition: transform .3s;
}
.similar-card:hover .similar-card-img img { transform: scale(1.04); }

.similar-score {
  position: absolute; top: 6px; right: 6px;
  padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(4px);
}
.similar-score.high   { color: var(--confirm); }
.similar-score.medium { color: var(--pending); }
.similar-score.low    { color: var(--text-muted); }

.similar-card-info {
  padding: 8px 10px 10px;
  display: flex; flex-direction: column; flex: 1;
}
.similar-card-name {
  font-size: 11.5px; font-weight: 500;
  line-height: 1.35; flex: 1;
}
.similar-card-price-row {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border);
}
.similar-card-price {
  font-size: 15px; font-weight: 800; color: var(--brand); white-space: nowrap;
}
.price-diff {
  display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 99px; max-width: 100%;
}
.price-diff-abs   { font-weight: 800; }
.price-diff-sep   { opacity: .5; }
.price-diff-pct   { opacity: .85; }
.price-diff-label { opacity: .7; font-weight: 600; }
.price-diff-up   { background: #fce7f3; color: #9d174d; }
.price-diff-down { background: #dcfce7; color: #166534; }
.price-diff-same { background: var(--border); color: var(--text-muted); }

.modal-loading {
  display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--text-muted); font-size: 13px;
}

/* ── 1:1 Comparison panel ─────────────────────────────────────── */
.comparison-panel {
  display: grid;
  grid-template-columns: 1fr 2px 1fr;
  gap: 0;
  margin-bottom: 20px;
  margin-top: 20px;
  border-top: 2px solid var(--brand-dim);
  padding-top: 16px;
  height: 235px;
  overflow-y: auto;
  position: relative;
}
.comparison-close {
  position: absolute;
  top: 18px; right: 4px;
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  background: var(--bg); color: var(--text-muted);
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 2;
}
.comparison-close:hover { background: var(--border); color: var(--text); }

.comparison-divider {
  background: var(--border);
  margin: 0 16px;
  border-radius: 2px;
}

.comparison-col {
  padding: 0 16px;
}

.comparison-col-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}

.comparison-role {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted);
}

.comparison-match {
  font-size: 11px; font-weight: 700;
  background: var(--brand); color: #fff;
  padding: 2px 8px; border-radius: 99px;
}

.comparison-product-row {
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 14px;
}

.comparison-thumb {
  width: 64px; height: 80px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--bg);
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.comparison-thumb-empty {
  width: 64px; height: 80px;
  border-radius: 6px;
  background: var(--bg);
  flex-shrink: 0;
}

.comparison-product-name {
  font-size: 13px; font-weight: 600;
  line-height: 1.35; margin-bottom: 6px;
}

.comparison-product-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.comparison-price {
  font-size: 14px; font-weight: 700; color: var(--brand);
}

.comparison-sku {
  font-size: 11px; color: var(--text-muted);
  font-family: monospace; margin-top: 3px;
}

.comparison-desc-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}

.comparison-desc-text {
  font-size: 12.5px; line-height: 1.7; color: var(--text);
}

.no-desc {
  font-size: 12px; color: var(--text-muted); font-style: italic;
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 24px; flex-wrap: wrap;
}

.page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer; transition: background .15s;
}
.page-btn:hover:not(:disabled) { background: var(--brand-dim); border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Analytics ───────────────────────────────────────────────── */
.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.akpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}
.akpi-card::after {
  content: '';
  position: absolute; inset: 0;
  opacity: .04;
  pointer-events: none;
}
.akpi-remix  { border-left-color: var(--brand); }
.akpi-remix::after  { background: var(--brand); }

.akpi-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px;
}
.akpi-value {
  font-size: 28px; font-weight: 800;
  color: var(--text); line-height: 1.1; margin-bottom: 4px;
}
.akpi-sub {
  font-size: 11.5px; color: var(--text-muted);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  min-width: 0;
}
.chart-card--full {
  grid-column: 1 / -1;
}
.chart-card--row-span {
  grid-row: span 2;
}

.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.chart-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin-bottom: 3px;
}
.chart-subtitle {
  font-size: 12px; color: var(--text-muted);
}
.chart-legend {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  white-space: nowrap; flex-shrink: 0;
}
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.legend-remix   { background: var(--brand); }
.legend-ay      { background: var(--accent); }

/* ── Toast ────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1a2233; color: #fff;
  padding: 12px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 999; max-width: 320px;
}
.toast.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.toast.error { background: var(--reject); }
.toast.success { background: var(--confirm); }

/* ── Infinite scroll sentinel ─────────────────────────────────── */
.products-sentinel {
  grid-column: 1 / -1;
}
.products-end {
  text-align: center; padding: 24px;
  font-size: 12.5px; color: var(--text-muted);
  border-top: 1px solid var(--border); margin-top: 8px;
}

/* ── Login Screen ─────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f2f2f 0%, #1C5858 60%, #2a7a7a 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  padding: 44px 48px;
  width: 100%;
  max-width: 420px;
}
.login-logo {
  margin-bottom: 28px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo img { height: 36px; }
.login-title {
  font-size: 24px; font-weight: 800; color: var(--text);
  text-align: center; margin-bottom: 6px;
}
.login-subtitle {
  font-size: 13px; color: var(--text-muted);
  text-align: center; margin-bottom: 32px;
}
.login-field {
  margin-bottom: 18px;
}
.login-field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .4px;
}
.login-field input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--bg);
  transition: border-color .15s;
  outline: none;
}
.login-field input:focus { border-color: var(--brand); }
.login-error {
  background: #fef2f2; border: 1px solid #fecaca;
  color: #dc2626; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 16px;
}
.login-btn {
  width: 100%; padding: 12px;
  background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.login-btn:hover:not(:disabled) { background: var(--brand-light); }
.login-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Sidebar user ──────────────────────────────────────────────── */
.sidebar-user {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-top: 1px solid rgba(255,255,255,.12);
  gap: 8px;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px; color: var(--text-muted);
}
body.sidebar-collapsed .sidebar-user-info { display: none; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 10px 0; }
.sidebar-logout {
  flex-shrink: 0; width: 30px; height: 30px;
  border: none; background: transparent; border-radius: 6px;
  color: rgba(255,255,255,.55); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: background .15s;
}
.sidebar-logout:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-logout svg { width: 18px; height: 18px; fill: currentColor; }

/* ── User Home ─────────────────────────────────────────────────── */

/* ── Review Queue ─────────────────────────────────────────────── */

/* Full-viewport layout — no page scroll */
#view-queue.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px); /* 64px = main's 32px top + 32px bottom padding */
  overflow: hidden;
}

/* ── Top bar ── */
.queue-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  margin-bottom: 14px;
}
.queue-kpis {
  display: flex; align-items: center; gap: 0;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.queue-kpi {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 10px 20px;
  border-right: 1px solid var(--border);
}
.queue-kpi:last-child { border-right: none; }
.queue-kpi span { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1; }
.queue-kpi label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.queue-kpi--confirm span { color: var(--confirm); }
.queue-kpi--reject  span { color: var(--reject); }
.queue-kpi--progress { padding: 10px 20px; min-width: 140px; gap: 5px; align-items: stretch; }
.queue-progress-bar { height: 6px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.queue-progress-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }
.queue-kpi--progress label { color: var(--brand); font-weight: 700; font-size: 11px; }

.queue-mix-inline {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 16px;
  white-space: nowrap;
}
.queue-mix-inline span { display: flex; align-items: center; gap: 3px; }
.queue-mix-inline strong {
  display: inline-block; width: 2.4ch;
  text-align: right; font-variant-numeric: tabular-nums;
}
.queue-mix-inline input[type=range] { width: 120px; accent-color: var(--brand); cursor: pointer; }

/* ── Arena (flex col: comparison + actions) ── */
.queue-arena {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  min-height: 0;
}

/* ── Comparison row ── */
.queue-comparison {
  flex: 1;
  display: flex;
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}

/* Source card — left, fixed width */
.queue-source-card {
  width: 230px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); border-top: 3px solid var(--brand);
  overflow: hidden;
}
.queue-source-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--brand);
  padding: 10px 12px 6px; flex-shrink: 0;
}
.queue-product { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.queue-product-img {
  flex: 1; min-height: 0;
  background: var(--bg);
}
.queue-product-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.queue-product-meta {
  flex-shrink: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
}
.queue-product-name  { font-size: 12px; font-weight: 600; margin-bottom: 3px; line-height: 1.3; }
.queue-product-brand { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.queue-product-price { font-size: 14px; font-weight: 800; color: var(--brand); margin-bottom: 6px; }
.queue-product-tags  { display: flex; flex-wrap: wrap; gap: 3px; }
.queue-product-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 99px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}

/* Candidates — horizontal scroll row */
.queue-candidates-scroll {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  padding-bottom: 4px; /* room for scrollbar */
}
.queue-candidates-scroll::-webkit-scrollbar { height: 4px; }
.queue-candidates-scroll::-webkit-scrollbar-track { background: transparent; }
.queue-candidates-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

.queue-candidate {
  width: 210px;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius);
  border: 2px solid var(--border);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
}
.queue-candidate:hover  { border-color: var(--brand); box-shadow: var(--shadow-md); }
.queue-candidate.selected { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }

.queue-candidate-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; flex-shrink: 0;
}
.queue-candidate-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0;
}
.queue-candidate.selected .queue-candidate-num { background: var(--brand); color: #fff; border-color: var(--brand); }
.queue-candidate-score {
  font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 99px; background: var(--brand); color: #fff; display: inline-block;
}
.queue-candidate-img {
  flex: 1; min-height: 0; background: var(--bg);
}
.queue-candidate-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.queue-candidate-body {
  flex-shrink: 0; padding: 8px 10px 10px; border-top: 1px solid var(--border);
}
.queue-candidate-name { font-size: 12px; font-weight: 600; line-height: 1.3; margin-bottom: 3px; }
.queue-candidate-meta { font-size: 11px; color: var(--text-muted); }
.queue-candidate-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }

/* ── Actions bar ── */
.queue-actions {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.queue-btn {
  padding: 10px 28px; font-size: 14px; font-weight: 700;
  border-radius: 10px; border: none; cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.queue-btn:active { transform: scale(.97); }
.queue-btn-confirm { background: var(--confirm); color: #fff; }
.queue-btn-confirm:hover { box-shadow: 0 4px 14px rgba(22,163,74,.35); }
.queue-btn-reject  { background: var(--reject);  color: #fff; }
.queue-btn-reject:hover  { box-shadow: 0 4px 14px rgba(220,38,38,.35); }
.queue-btn-skip    { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }
.queue-btn-skip:hover { background: var(--bg); }
.queue-hints {
  margin-left: auto; display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
}
.queue-hints kbd {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 10px; font-family: monospace; font-weight: 700; color: var(--text);
}
.queue-done {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.queue-done h2 { font-size: 24px; color: var(--brand); margin-bottom: 8px; }

/* ── Settings ─────────────────────────────────────────────────── */
.nav-item--settings { margin-top: 0; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 420px));
  gap: 24px;
}
.settings-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px;
}
.settings-card-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 24px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.settings-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand-dim); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.settings-card-icon svg { width: 20px; height: 20px; }
.settings-card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.settings-card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-field label { font-size: 13px; font-weight: 600; color: var(--text); }
.settings-field input {
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 14px; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.settings-field input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}
.settings-form-error {
  font-size: 13px; color: var(--reject);
  background: var(--reject-bg); border-radius: 8px; padding: 10px 12px;
}
.settings-form-success {
  font-size: 13px; color: var(--confirm);
  background: var(--confirm-bg); border-radius: 8px; padding: 10px 12px;
}
.settings-btn {
  padding: 11px 20px; background: var(--brand); color: #fff;
  border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, box-shadow .15s;
  align-self: flex-start;
}
.settings-btn:hover { background: var(--brand-light); box-shadow: 0 4px 14px rgba(28,88,88,.3); }
.settings-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Loading ──────────────────────────────────────────────────── */
.loading-spinner {
  grid-column: 1 / -1;
  text-align: center; padding: 48px;
  color: var(--text-muted); font-size: 13px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center; padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 48px; height: 48px; fill: var(--border);
  display: block; margin: 0 auto 12px;
}
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }
