/* ============================================================
   Compare products — picker, side-by-side table, best choice,
   regional + town quality assessment. Matches the checkout.css
   card language (Poppins, navy, soft blue cards).
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}
body {
  margin: 0;
  background: linear-gradient(135deg, #f4f7fb 0%, #eef2f8 100%);
  color: #17324d;
  font-family: "Poppins", "Segoe UI", sans-serif;
}

.cmp-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 60px;
}

/* ---------------- top bar ---------------- */
.cmp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.cmp-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand-navy-700, var(--brand-navy-700));
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.cmp-back:hover { color: #ff8011; }
.cmp-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-navy-700, var(--brand-navy-700));
}
.cmp-brand em {
  font-style: normal;
  color: #ff8011;
  font-weight: 700;
}
.cmp-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-navy-700, var(--brand-navy-700)), #0a7fb5);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.cmp-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: #33536f;
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 99px;
  padding: 6px 13px;
}

.cmp-alert {
  background: var(--warning-tint);
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ---------------- cards ---------------- */
.cmp-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: 20px;
  padding: 22px 24px;
  box-shadow: 0 12px 32px rgba(16, 54, 86, 0.08);
  margin-bottom: 20px;
}
.cmp-card-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--brand-navy-700, var(--brand-navy-700));
}
.cmp-card-title small {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #7b97af;
  margin-top: 3px;
}
.cmp-loading { color: #7b97af; font-size: 0.9rem; padding: 14px 2px; }
.cmp-empty { color: #7b97af; font-size: 0.9rem; padding: 14px 2px; }

/* ---------------- picker grid ---------------- */
.cmp-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 175px), 1fr));
  gap: 10px;
  margin-top: 14px;
  min-width: 0;
}
.cmp-pick {
  position: relative;
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  border: 1.5px solid var(--neutral-200);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  background: #fbfdff;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.cmp-pick:hover { border-color: #b9cfe2; transform: translateY(-1px); }
.cmp-pick.on { border-color: #0a7d4e; background: #f0faf5; }
.cmp-pick input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cmp-pick-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  background: #e8eef5;
}
.cmp-pick-img.ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9db3c7;
  font-weight: 700;
  font-size: 1.5rem;
}
.cmp-pick-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cmp-pick-name {
  font-size: 0.76rem;
  font-weight: 600;
  color: #17324d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-pick-meta {
  font-size: 0.68rem;
  color: #7b97af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-pick-price {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand-navy-700, var(--brand-navy-700));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-pick-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #c7d6e4;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 12px;
}
.cmp-pick.on .cmp-pick-check {
  background: #0a7d4e;
  border-color: #0a7d4e;
}

