/* ── Page background (matches other dashboard pages) ── */
html[data-mode="light"] body.horizontal .wrapper {
  background-color:#f3f4f6!important;
  background-image:linear-gradient(rgba(241,245,249,0.91),rgba(241,245,249,0.91)),
    url("../../assets/images/cbu-bg-pic-3.2ec7ebae08c6.jpg")!important;
  background-repeat:no-repeat!important;background-size:cover!important;background-attachment:fixed!important;
}
html[data-mode="dark"] body.horizontal .wrapper {
  background-color:#1a1d21!important;
  background-image:linear-gradient(rgba(26,29,33,0.93),rgba(26,29,33,0.93)),
    url("../../assets/images/cbu-bg-pic-3.2ec7ebae08c6.jpg")!important;
  background-repeat:no-repeat!important;background-size:cover!important;background-attachment:fixed!important;
}

/* ── Variables that match narx-tahlil palette ── */
:root {
  --sp-radius: clamp(.67rem, .737vw, .9213rem);
  --sm-navy: #1A2B4B;
  --sm-navy-d: #0f1f3d;
  --sm-border: #dde3ec;
  --sm-green: #16a34a; --sm-green-bg: #f0fdf4; --sm-green-bdr: #86efac;
  --sm-red:   #dc2626; --sm-red-bg:   #fff5f5; --sm-red-bdr:   #fca5a5;
  --sm-blue:  #2563eb; --sm-blue-bg:  #eff6ff; --sm-blue-bdr:  #93c5fd;
  --sm-muted: #64748b;
}
html[data-mode="dark"] {
  --sm-border: rgba(255,255,255,0.09);
  --sm-green:  #4ade80; --sm-green-bg:rgba(74,222,128,0.10); --sm-green-bdr:rgba(74,222,128,0.35);
  --sm-red:    #f87171; --sm-red-bg:rgba(248,113,113,0.10);  --sm-red-bdr:rgba(248,113,113,0.35);
  --sm-blue-bg:#0d1f40;  --sm-blue-bdr:#1e40af;
  --sm-muted:#aaa;
}

/* ── Layout — full-screen, table body scrolls ── */
body.horizontal .wrapper.d-flex.flex-column.min-vh-100 {
  height: 100vh !important;
  max-height: 100vh;
  overflow: hidden;
}
.sp-wrap {
  padding: .4188rem .67rem 0;
  max-width: 100%;
  display: flex; flex-direction: column;
  height: 100%; overflow: hidden;
  line-height: normal;
}

/* Date selector — one inline pill, sits in the table header */
/* Just a holder now: the select is rendered by the site-wide custom dropdown
   (static/js/custom_select.js), which carries the styling. The pill and the
   calendar icon that used to sit here made this the odd one out. */
