/* ============================================================
   Ace App — Saskatchewan pages on the Reports design system
   ──────────────────────────────────────────────────────────
   Every /sk page (and the /kdp/sk twins) renders inside the shared `.rp`
   shell from reports.css (rp-band / rp-filter / rp-kpi / rp-card / rp-tbl /
   rp-delta / rp-pill) with the root `rp rp-page sk-rp`. Markup comes from
   utils/sk-helpers.js (all pages) and the thin utils/sk-rp.js layer (the two
   flagship dashboards). Everything here is the SK-only skin on top of that
   system, scoped under `.sk-rp` so no other page can see it.

   Section collapse is skBindSections() in utils/sk-helpers.js: it flips the
   body's inline display, the card's .is-collapsed and the +/− text on
   .rp-toggle. The chrome for that is the generic "Collapsible cards" block in
   reports.css; nothing here restyles it.
   ============================================================ */

/* ── Non-flagship pages ── */
/* Muted hint text inside a filter bar (the distribution lookback note). */
.sk-rp .sk-hint { font-size: 11px; line-height: 1.5; color: var(--ace-text-muted); }

/* ── Filter bar (an .rp-filter) ── */
.sk-rp .sk-filters { row-gap: 10px; }
.sk-rp .sk-filters .rp-fgroup { gap: 6px; }
.sk-rp .sk-filters .rp-flabel { margin-right: 4px; }

/* KDP portal: kdp-mode.js already hides the preset chips, the opener and the
   picker by id; drop the stranded "Portfolio" label and its divider too. */
body.kdp-mode .sk-rp .sk-portfolio-group,
body.kdp-mode .sk-rp .sk-portfolio-sep { display: none; }

/* Brand picker (the view toggles it via inline display, same as before) */
.sk-rp .sk-picker {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(2, 60, 91, 0.06);
  box-shadow: 0 4px 16px rgba(2, 60, 91, 0.08);
  margin: -8px 0 16px;
  overflow: hidden;
}
.sk-rp .sk-picker-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ace-border);
}
.sk-rp .sk-picker-actions { display: flex; gap: 6px; }
.sk-rp .sk-picker-body {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 16px;
  max-height: 280px; overflow-y: auto;
}
.sk-rp .sk-picker .rp-empty { padding: 18px 16px; }
.sk-rp .sk-pick {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 8px; border-radius: 999px;
  background: var(--ace-surface-hover); color: var(--ace-text-secondary);
  border: 1px solid transparent;
  font-size: 12px; font-weight: 700; cursor: pointer; user-select: none;
}
.sk-rp .sk-pick:hover { background: var(--ace-ice); color: var(--ace-navy); }
.sk-rp .sk-pick input { width: 13px; height: 13px; margin: 0; accent-color: var(--ace-navy); cursor: pointer; }
.sk-rp .sk-pick:has(input:checked) { background: var(--ace-navy); color: #fff; }
.sk-rp .sk-pick:has(input:checked) input { accent-color: var(--ace-blue); }

/* ── Notes (errors are the shared .rp-note.crit that skError emits) ── */
.sk-rp .sk-note {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 16px; border-radius: 12px;
  background: var(--ace-ice); color: var(--ace-navy);
  border: 1px solid rgba(2, 60, 91, 0.06);
  font-size: 12px; font-weight: 600;
}
.sk-rp .sk-note.warn { background: var(--ace-peach); color: #7a4715; border-color: rgba(122, 71, 21, 0.12); }
.sk-rp .sk-note svg { flex-shrink: 0; }

/* Collapsible section cards carry no skin here. `.sk-section-body` on the body
   is a JS hook for skBindSections() only: never give it padding, or it beats
   .rp-card-body.flush and pads the edge-to-edge tables. */

/* ── Tables (all .rp-tbl) ── */
.sk-rp .rp-tbl th,
.sk-rp .rp-tbl td { white-space: nowrap; }
.sk-rp .rp-tbl td.nm { font-weight: 700; }
.sk-rp .rp-tbl td.muted { color: var(--ace-text-muted); font-size: 11px; }
.sk-rp .sk-muted { color: var(--ace-text-muted); font-size: 11px; font-weight: 600; }
.sk-rp .sk-na { color: var(--ace-text-muted); }
.sk-rp .sk-pos { color: #3a8a25; font-weight: 800; }
.sk-rp .sk-neg { color: var(--ace-critical); font-weight: 800; }

/* Our rows in the monthly brand-family rank */
.sk-rp .rp-tbl tr.is-ace { background: var(--ace-ice); }
.sk-rp .rp-tbl tr.is-ace:hover { background: #d9f1fb; }
.sk-rp .rp-tbl tr.is-ace td:first-child { box-shadow: inset 3px 0 0 var(--ace-blue); }
.sk-rp .rp-tbl tr.is-ace td.nm { color: var(--ace-navy); }

/* ── Movers: gainers and decliners side by side inside one flush card ── */
.sk-rp .sk-movers { display: grid; grid-template-columns: 1fr 1fr; }
.sk-rp .sk-mover { min-width: 0; }
.sk-rp .sk-mover + .sk-mover { border-left: 1px solid var(--ace-border); }
.sk-rp .sk-mover-h {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--ace-border);
  font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ace-text-secondary);
}
.sk-rp .sk-mover-h .dot { width: 8px; height: 8px; border-radius: 50%; }
.sk-rp .sk-mover-h.up .dot { background: var(--ace-positive); }
.sk-rp .sk-mover-h.dn .dot { background: var(--ace-negative); }

/* ── Bar trend (weekly cases; monthly market vs ours, stacked) ── */
.sk-rp .sk-bars {
  display: flex; align-items: flex-end; gap: 2px;
  height: 200px; padding: 12px 12px 0;
  background: var(--ace-surface-alt);
  border: 1px solid var(--ace-border-soft); border-radius: 12px;
  overflow: hidden;
}
.sk-rp .sk-bars.tall { height: 250px; }
.sk-rp .sk-bar { flex: 1; min-width: 0; text-align: center; }
.sk-rp .sk-bar-v {
  display: block; position: relative;
  background: var(--ace-navy); border-radius: 3px 3px 0 0;
  opacity: 0.85; transition: opacity 0.12s ease, background 0.12s ease;
}
.sk-rp .sk-bar:hover .sk-bar-v { opacity: 1; }
.sk-rp .sk-bar.stack .sk-bar-v { background: var(--ace-ice); opacity: 1; }
.sk-rp .sk-bar.stack:hover .sk-bar-v { background: #d9f1fb; }
.sk-rp .sk-bar-ace { position: absolute; left: 0; right: 0; bottom: 0; display: block; background: var(--ace-navy); }
.sk-rp .sk-bar-lbl {
  display: inline-block; height: 40px; margin-top: 4px;
  font-size: 9px; font-weight: 600; color: var(--ace-text-muted);
  writing-mode: vertical-rl; transform: rotate(180deg);
}
.sk-rp .sk-bars-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 8px;
  font-size: 11px; font-weight: 600; color: var(--ace-text-muted);
  font-variant-numeric: tabular-nums;
}
.sk-rp .sk-legend { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; }
.sk-rp .sk-legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sk-rp .sk-legend .sw.market { background: var(--ace-ice); border: 1px solid rgba(2, 60, 91, 0.12); }
.sk-rp .sk-legend .sw.ace { background: var(--ace-navy); }

@media (max-width: 900px) {
  .sk-rp .sk-movers { grid-template-columns: 1fr; }
  .sk-rp .sk-mover + .sk-mover { border-left: 0; border-top: 1px solid var(--ace-border); }
}
