/* Alberta market skin on top of reports.css. Every rule scoped under .ab-rp.
   Generic primitives (.rp-band, .rp-card, .rp-kpi, .rp-tbl, .rp-th/.rp-td,
   .rp-pill.brand, .rp-page) live in reports.css; only AB-specific overrides
   belong here. */

/* The block below was MOVED from dashboard.css on 2026-09-10 (dashboard.css
   is Ontario's), verbatim except its `.ab-rp { text-align: left; }` line,
   which reports.css now carries once for every skin as `.rp { text-align:
   left; }`. "above" in its header refers to the /dashboard .dash-rp block
   that still lives there. */
/* ══════════════════════════════════════════
   AB DASHBOARDS ON THE REPORTS DESIGN SYSTEM
   ──────────────────────────────────────────
   /ab/dashboard (weekly), /ab/dashboard-monthly and their /kdp/ab/* twins
   render inside the same shared `.rp` shell as /dashboard above. `.ab-rp`
   is the AB-only skin on top: the collapsible rp-card (still driven by
   ab-helpers.js bindAbSectionToggles through the data-ab-section-* hooks),
   the brand picker, the Weekly Performance grid and the bar trends. Nothing
   here touches ab-helpers.js output on the other AB pages.
   ══════════════════════════════════════════ */

/* Collapsible rp-card chrome (.is-collapsible / .is-clickable / .rp-toggle and
   the head hover) is the shared block in reports.css; bindAbSectionToggles
   flips the body's style.display and the toggle glyph. */
.ab-rp .rp-card-h .rp-card-meta { font-weight: 600; }
.ab-rp .rp-card-meta.crit { color: var(--ace-critical); }

/* Numbers and delta pills never wrap; text columns still may (the two Movers
   halves are narrow, and a pill broken across two lines reads as two values). */
.ab-rp .rp-tbl th.r, .ab-rp .rp-tbl td.r { white-space: nowrap; }

/* Filter bar extras: the week-range pair and its calendar glyph */
.ab-rp .ab-week-range { gap: 6px; }
.ab-rp .ab-cal-icon { color: var(--ace-text-muted); flex-shrink: 0; }
.ab-rp .ab-week-arrow { color: var(--ace-text-muted); font-size: 12px; }

/* Brand picker panel (the view toggles it via style.display) */
.ab-rp .ab-brand-picker { padding: 12px 16px; max-height: 280px; overflow-y: auto; }
.ab-rp .ab-brand-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ab-rp .ab-brand-picker-actions { display: inline-flex; gap: 6px; }
.ab-rp .ab-brand-opt {
  display: inline-flex; align-items: center; gap: 6px; margin: 3px 14px 3px 0;
  font-size: 12.5px; font-weight: 600; color: var(--ace-text); cursor: pointer;
  text-transform: none; letter-spacing: normal;
}
.ab-rp .ab-brand-opt input { margin: 0; accent-color: var(--ace-navy); cursor: pointer; }

/* Chip strip inside a padded card body (weeks-shown picker) */
.ab-rp .ab-sec-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; }

/* "Show all" footer under a flush table */
.ab-rp .ab-more { padding: 10px 14px; text-align: center; border-top: 1px solid var(--ace-border-soft); }

/* Movers: two tables side by side inside one padded body */
.ab-rp .ab-subhead {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ace-text-secondary); margin: 0 0 8px 2px;
}
/* min-width:0 on the two halves: a grid item defaults to min-width:auto, which
   here is the table's min-content width, so on a phone the track grew past the
   card body and overflow:hidden clipped the right-hand columns with no scroll.
   Letting the half shrink puts the scrolling back on its .rp-tw. */