.sp-date-sel-wrap { display:flex; align-items:center; flex-shrink:0; }
.sp-date-sel {
  background:transparent; border:none; outline:none;
  padding:.5025rem 1.5913rem .5025rem .2513rem; color:#fff; font-size:1.0469rem; font-weight:700;
  cursor:pointer;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23ffffff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right .4606rem center;
  appearance:none; -webkit-appearance:none;
}
.sp-date-sel:hover { background-color:rgba(255,255,255,.08); }
.sp-date-sel option { background:#1A2B4B; color:#fff; }

.sp-sm-badge {
  display:inline-flex; align-items:center; gap:.2094rem;
  font-size:.7538rem; font-weight:700;
  padding:.2094rem .5444rem; border-radius:.2513rem; border:.0628rem solid;
  white-space:nowrap; letter-spacing:.01em;
}
.sp-sm-badge.g { color:var(--sm-green); background:var(--sm-green-bg); border-color:var(--sm-green-bdr); }
.sp-sm-badge.r { color:var(--sm-red);   background:var(--sm-red-bg);   border-color:var(--sm-red-bdr); }
html[data-mode="dark"] .sp-sm-badge.g { background:rgba(74,222,128,0.10); border-color:rgba(74,222,128,0.30); color:#4ade80; }
html[data-mode="dark"] .sp-sm-badge.r { background:rgba(248,113,113,0.10); border-color:rgba(248,113,113,0.30); color:#f87171; }

/* ── Price table card ── */
.sp-table-card {
  background: rgba(255,255,255,0.82);
  border: .0419rem solid var(--sm-border);
  border-radius: var(--sp-radius);
  overflow: hidden;
  box-shadow: 0 .1675rem .8375rem rgba(26,43,75,.09);
  flex: 1; display: flex; flex-direction: column; min-height: 0; margin-bottom: .335rem;
}
html[data-mode="dark"] .sp-table-card { background:rgba(28,30,34,0.72); border-color:rgba(255,255,255,0.09); }

.sp-table-hdr {
  background: linear-gradient(90deg, #1A2B4B 0%, #243654 100%);
  border-bottom: .0419rem solid transparent;
  padding: .5444rem .9213rem;
  display: flex; align-items: center; justify-content: space-between; gap: .67rem; flex-wrap: wrap;
}
.sp-table-hdr-title { font-size:1.8425rem; font-weight:800; color:#fff; letter-spacing:-.01em; }
.sp-table-hdr-right { display:flex; align-items:center; gap:.8375rem; flex-wrap:wrap; }
.sp-table-hdr-sub { font-size:.8794rem; font-weight:600; color:rgba(255,255,255,.55); white-space:nowrap; }

/* Category pills */
.sp-cat-pills { padding: .3769rem .8375rem; border-bottom: .0419rem solid var(--sm-border); display:flex; gap:.2513rem; flex-wrap:wrap; }
html[data-mode="dark"] .sp-cat-pills { border-color:rgba(255,255,255,0.09); }
.sp-cat-pill {
  padding:.2094rem .6281rem; border-radius:.335rem; font-size:.9631rem; font-weight:600;
  border:.0419rem solid var(--sm-border); background:transparent; color:var(--sm-muted);
  cursor:pointer; transition: all .15s;
}
.sp-cat-pill:hover,
.sp-cat-pill.active { background:#1A2B4B; color:#fff; border-color:#1A2B4B; }
.sp-cat-pill.active { box-shadow: 0 .1256rem .4188rem rgba(26,43,75,.28); }
html[data-mode="dark"] .sp-cat-pill { border-color:rgba(255,255,255,0.22); color:#adb5bd; }
html[data-mode="dark"] .sp-cat-pill:hover { background:rgba(76,175,80,0.08); border-color:rgba(76,175,80,0.35); color:#4ade80; }
html[data-mode="dark"] .sp-cat-pill.active { background:#4caf50; border-color:#4caf50; color:#fff; box-shadow: 0 .1256rem .4188rem rgba(74,222,128,.25); }

/* Table */
/* position: relative keeps the cells' absolutely positioned sr-only labels
   inside the scroller; without it they escaped its clipping and widened the
   page on phones */
.sp-scroll { position:relative; flex:1; overflow-y:auto; overflow-x:auto; min-height:0; transition:box-shadow .15s; }
.sp-scroll.sh-top    { box-shadow: inset 0  .335rem .4188rem -.2513rem rgba(0,0,0,.10); }
.sp-scroll.sh-bot    { box-shadow: inset 0 -.335rem .4188rem -.2513rem rgba(0,0,0,.10); }
.sp-scroll.sh-both   { box-shadow: inset 0 .335rem .4188rem -.2513rem rgba(0,0,0,.10), inset 0 -.335rem .4188rem -.2513rem rgba(0,0,0,.10); }
html[data-mode="dark"] .sp-scroll.sh-top  { box-shadow: inset 0  .335rem .4188rem -.2513rem rgba(0,0,0,.30); }
html[data-mode="dark"] .sp-scroll.sh-bot  { box-shadow: inset 0 -.335rem .4188rem -.2513rem rgba(0,0,0,.30); }
html[data-mode="dark"] .sp-scroll.sh-both { box-shadow: inset 0 .335rem .4188rem -.2513rem rgba(0,0,0,.30), inset 0 -.335rem .4188rem -.2513rem rgba(0,0,0,.30); }
.sp-table { width:100%; border-collapse:collapse; font-size:1.0888rem; }
.sp-table thead th {
  position:sticky; top:0; z-index:2;
  background:#f0f5fb; border-bottom:.0838rem solid var(--sm-border);
  padding:.3769rem .67rem; text-align:center; font-size:1.005rem; font-weight:700;
  text-transform:uppercase; letter-spacing:.04em; color:#64748b; white-space:nowrap;
}
html[data-mode="dark"] .sp-table thead th { background:rgba(22,24,27,0.95); border-color:rgba(255,255,255,0.09); color:#adb5bd; position:sticky; top:0; z-index:2; }
.sp-table thead th:first-child { text-align:left; min-width:9.2125rem; }
.sp-table tbody tr { border-bottom:.0419rem solid #edf1f7; transition:background .1s; }
html[data-mode="dark"] .sp-table tbody tr { border-color:rgba(255,255,255,0.06); }
.sp-table tbody tr:last-child { border-bottom:none; }
.sp-table tbody tr:hover { background:#f5f9fd; }
html[data-mode="dark"] .sp-table tbody tr:hover { background:rgba(255,255,255,0.05); }
.sp-table tbody td { padding:.3769rem .67rem; vertical-align:middle; }

.sp-prod-name { font-size:1.0888rem; font-weight:700; color:#0f172a; }
html[data-mode="dark"] .sp-prod-name { color:#e0e0e0; }
.sp-prod-cat  { font-size:.9213rem; color:var(--sm-muted); margin-top:.0419rem; }
.sp-unit      { font-size:.9213rem; color:var(--sm-muted); text-align:center; white-space:nowrap; }

/* Price chips — fixed box so a plain price and a price+arzon/qimmat label line
   up identically (both width and height), instead of sizing to their own content */
.sp-price-chip {
  /* one line: icon + price; only the cheapest / priciest get a coloured border
     (their meaning is in the legend), the other prices are plain text */
  display:inline-flex; flex-direction:row; align-items:center; justify-content:center; gap:.2513rem;
  padding:0 .5025rem; border-radius:.335rem; border:.0628rem solid; box-sizing:border-box;
  font-size:1.005rem; font-weight:800; white-space:nowrap; text-align:center;
  min-width:0; height:1.675rem;
}
.sp-chip-ico { font-size:.62em; }
.sp-price-chip.cheapest {
  background:var(--sm-green-bg); border-color:var(--sm-green-bdr); color:var(--sm-green);
}
.sp-price-chip.priciest {
  background:var(--sm-red-bg); border-color:var(--sm-red-bdr); color:var(--sm-red);
}
.sp-price-chip.normal {
  background:transparent; border-color:transparent; color:#334155; font-weight:700;
}
html[data-mode="dark"] .sp-price-chip.normal { background:transparent; color:#c0c0c0; border-color:transparent; }

/* legend (right of the category pills) */
.sp-cat-pills { align-items:center; }
.sp-cat-selwrap { display:none; }
.sp-legend { margin-left:auto; display:flex; align-items:center; gap:.7538rem; flex-wrap:wrap; }
.sp-legend-item { display:inline-flex; align-items:center; gap:.2931rem; font-size:.8375rem; font-weight:700; white-space:nowrap; }
.sp-legend-item i { font-size:.8em; }
.sp-legend-item.cheapest { color:var(--sm-green); }
.sp-legend-item.priciest { color:var(--sm-red); }
.sp-price-chip.na { background:transparent; border-color:transparent; color:var(--sm-muted); }
.sp-price-signal { font-size:.7956rem; font-weight:600; margin-top:.0838rem; }

.sp-diff { font-size:1.0888rem; font-weight:700; text-align:center; }
.sp-diff.has-diff { color:var(--sm-red); background:var(--sm-red-bg); border:.0628rem solid var(--sm-red-bdr); border-radius:.335rem; padding:0 .5025rem; height:1.675rem; box-sizing:border-box; display:inline-flex; align-items:center; font-size:1.005rem; }
html[data-mode="dark"] .sp-diff.has-diff { color:#f87171; background:rgba(248,113,113,0.10); border-color:rgba(248,113,113,0.30); }

/* Show more button */
.sp-more-wrap { padding:.4188rem .7538rem; border-top:.0419rem solid var(--sm-border); text-align:center; }
html[data-mode="dark"] .sp-more-wrap { border-color:rgba(255,255,255,0.09); }
.sp-more-btn {
  padding:.335rem 1.005rem; border-radius:.335rem; border:.0628rem solid var(--sm-border);
  background:transparent; color:var(--sm-navy); font-size:1.005rem; font-weight:600;
  cursor:pointer; transition:all .15s;
}
html[data-mode="dark"] .sp-more-btn { color:#e0e0e0; border-color:rgba(255,255,255,0.15); }
.sp-more-btn:hover { background:rgba(255,255,255,0.08); color:#fff; }
html[data-mode="dark"] .sp-more-btn:hover { background:rgba(255,255,255,0.10); color:#fff; }
html[data-mode="dark"] .sp-prod-cat { color:#888; }
html[data-mode="dark"] .sp-unit { color:#888; }
/* table header — dark gray, no dark-blue gradient */
html[data-mode="dark"] .sp-table-hdr  { background:rgba(22,24,27,0.95); border-bottom:.0419rem solid rgba(255,255,255,0.09); }
html[data-mode="dark"] .sp-table-hdr-title { color:#e0e0e0; }
html[data-mode="dark"] .sp-table-hdr-sub   { color:rgba(224,224,224,.45); }

/* ══════════════════════════════════════════
   VERY LARGE SCREENS — raise the clamp ceiling
   (base sizes were tuned for ~1440px; on a 1920px+
   office monitor the table reads too small for the
   space it's given, so scale fluidly instead of
   staying pinned to the base px value)
══════════════════════════════════════════ */
@media (min-width:1920px) {
  .sp-table-hdr        { padding: clamp(.5444rem, .5695vw, .7538rem) clamp(.9213rem, .938vw, 1.2563rem); }
  .sp-table-hdr-title  { font-size: clamp(1.8425rem, 1.742vw, 2.5125rem); }
  .sp-table-hdr-sub    { font-size: clamp(.8794rem, .8375vw, 1.1306rem); }
  .sp-date-sel-icon    { font-size: clamp(.9213rem, .871vw, 1.1306rem); }
  .sp-date-sel         { font-size: clamp(1.0469rem, 1.005vw, 1.34rem); padding: clamp(.5025rem, .536vw, .67rem) clamp(1.5913rem, 1.608vw, 1.9263rem) clamp(.5025rem, .536vw, .67rem) .2513rem; }

  .sp-cat-pills   { padding: clamp(.3769rem, .402vw, .5444rem) clamp(.8375rem, .871vw, 1.0888rem); gap: clamp(.2513rem, .268vw, .3769rem); }
  .sp-cat-pill    { font-size: clamp(.9631rem, .938vw, 1.2144rem); padding: clamp(.2094rem, .2345vw, .2931rem) clamp(.6281rem, .67vw, .7956rem); }

  .sp-table            { font-size: clamp(1.0888rem, 1.005vw, 1.3819rem); }
  .sp-table thead th   { font-size: clamp(1.005rem, .938vw, 1.2981rem); padding: clamp(.3769rem, .402vw, .5444rem) clamp(.67rem, .67vw, .8375rem); }
  .sp-table tbody td   { padding: clamp(.3769rem, .402vw, .5444rem) clamp(.67rem, .67vw, .8375rem); }
  .sp-prod-name        { font-size: clamp(1.0888rem, 1.005vw, 1.3819rem); }
  .sp-prod-cat         { font-size: clamp(.9213rem, .871vw, 1.1725rem); }
  .sp-unit             { font-size: clamp(.9213rem, .871vw, 1.1725rem); }

  .sp-price-chip  { font-size: clamp(1.005rem, .938vw, 1.2563rem); height: clamp(1.675rem, 1.541vw, 2.01rem); padding: 0 clamp(.5025rem, .536vw, .67rem); }
  .sp-legend-item { font-size: clamp(.8375rem, .804vw, 1.0469rem); }
  .sp-price-signal{ font-size: clamp(.7956rem, .737vw, 1.005rem); }
  .sp-diff        { font-size: clamp(1.0888rem, 1.005vw, 1.3819rem); }
  .sp-diff.has-diff { padding: clamp(.335rem, .335vw, .4606rem) clamp(.8375rem, .804vw, 1.0469rem); }
  .sp-sm-badge    { font-size: clamp(.7538rem, .7035vw, .9213rem); }
  .sp-more-btn    { font-size: clamp(1.005rem, .938vw, 1.2144rem); }
}

/* ── RESPONSIVE ── */

/* Tablet: 768px–1199px */
@media (max-width:1199px) {
  body.horizontal .wrapper.d-flex.flex-column.min-vh-100 {
    height:auto !important; max-height:none; overflow:visible;
  }
  .sp-wrap { height:auto; overflow:visible; padding:.4188rem .5025rem .67rem; }
  .sp-table-card { flex:none; min-height:0; margin-bottom:.67rem; }
  .sp-scroll { overflow-x:auto; overflow-y:visible; max-height:60vh; }
  @media (min-width: 992px) { .sp-scroll { max-height: 40.2vh; } }
  .sp-table-hdr { padding:.67rem .8375rem; }
  .sp-table-hdr-title { font-size:1.2563rem; }
  .sp-table-hdr-sub { font-size:.7119rem; }
  .sp-cat-pill { font-size:.7538rem; padding:.2931rem .67rem; }
  .sp-table { font-size:.8375rem; }
  .sp-table thead th { font-size:.7538rem; padding:.4606rem .5025rem; }
  .sp-table tbody td { padding:.5444rem .5025rem; }
  .sp-prod-name { font-size:.8375rem; }
  .sp-prod-cat, .sp-unit { font-size:.7119rem; }
  .sp-price-chip { font-size:.8375rem; height:1.5075rem; padding:0 .4188rem; }
  .sp-legend-item { font-size:.67rem; }
  .sp-diff { font-size:.8375rem; }
}

/* Mobile: ≤767px */
@media (max-width:767px) {
  body.horizontal .wrapper.d-flex.flex-column.min-vh-100 {
    height: 100dvh !important; max-height: 100dvh; overflow: hidden;
  }
  .sp-wrap { height: 100%; overflow: hidden; padding:.335rem .335rem 0; }
  .sp-table-card { flex:1; min-height:0; margin-bottom:0; }
  .sp-scroll { overflow-x:auto; overflow-y:auto; max-height:none; }

  .sp-date-sel { width:auto; font-size:.7538rem; padding:.3769rem 1.1725rem .3769rem .1675rem; }
  .sp-sm-badge { font-size:.6281rem; }

  /* Table header: title full-width row, count + date share the row below */
  .sp-table-hdr { padding:.5863rem .67rem; gap:.4188rem; }
  .sp-table-hdr-title { font-size:1.0888rem; flex-basis:100%; }
  .sp-table-hdr-right { flex-basis:100%; justify-content:space-between; gap:.335rem; }
  .sp-table-hdr-sub { font-size:.67rem; }

  /* Category pills */
  .sp-cat-pills { padding:.4188rem .5025rem; gap:.2513rem; }
  .sp-cat-pill { font-size:.7119rem; padding:.2094rem .5444rem; }

  /* Table */
  .sp-table { font-size:.7538rem; }
  .sp-table thead th { font-size:.67rem; padding:.3769rem .4188rem; letter-spacing:0; }
  .sp-table thead th:first-child { min-width:5.8625rem; }
  .sp-table tbody td { padding:.3769rem .4188rem; }
  .sp-prod-name { font-size:.7538rem; }
  .sp-prod-cat { font-size:.6281rem; }
  .sp-unit { font-size:.67rem; }
  .sp-price-chip { font-size:.7119rem; height:1.34rem; padding:0 .335rem; gap:.2094rem; }
  /* category switch becomes a selector; the legend fills the rest of its row */
  .sp-cat-pills { flex-wrap:nowrap; gap:.4188rem; }
  .sp-cat-seg { display:none !important; }
  .sp-cat-selwrap { display:block; flex:1 1 auto; min-width:0; }
  .sp-cat-selwrap .csel, .sp-cat-selwrap .csel-button { width:100% !important; max-width:none; display:flex; }
  .sp-cat-selwrap .csel-button { justify-content:space-between; }
  .sp-cat-selwrap .csel-button { font-size:.67rem; border-radius:.335rem; }
  .sp-legend { margin-left:0; flex:0 0 auto; gap:.5025rem; flex-wrap:nowrap; }
  .sp-legend-item { font-size:.5863rem; gap:.2094rem; }
  .sp-diff { font-size:.7119rem; }

  /* More button */
  .sp-more-btn { font-size:.7538rem; padding:.335rem .8375rem; }
}


/* ── moved from inline style attributes ── */
.sp-hdr-note { color:rgba(255,255,255,.55); font-size:.6281rem; font-weight:600; }
.sp-col-head { display:flex; flex-direction:column; align-items:center; gap:.1675rem; }
.sp-col-brand { display:flex; align-items:center; justify-content:center; gap:.2094rem; }
.sp-logo { border-radius:.1675rem; object-fit:contain; }
.sp-swatch { width:.5025rem; height:.5025rem; border-radius:.1256rem; display:inline-block; flex-shrink:0; }
.sp-col-badges { display:flex; gap:.2094rem; margin-top:.0838rem; }
.fas.sp-badge-icon { font-size:.5025rem; }
.sp-unit-col { display:flex; flex-direction:column; align-items:center; gap:.0838rem; }
.sp-unit-note { font-size:.5863rem; font-weight:600; opacity:.55; text-transform:none; letter-spacing:0; }
.sp-empty-note { font-size:.6281rem; color:#94a3b8; font-style:italic; }
.sp-dash { color:#cbd5e1; font-size:.7956rem; }


/* ── page end: the same gap above the site footer on every page ── */
.sp-table-card { margin-bottom: 0; }
.sp-wrap { padding-bottom: .4375rem; }