/* ---------------- best choice banner ---------------- */
.cmp-best {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--brand-navy-700, var(--brand-navy-700));
  color: var(--white);
  border-radius: 14px;
  padding: 15px 18px;
  margin-bottom: 16px;
}
.cmp-best-badge {
  background: #ff8011;
  color: var(--white);
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 99px;
  padding: 5px 12px;
  flex-shrink: 0;
}
.cmp-best-txt { min-width: 0; flex: 1; }
.cmp-best-name {
  font-weight: 700;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-best-sub {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cmp-best-score {
  text-align: right;
  flex-shrink: 0;
}
.cmp-best-score b { font-size: 1.5rem; display: block; line-height: 1; }
.cmp-best-score span { font-size: 0.72rem; opacity: 0.8; }

/* Best choice banner responsive */
@media (max-width: 480px) {
  .cmp-best {
    padding: 12px 14px;
  }
  .cmp-best-name { font-size: 0.9rem; }
  .cmp-best-sub { font-size: 0.74rem; }
  .cmp-best-score b { font-size: 1.25rem; }
}

/* ---------------- comparison table ---------------- */
.cmp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--neutral-200);
  border-radius: 14px;
}
.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 640px;
}
.cmp-table th,
.cmp-table td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  /* Text overflow ellipsis for all table content */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-table th {
  background: #f4f8fc;
  color: #33536f;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cmp-table th:first-child,
.cmp-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--white);
  z-index: 1;
  min-width: 130px;
}
.cmp-table th:first-child { background: #f4f8fc; }
.cmp-table td.best,
.cmp-table th.best { background: #f0faf5; }
.cmp-table th.best { background: #e2f3ea; }
.cmp-table td.best:first-child { background: #f0faf5; }
.cmp-table tr:last-child td { border-bottom: none; }

/* Allow multi-line for specific cells that need it */
.cmp-table td.cmp-prod-cell,
.cmp-table th.cmp-prod-cell,
.cmp-table td.cmp-score-cell {
  white-space: normal;
}

.cmp-prod-cell { min-width: 180px; }
.cmp-prod-head { display: flex; gap: 10px; align-items: center; }
.cmp-prod-img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  background: #e8eef5;
  flex-shrink: 0;
}
.cmp-prod-img.ph { display: inline-flex; align-items: center; justify-content: center; color: #9db3c7; font-weight: 700; }
.cmp-prod-name {
  font-weight: 600;
  color: var(--brand-navy-700, var(--brand-navy-700));
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-prod-price { font-weight: 800; color: #ff8011; margin-top: 3px; }
.cmp-best-tag {
  display: inline-block;
  background: #0a7d4e;
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 99px;
  padding: 2px 9px;
  margin-top: 5px;
}

.cmp-score-cell { min-width: 150px; }
.cmp-score-top { display: flex; justify-content: space-between; font-weight: 700; color: var(--brand-navy-700, var(--brand-navy-700)); margin-bottom: 5px; }
.cmp-score-bar { height: 8px; border-radius: 99px; background: #e8eef5; overflow: hidden; }
.cmp-score-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-navy-700, var(--brand-navy-700)), #0a7fb5);
}
.cmp-score-cell.best .cmp-score-fill { background: linear-gradient(90deg, #0a7d4e, #10b981); }

/* Compact per-product score breakdown under the bar */
.cmp-bd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 10px;
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--neutral-500, var(--neutral-500));
}
.cmp-bd-grid b { color: var(--brand-navy-700, var(--brand-navy-700)); font-weight: 700; margin-right: 3px; }
.cmp-bd-grid span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="dark"] .cmp-bd-grid { color: #8aa0b8; }
[data-theme="dark"] .cmp-bd-grid b { color: #dbe6f3; }

/* ---------------- area metrics ---------------- */
.cmp-area-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 14px;
}
.cmp-area-h {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7b97af;
}
.cmp-area-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cmp-area {
  border: 1px solid var(--neutral-200);
  border-radius: 14px;
  padding: 13px 15px;
  background: #fbfdff;
}
.cmp-area-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cmp-area-name {
  font-weight: 700;
  color: var(--brand-navy-700, var(--brand-navy-700));
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-area-idx { flex-shrink: 0; }
.cmp-area-idx {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 800;
  color: #0a7d4e;
  font-size: 1.25rem;
}
.cmp-area-idx small { font-size: 0.7rem; color: #7b97af; font-weight: 600; }
.cmp-area-meta {
  font-size: 0.74rem;
  color: #7b97af;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-area-parts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.cmp-part { display: flex; align-items: center; gap: 9px; font-size: 0.74rem; color: #47566b; }
.cmp-part-label {
  width: 96px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmp-part-val { width: 30px; text-align: right; font-weight: 700; color: var(--brand-navy-700, var(--brand-navy-700)); flex-shrink: 0; }
.cmp-range-sm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- quality sliders ----------------
   Display-only gauges: the backend computes every score, the slider just
   visualises it (thumb + fill positioned at the score). pointer-events:none
   keeps users from dragging them. */
.cmp-range {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 99px;
  outline: none;
  pointer-events: none;
}

/* Main score slider (0-100) — shows the region/town quality index */
.cmp-area-slider {
  --pct: 0%;
  width: 100%;
  height: 10px;
  margin: 10px 0 2px;
  background: linear-gradient(90deg, #0a7d4e 0%, #0a7d4e var(--pct), #e8eef5 var(--pct), #e8eef5 100%);
}
.cmp-area-slider::-webkit-slider-thumb,
.cmp-range-sm::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
  border: none;
  background: transparent;
  opacity: 0;
}
.cmp-area-slider::-moz-range-thumb,
.cmp-range-sm::-moz-range-thumb {
  width: 0;
  height: 0;
  border: none;
  background: transparent;
  opacity: 0;
}
.cmp-area-slider::-moz-range-track { height: 10px; border-radius: 99px; background: transparent; }

/* Small factor sliders (0-25 / 0-20 / 0-15) */
.cmp-range-sm {
  --pct: 0%;
  flex: 1;
  min-width: 0;
  height: 6px;
  background: linear-gradient(90deg, #0a7fb5 0%, #0a7fb5 var(--pct), #e8eef5 var(--pct), #e8eef5 100%);
}
.cmp-range-sm::-moz-range-track { height: 6px; border-radius: 99px; background: transparent; }

.cmp-area-score { transition: color 0.12s ease; }

/* ---------------- dark mode ---------------- */
[data-theme="dark"] body { background: linear-gradient(135deg, #0b1120 0%, #0f172a 100%); color: #dbe6f3; }
[data-theme="dark"] .cmp-card { background: var(--neutral-900, var(--neutral-900)); border-color: #1f2937; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); }
[data-theme="dark"] .cmp-card-title { color: var(--neutral-100, var(--neutral-100)); }
[data-theme="dark"] .cmp-card-title small { color: #7b8fa3; }
[data-theme="dark"] .cmp-count { background: #1f2937; border-color: #374151; color: var(--neutral-300, var(--neutral-300)); }
[data-theme="dark"] .cmp-brand { color: var(--neutral-100, var(--neutral-100)); }
[data-theme="dark"] .cmp-back { color: #93c5fd; }
[data-theme="dark"] .cmp-pick { background: #16233b; border-color: #23314f; }
[data-theme="dark"] .cmp-pick:hover { border-color: #3b4a6b; }
[data-theme="dark"] .cmp-pick.on { border-color: #10b981; background: rgba(16, 185, 129, 0.1); }
[data-theme="dark"] .cmp-pick-name { color: #dbe6f3; }
[data-theme="dark"] .cmp-pick-price { color: #fbbf24; }
[data-theme="dark"] .cmp-pick-meta { color: #8aa0b8; }
[data-theme="dark"] .cmp-pick-check { border-color: #3b4a6b; }
[data-theme="dark"] .cmp-table-wrap { border-color: #1f2937; }
[data-theme="dark"] .cmp-table th { background: #16233b; color: #9fb3c8; }
[data-theme="dark"] .cmp-table td { border-color: #1f2937; }
[data-theme="dark"] .cmp-table th:first-child,
[data-theme="dark"] .cmp-table td:first-child { background: var(--neutral-900, var(--neutral-900)); }
[data-theme="dark"] .cmp-table th.best { background: rgba(16, 185, 129, 0.16); }
[data-theme="dark"] .cmp-table td.best { background: rgba(16, 185, 129, 0.08); }
[data-theme="dark"] .cmp-table td.best:first-child { background: rgba(16, 185, 129, 0.08); }
[data-theme="dark"] .cmp-prod-name { color: #93c5fd; }
[data-theme="dark"] .cmp-prod-price { color: #fbbf24; }
[data-theme="dark"] .cmp-score-top { color: var(--neutral-100, var(--neutral-100)); }
[data-theme="dark"] .cmp-score-bar { background: #1f2937; }
[data-theme="dark"] .cmp-area { background: #16233b; border-color: #23314f; }
[data-theme="dark"] .cmp-area-name { color: #dbe6f3; }
[data-theme="dark"] .cmp-area-idx { color: #34d399; }
[data-theme="dark"] .cmp-part { color: #9fb3c8; }
[data-theme="dark"] .cmp-part-val { color: #dbe6f3; }
[data-theme="dark"] .cmp-area-slider { background: linear-gradient(90deg, #34d399 0%, #34d399 var(--pct), #1f2937 var(--pct), #1f2937 100%); }
[data-theme="dark"] .cmp-range-sm { background: linear-gradient(90deg, #38bdf8 0%, #38bdf8 var(--pct), #1f2937 var(--pct), #1f2937 100%); }
[data-theme="dark"] .cmp-alert { background: #3a2e12; border-color: #57431a; color: #fcd34d; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .cmp-area-row { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 520px) {
  .cmp-page { padding: 16px 12px 50px; }
  .cmp-card { padding: 16px 14px; }
  .cmp-top { gap: 10px; flex-direction: column; align-items: stretch; }
  .cmp-back { align-self: flex-start; }
  .cmp-brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cmp-count { order: 3; width: 100%; text-align: center; }
  .cmp-pick-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .cmp-pick { padding: 6px; gap: 6px; }
  .cmp-pick-img { border-radius: 6px; }
  .cmp-pick-img.ph { font-size: 1.25rem; }
  .cmp-pick-name { font-size: 0.7rem; }
  .cmp-pick-meta { font-size: 0.62rem; }
  .cmp-pick-price { font-size: 0.74rem; }
  .cmp-pick-check { width: 18px; height: 18px; font-size: 11px; top: 6px; right: 6px; }
}

/* Extra small mobile - ensure 2 cards per row even on very small screens */
@media (max-width: 380px) {
  .cmp-pick-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .cmp-pick { padding: 5px; }
  .cmp-pick-name { font-size: 0.66rem; }
  .cmp-pick-meta { font-size: 0.6rem; }
  .cmp-pick-price { font-size: 0.7rem; }
}

/* Table text overflow handling on small screens */
@media (max-width: 768px) {
  .cmp-table th,
  .cmp-table td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  .cmp-prod-img { width: 38px; height: 38px; }
  .cmp-prod-name { font-size: 0.8rem; }
  .cmp-prod-price { font-size: 0.8rem; }
  .cmp-score-cell { min-width: 120px; }
  .cmp-bd-grid { font-size: 0.64rem; gap: 2px 6px; }
}

/* ============ MOBILE CARD MODE ≤768px ============
   Transform the comparison table into stacked cards per product.
   Each product column becomes a card with attribute rows (label + value).
   The first column (spec name) becomes the card header with product info.
   Pure CSS — no JS required for the layout. */
@media (max-width: 768px) {
  /* Container: no horizontal scroll, let cards stack vertically */
  .cmp-table-wrap {
    overflow-x: visible;
    border: none;
    border-radius: 0;
    padding: 0;
  }

  /* Table becomes block layout — drop the desktop min-width so the stacked
     cards fit the viewport instead of overflowing to the right. */
  .cmp-table,
  .cmp-table thead,
  .cmp-table tbody,
  .cmp-table tr,
  .cmp-table th,
  .cmp-table td {
    display: block;
    min-width: 0;
  }
  .cmp-table {
    width: 100%;
  }

  /* Hide original headers — labels come from data-label on <td> */
  .cmp-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  /* Each <tr> (spec row) becomes a card */
  .cmp-table tr {
    border: 1px solid var(--neutral-200);
    border-radius: 14px;
    margin-bottom: 12px;
    background: var(--white);
    box-shadow: 0 4px 14px rgba(16, 54, 86, 0.06);
    overflow: hidden;
  }

  /* First cell (spec name) becomes card header */
  .cmp-table td:first-child,
  .cmp-table th:first-child {
    position: static;
    background: #f4f8fc;
    color: var(--brand-navy-700, var(--brand-navy-700));
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    min-width: auto;
    z-index: auto;
  }

  /* Remaining cells (product values) become rows inside the card */
  .cmp-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    border-top: none;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 0.86rem;
    color: #17324d;
    min-width: auto;
  }

  .cmp-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--neutral-500, var(--neutral-500));
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-right: 12px;
  }

  /* Special handling for product header row (first row in tbody) */
  .cmp-table tbody tr:first-child td:first-child {
    /* This is the "Product" header — transform into card header with all product info */
    background: var(--white);
    border-bottom: 1px solid var(--line);
  }

  /* Product cells (the ones with images, names, prices, best badge) */
  .cmp-table td.cmp-prod-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px;
    background: #fbfdff;
  }

  .cmp-table td.cmp-prod-cell::before {
    display: none; /* no label needed — visual is self-evident */
  }

  .cmp-prod-cell .cmp-prod-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .cmp-prod-cell .cmp-prod-img {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .cmp-prod-cell .cmp-prod-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    font-size: 1rem;
    line-height: 1.3;
  }

  .cmp-prod-cell .cmp-prod-price {
    font-size: 1.1rem;
  }

  .cmp-prod-cell .cmp-best-tag {
    margin-top: 0;
    align-self: flex-start;
  }

  /* Score cells become progress bars with value */
  .cmp-table td.cmp-score-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .cmp-table td.cmp-score-cell::before {
    font-weight: 700;
    color: var(--brand-navy-700, var(--brand-navy-700));
  }

  .cmp-table td.cmp-score-cell .cmp-score-top {
    width: 100%;
    justify-content: space-between;
  }

  .cmp-table td.cmp-score-cell .cmp-score-bar {
    width: 100%;
  }

  .cmp-table td.cmp-score-cell .cmp-bd-grid {
    width: 100%;
  }

  /* Hide low-value rows on mobile via data-cmp-hide-md on <th> */
  .cmp-table tr[data-cmp-hide-md] {
    display: none;
  }

  /* Area metrics: stack into cards too */
  .cmp-area-row {
    display: block;
  }

  .cmp-area {
    margin-bottom: 12px;
  }
}

/* Dark mode for mobile card mode */
@media (max-width: 768px) {
  [data-theme="dark"] .cmp-table tr {
    background: var(--neutral-900, var(--neutral-900));
    border-color: #1f2937;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  }
  [data-theme="dark"] .cmp-table td:first-child {
    background: #16233b;
    color: #9fb3c8;
    border-color: #1f2937;
  }
  [data-theme="dark"] .cmp-table td {
    color: #dbe6f3;
    border-color: #1f2937;
  }
  [data-theme="dark"] .cmp-table td::before {
    color: #8aa0b8;
  }
  [data-theme="dark"] .cmp-table td.cmp-prod-cell {
    background: #16233b;
  }
  [data-theme="dark"] .cmp-table tr[data-cmp-hide-md] {
    display: none;
  }
}

/* ---------------- new quality factors ---------------- */
.cmp-spec-chip {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 7px;
  border: 1px solid #dbe6f2;
  border-radius: 99px;
  background: #f4f8fc;
  color: #33536f;
  font-size: 0.7rem;
  white-space: nowrap;
}
.cmp-stars { color: #d97706; font-weight: 700; }
.cmp-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0a7d4e;
  color: var(--white);
  font-size: 0.62rem;
  font-weight: 800;
  vertical-align: middle;
}
[data-theme="dark"] .cmp-spec-chip {
  background: #1f2937;
  border-color: #374151;
  color: var(--neutral-300, var(--neutral-300));
}
[data-theme="dark"] .cmp-stars { color: #fbbf24; }

/* ---- new compare details ---- */
.cmp-disc { display:inline-block; margin-left:6px; padding:1px 6px; border-radius:99px; background:#fee2e2; color:#b91c1c; font-size:0.68rem; font-weight:700; }
.cmp-eta { color:#7b97af; font-size:0.72rem; }
.cmp-fresh { display:inline-block; margin-left:6px; padding:1px 6px; border-radius:99px; background:#dcfce7; color:#166534; font-size:0.68rem; font-weight:700; }
.cmp-toolbar { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
.cmp-toggle { display:inline-flex; align-items:center; gap:6px; font-size:0.82rem; color:#33536f; cursor:pointer; }
.cmp-toolbar-actions { display:flex; gap:8px; flex-wrap:wrap; }
.cmp-tool-btn { border:1px solid var(--neutral-200); background:var(--white); color:#33536f; border-radius:8px; padding:6px 12px; font-size:0.78rem; font-weight:600; cursor:pointer; transition:background .15s ease; }
.cmp-tool-btn:hover { background:#f4f8fc; }
.cmp-row-identical { opacity:0.55; }
.cmp-best-val { background:#fff7e6; font-weight:700; }
.cmp-cat-link { display:inline-block; margin:4px 6px; padding:6px 12px; border:1px solid var(--neutral-200); border-radius:99px; text-decoration:none; color:#17324d; font-size:0.82rem; font-weight:600; }
.cmp-cat-link:hover { background:#f4f8fc; }
.cmp-lightbox { position:fixed; inset:0; background:rgba(0,0,0,0.85); display:none; align-items:center; justify-content:center; z-index:9999; padding:20px; }
.cmp-lightbox.open { display:flex; }
.cmp-lightbox img { max-width:90vw; max-height:90vh; border-radius:12px; box-shadow:0 20px 60px rgba(0,0,0,0.5); }
.cmp-lightbox-close { position:absolute; top:16px; right:20px; background:none; border:none; color:#fff; font-size:2rem; cursor:pointer; }

/* sticky best choice on mobile */
@media (max-width: 768px) {
  .cmp-best { position:sticky; bottom:0; z-index:5; box-shadow:0 -8px 24px rgba(0,0,0,0.18); }
}

/* dark mode for new bits */
[data-theme="dark"] .cmp-disc { background:rgba(239,68,68,0.18); color:#fca5a5; }
[data-theme="dark"] .cmp-fresh { background:rgba(34,197,94,0.18); color:#86efac; }
[data-theme="dark"] .cmp-tool-btn { background:#1f2937; border-color:#374151; color:#dbe6f3; }
[data-theme="dark"] .cmp-tool-btn:hover { background:#23314f; }
[data-theme="dark"] .cmp-cat-link { background:#16233b; border-color:#23314f; color:#dbe6f3; }
[data-theme="dark"] .cmp-best-val { background:rgba(251,191,36,0.12); }
[data-theme="dark"] .cmp-toggle { color:#9fb3c8; }

.cmp-pod-paused { display:inline-block; margin-left:6px; padding:1px 6px; border-radius:99px; background:#fee2e2; color:#b91c1c; font-size:0.68rem; font-weight:700; }
.cmp-ph { display:inline-block; max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#33536f; font-size:0.78rem; }
.cmp-ph small { opacity:0.7; font-size:0.7rem; }
.cmp-ph-trend { display:inline-block; width:120px; height:22px; background:#e8eef5; border-radius:6px; position:relative; vertical-align:middle; }
.cmp-ph-trend .cmp-ph-bar { position:absolute; bottom:0; left:0; height:6px; border-radius:99px; background:linear-gradient(90deg,#0a7fb5,#0a7d4e); opacity:0.85; }
[cmp-ph-trend].cmp-row-identical .cmp-ph-trend .cmp-ph-bar { opacity:0.4; }
[data-theme="dark"] .cmp-pod-paused { background:rgba(239,68,68,0.18); color:#fca5a5; }
[data-theme="dark"] .cmp-ph { color:#9fb3c8; }