.ab-rp .ab-movers > div { min-width: 0; }
.ab-rp .ab-movers .rp-tw { border: 1px solid var(--ace-border-soft); border-radius: 10px; }
.ab-rp .ab-delta { font-weight: 800; font-variant-numeric: tabular-nums; }
.ab-rp .ab-delta.up { color: #3a8a25; }
.ab-rp .ab-delta.dn { color: var(--ace-critical); }

/* Weekly Performance grid: one 3-row block per portfolio (this year / last
   year / growth), sticky label column, summary columns on the right. */
.ab-rp .ab-grid-wrap { border: 1px solid var(--ace-border); border-radius: 10px; max-height: 620px; }
.ab-rp .ab-grid th, .ab-rp .ab-grid td { white-space: nowrap; padding: 5px 9px; }
.ab-rp .ab-grid thead th { font-size: 9.5px; }
.ab-rp .ab-grid thead th.sticky { left: 0; z-index: 3; text-align: left; }
.ab-rp .ab-grid tbody td { border-bottom: 0; font-size: 12px; }
.ab-rp .ab-grid td.sticky { position: sticky; left: 0; z-index: 2; }
.ab-rp .ab-grid .sticky { border-right: 2px solid var(--ace-border); }
.ab-rp .ab-grid .sep { border-left: 2px solid var(--ace-border); }
.ab-rp .ab-grid td.sum { background: var(--ace-surface-alt); }
.ab-rp .ab-grid tr.ty td { color: var(--ace-text); font-weight: 600; }
.ab-rp .ab-grid tr.ly td { color: var(--ace-text-muted); font-style: italic; }
.ab-rp .ab-grid tr.gw td { font-weight: 700; border-bottom: 1px solid var(--ace-border); }
.ab-rp .ab-grid tr.gw td.up { color: #3a8a25; }
.ab-rp .ab-grid tr.gw td.dn { color: var(--ace-critical); }
.ab-rp .ab-grid tr.gw td.flat { color: var(--ace-text-secondary); }
.ab-rp .ab-grid tr td.na { color: var(--ace-text-muted); font-style: normal; font-weight: 500; }
.ab-rp .ab-grid tr.ty td.lbl {
  background: #eef4f9; color: var(--ace-text); font-weight: 700; font-size: 12px;
  vertical-align: middle; border-bottom: 1px solid var(--ace-border);
}
.ab-rp .ab-grid tr.ty.child td.lbl { background: var(--ace-surface-alt); font-weight: 500; }
.ab-rp .ab-grid-caret {
  border: 0; background: none; cursor: pointer; font-family: inherit;
  color: var(--ace-navy); font-size: 11px; font-weight: 800; padding: 0 6px 0 0;
}
.ab-rp .ab-grid-legend { margin-top: 10px; font-size: 11.5px; line-height: 1.6; color: var(--ace-text-secondary); }
.ab-rp .ab-grid-legend .warn { color: #b45309; font-weight: 700; }

/* Bar trends: weekly volume, and monthly market total with our overlay */
.ab-rp .ab-trend {
  display: flex; align-items: flex-end; gap: 2px; height: 200px;
  padding: 10px 8px 6px; background: var(--ace-surface-alt); border-radius: 10px;
}
.ab-rp .ab-trend.tall { height: 240px; }
.ab-rp .ab-trend-col { flex: 1; min-width: 0; text-align: center; position: relative; }
.ab-rp .ab-trend-bar { background: var(--ace-blue); border-radius: 3px 3px 0 0; margin: 0 1px; position: relative; }
.ab-rp .ab-trend-bar.market { background: var(--ace-amber); }
.ab-rp .ab-trend-bar .ours { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ace-navy); }
.ab-rp .ab-trend-lbl {
  font-size: 9px; color: var(--ace-text-muted); margin-top: 4px; height: 40px;
  writing-mode: vertical-rl; transform: rotate(180deg);
}
.ab-rp .ab-trend-note { margin-top: 8px; font-size: 11.5px; color: var(--ace-text-secondary); }
.ab-rp .ab-trend-note .sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.ab-rp .ab-trend-note .sw.market { background: var(--ace-amber); }
.ab-rp .ab-trend-note .sw.ours { background: var(--ace-navy); }

@media (max-width: 640px) {
  .ab-rp .rp-divider { display: none; }
  .ab-rp .rp-chip.rp-input { width: 118px; }
}

/* ---- Added 2026-09-10 with the helper restyle (all scoped to .ab-rp) ---- */

/* Section meta that carries a tone: abSection() emits a bare
   <span class="rp-card-meta">, so a page passes `<span class="crit">…</span>`
   as the meta to colour it (weekly dashboard's warehouse stock-out card). */
.ab-rp .rp-card-meta .crit { color: var(--ace-critical); }

/* "← Back to …" row on the store detail, territory TM / gaps / distro /
   OOS and priority-SKU pages. It is the first sibling after the band, so
   .rp-page pulls it up over the navy strip; as a bare text link it would
   float inside the band. The link is an .rp-btn pill (its own white
   surface) and this wrapper lays one or two of them in a row. */
.ab-rp .ab-back { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }

/* /ab/segmentation tier cards: four across on desktop, two across on a phone.
   The inline repeat(4,1fr) could not shrink below the cards' content and
   overflowed the body to ~476px at 375px, clipping the right-hand cards. */
.ab-rp .ab-seg-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) {
  .ab-rp .ab-seg-tiers { grid-template-columns: 1fr 1fr; }
}
