/* Page header */
  .page-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
  }
  .page-header h1 { flex: 1; margin-bottom: 0; }
  #authBar { display: none; }

  /* Search bar */
  .search-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .search-row input {
    padding: 9px 12px; margin-bottom: 0;
    flex: 5; min-width: 175px;
  }
  .search-controls { display: flex; gap: 8px; flex: 4; min-width: 220px; align-items: center; }
  .search-controls select {
    padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px;
    font-size: .9rem; flex: 1; min-width: 0;
  }
  .search-hint { font-size: .8rem; color: #94a3b8; margin-top: 6px; transition: color .15s; min-height: 0; }
  .search-hint:empty { display: none; }
  .search-hint.warn { color: #f59e0b; }

  /* Results table */
  .results-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: .85rem; }
  th { text-align: left; padding: 8px 10px; background: #f8fafc; font-weight: 600; color: #475569;
       border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
  td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
  tr.product-row { cursor: pointer; }
  tr.product-row:hover td { background: #eff6ff; }
  tr.product-row.active td { background: #dbeafe; }

  /* Match score filter bar */
  .filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 0 4px; border-top: 1px solid #f1f5f9; margin-top: 12px; }
  .filter-bar label { font-size: .82rem; color: #475569; font-weight: 600; white-space: nowrap; }
  .filter-bar input[type=range] { width: 110px; accent-color: #f59e0b; }
  .filter-bar .score-val { font-size: .82rem; font-weight: 700; color: #d97706; min-width: 34px; }
  .filter-bar .range-sep { font-size: .82rem; color: #94a3b8; }
  .filter-bar .score-count { font-size: .8rem; color: #64748b; }
  .filter-bar .reset-btn {
    padding: 3px 10px; border: 1px solid #ddd; border-radius: 6px; background: #fff;
    font-size: .78rem; cursor: pointer; color: #475569; font-weight: 600;
  }
  .filter-bar .reset-btn:hover { background: #f8fafc; }

  /* Confidence badge on rows */
  .conf-badge {
    display: inline-block; padding: 1px 6px; border-radius: 99px; font-size: .7rem;
    font-weight: 700; margin-left: 6px; vertical-align: middle;
  }
  .conf-high { background: #dcfce7; color: #166534; }
  .conf-med  { background: #fef9c3; color: #854d0e; }
  .conf-low  { background: #fee2e2; color: #991b1b; }

  .product-cell { display: flex; align-items: center; gap: 10px; }
  .product-thumb {
    width: 44px; height: 44px; object-fit: contain; border-radius: 6px;
    background: #f8fafc; border: 1px solid #e2e8f0; flex-shrink: 0;
  }
  .product-thumb-placeholder {
    width: 44px; height: 44px; border-radius: 6px; background: #f1f5f9;
    border: 1px solid #e2e8f0; flex-shrink: 0;
  }

  .price-tag { font-weight: 700; color: #16a34a; }
  .shop-chip {
    display: inline-block; padding: 2px 7px; border-radius: 99px; font-size: .75rem;
    font-weight: 600; background: #e0f2fe; color: #0369a1; margin: 1px 2px;
  }
  .shop-chip-best { background: #dcfce7; color: #166534; }
  .old-price { text-decoration: line-through; color: #94a3b8; font-size: .8rem; }
  .discount-chip { background: #fee2e2; color: #991b1b; }
  .discount-chip-multi {
    background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa;
    cursor: help;
  }

  /* Pagination */
  .pagination-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 14px 0 6px; border-top: 1px solid #e2e8f0; margin-top: 14px;
    font-size: .83rem;
  }
  .pagination-bar .page-info {
    color: #94a3b8; flex: 1; min-width: 120px; font-size: .8rem; letter-spacing: .01em;
  }

  /* Page-size selector */
  .pagination-bar .page-size-wrap {
    display: flex; align-items: center; gap: 6px;
    color: #64748b; font-size: .8rem;
  }
  .pagination-bar select.page-size {
    appearance: none; -webkit-appearance: none;
    padding: 5px 28px 5px 10px;
    border: 1px solid #e2e8f0; border-radius: 8px;
    font-size: .8rem; font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 9px center;
    cursor: pointer; color: #334155;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    transition: border-color .15s, box-shadow .15s;
    min-width: 58px;
  }
  .pagination-bar select.page-size:hover  { border-color: #94a3b8; }
  .pagination-bar select.page-size:focus  { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

  /* Page buttons */
  .pagination-bar .page-btns { display: flex; gap: 3px; align-items: center; }
  .pagination-bar button.pg-btn {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid #e2e8f0; border-radius: 8px;
    background: #fff; color: #475569; font-size: .8rem; font-family: inherit;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    transition: background .13s, border-color .13s, color .13s, box-shadow .13s;
    line-height: 1;
  }
  .pagination-bar button.pg-btn:hover:not(:disabled) {
    background: #f1f5f9; border-color: #94a3b8; color: #1e293b;
  }
  .pagination-bar button.pg-btn.active {
    background: #2563eb; color: #fff; border-color: #2563eb;
    box-shadow: 0 2px 6px rgba(37,99,235,.25); font-weight: 600;
  }
  .pagination-bar button.pg-btn:disabled {
    opacity: .38; cursor: not-allowed; box-shadow: none;
  }

  /* Per-shop price breakdown inside expanded row */
  tr.price-details td { background: #f8fafc; padding: 0; }
  .price-details-inner { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px; }
  .shop-price-card {
    border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 14px; background: #fff;
    min-width: 180px; flex: 1; max-width: 260px; position: relative;
    display: flex; flex-direction: column;
  }
  .shop-price-card .shop-name { font-size: .8rem; color: #64748b; margin-bottom: 4px; font-weight: 600; text-transform: uppercase; }
  .shop-price-card .price-main { font-size: 1.2rem; font-weight: 700; color: #16a34a; }
  .shop-price-card .price-unit { font-size: .75rem; color: #64748b; margin-top: 2px; }
  .shop-price-card .old { text-decoration: line-through; color: #94a3b8; font-size: .8rem; }
  .shop-price-card .card-bottom-row {
    display: flex; align-items: center; margin-top: auto; padding-top: 8px; gap: 4px;
  }
  /* top-right icon group: link + basket */
  /* image row: image on left, action icons stacked on right */
  .shop-price-card .card-img-row {
    display: flex; align-items: flex-start; gap: 6px; margin-bottom: 8px;
  }
  .shop-price-card .card-img {
    width: 96px; height: 96px; object-fit: contain; border-radius: 6px;
    background: #f8fafc; border: 1px solid #e2e8f0; flex-shrink: 0;
  }
  .shop-price-card .card-actions {
    display: flex; flex-direction: column; gap: 4px; margin-left: auto;
  }
  .shop-price-card .card-action-link {
    width: 30px; height: 30px; border-radius: 6px; background: #eff6ff;
    color: #2563eb; text-decoration: none; font-size: .9rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .shop-price-card .card-action-link:hover { background: #dbeafe; }
  .shop-price-card .card-action-basket {
    width: 30px; height: 30px; border-radius: 6px; background: #f0fdf4;
    border: 1px solid #e2e8f0; cursor: pointer; font-size: .9rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .shop-price-card .card-action-basket:hover { background: #dcfce7; }
  .out-of-stock { opacity: .5; }

  /* History modal */
  .modal-meta { font-size: .82rem; color: #64748b; margin-bottom: 20px; }
  .days-picker { display: flex; gap: 6px; margin-bottom: 16px; }
  .days-picker button.active { background: #6366f1; color: #fff; border-color: #6366f1; } /* btn-ghost btn-sm from /buttons.css */
  .chart-wrap { position: relative; height: 280px; }
  .chart-empty { color: #64748b; text-align: center; padding: 60px 0; font-size: .9rem; }
  .chart-loading { color: #64748b; text-align: center; padding: 60px 0; font-size: .9rem; }

  /* Confidence badge on rows (admin-only column) */

  /* Leaderboard */
  .leaderboard { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
  .lb-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    border: 2px solid #e2e8f0; border-radius: 10px;
    padding: 10px 14px; background: #fff; min-width: 72px;
  }
  .lb-card.lb-winner { border-color: #16a34a; background: #f0fdf4; }
  .lb-logo {
    width: 44px; height: 44px; object-fit: contain; border-radius: 6px;
    background: #f8fafc; flex-shrink: 0;
  }
  .lb-pct {
    font-size: .82rem; font-weight: 700; color: #dc2626;
    background: #fee2e2; border-radius: 99px; padding: 2px 8px;
  }
  .lb-winner .lb-pct { color: #166534; background: #dcfce7; }
  .lb-loading { color: #94a3b8; font-size: .88rem; padding: 8px 0; }

  .site-status-banner {
    display: none;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: .88rem;
    line-height: 1.45;
  }
  .site-status-banner.visible { display: block; }
  .site-status-banner.strong {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
  }

  /* ── Mobile ──────────────────────────────────────────────────────────────── */
  @media (max-width: 600px) {
    /* Sticky app-style header */
    .page-header {
      position: sticky; top: 0; z-index: 100;
      background: #f5f5f5; padding: 10px 12px; margin: -10px -10px 0;
      border-bottom: 1px solid #e2e8f0;
    }
    .page-header h1 { font-size: 1.1rem; }

    /* Cards: edge-to-edge, no gap between them */
    .card { border-radius: 0; margin-left: -10px; margin-right: -10px; margin-bottom: 8px; }

    /* Search: full-width input, then select + button row */
    .search-row { flex-direction: column; gap: 8px; }
    .search-row input { width: 100%; min-width: 0; }
    .search-controls { width: 100%; min-width: 0; flex: unset; }
    .search-controls select { flex: 1; }
    .search-controls button { align-self: stretch; }

    /* Filter bar */
    .filter-bar { gap: 6px; }
    .filter-bar input[type=range] { width: 80px; }

    /* Pagination: info on its own row, then selector + buttons on one row */
    .pagination-bar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
    .pagination-bar .page-info { width: 100%; min-width: 0; }
    .pagination-bar .page-size-wrap { flex-shrink: 0; }
    .pagination-bar .page-btns { flex-shrink: 0; }

    /* Shop price cards: full width */
    .shop-price-card { min-width: 0; max-width: 100%; flex: 1 1 100%; }
    .price-details-inner { flex-direction: column; gap: 8px; padding: 10px; }

    /* Leaderboard */
    .leaderboard { gap: 8px; }

    /* Table */
    th, td { padding: 6px 7px; }
  }

/* authBar: hidden until JS shows it */
#authBar { display: none; align-items: center; gap: 8px; }

/* h1 logo row */
.page-header h1 {
  display: flex; align-items: center; gap: 10px; flex: 1; margin-bottom: 0;
}
.nav-logo-img  { height: 32px; width: auto; vertical-align: middle; }

/* leaderboard section header */
.leaderboard-header {
  font-size: .8rem; font-weight: 700; color: #64748b;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
}

/* Compact card variant */
.card-compact { padding: 12px; }

/* Page footer */
.page-footer {
  text-align: center; padding: 24px 16px; margin-top: 8px;
  font-size: .82rem; color: #64748b;
}
.link-blue { color: #2563eb; text-decoration: none; }

/* Basket picker modal */
.bp-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 2000;
  align-items: center; justify-content: center; padding: 16px;
}
.bp-modal-box {
  background: #fff; border-radius: 14px; padding: 24px;
  width: 100%; max-width: 360px;
}
.bp-modal-title { margin-bottom: 14px; font-size: 1rem; font-weight: 700; color: #1e40af; }
.bp-basket-list { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.bp-new-row { display: flex; gap: 8px; margin-bottom: 10px; }
.bp-new-input {
  flex: 1; padding: 7px 10px; border: 1px solid #ddd;
  border-radius: 8px; font-size: .88rem;
}
.bp-qty-row { font-size: .78rem; color: #64748b; margin-bottom: 10px; }
.bp-qty-input {
  width: 50px; padding: 3px 6px; border: 1px solid #ddd;
  border-radius: 6px; text-align: center;
}
.bp-footer { text-align: right; }
.bp-status { font-size: .78rem; color: #64748b; margin-top: 8px; min-height: 1.2em; }

/* JS-generated element classes */
.lb-banner {
  font-size: .8rem; color: #d97706; font-weight: 600;
  margin-bottom: 10px; padding: 6px 10px;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
}
.featured-banner {
  font-size: .8rem; color: #0369a1; font-weight: 600;
  margin-bottom: 10px; padding: 6px 10px;
  background: #e0f2fe; border: 1px solid #bae6fd; border-radius: 8px;
}
.range-sep { margin: 0 6px; color: #cbd5e1; }
.shop-count-filter {
  padding: 3px 7px; border: 1px solid #ddd; border-radius: 6px;
  font-size: .82rem; color: #475569; background: #fff; cursor: pointer;
}
.pg-ellipsis { padding: 0 4px; color: #94a3b8; }
.product-name  { font-weight: 600; }
.product-brand { font-size: .78rem; color: #64748b; }
.product-qty   { font-size: .75rem; color: #94a3b8; }
.card-btn-ml-auto { margin-left: auto; }
.stock-label {
  font-size: .75rem; color: #dc2626; margin-top: 4px;
}
.shop-sub-name {
  font-size: .8rem; color: #475569; margin-bottom: 6px;
}
.bp-empty { font-size: .82rem; color: #94a3b8; }

/* Price detail rows start hidden */
.price-details { display: none; }
