/* ============================================================
   bs-design-system.css — canonical B&S typography + placeholders
   ------------------------------------------------------------
   Authored 2026-05-28 per planning/sprint-bs-feedback/
   heading-style-audit.md, using #inventory-aging as the
   role-model page.

   These classes consolidate divergent heading patterns across
   bs-fulfillment, bs-customer-service, bs-store-traffic,
   bs-media-funnel, bs-media-product, bs-sku-performance.

   Tier reference (full spec in design-guideline.md):
     T1  .bs-section-title         page-level section label
     T1b .bs-card-section-title    subsection title inside card body
     T2  .card__title              card / subsection title (exists)
     T3  .card__subtitle           secondary line under title (exists)
     T4  .fin-table th             table column header (exists)
     T5  .fin-table td             table row label/cell (exists)
   ============================================================ */

/* ---- T1: Page-level section title ------------------------- */
.bs-section-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-6) 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Hairline rule trailing a T1 label (optional decorative variant) */
.bs-section-title--ruled::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Compact variant (tighter top margin when following another label) */
.bs-section-title--compact {
  margin-top: var(--space-3);
}

/* ---- T1b: Nested card-body section title ------------------ */
.bs-card-section-title {
  font-family: var(--font-sans);
  font-size: var(--font-body);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Placeholder card ("Coming soon") --------------------- */
/* For charts/sub-pages that the reference shows but are not yet
   implemented in the page — render the card with a subtle
   "Coming soon" badge so the UI completeness matches the spec
   even before the chart is wired. */
.placeholder-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
}

.placeholder-card .card__title,
.placeholder-card .bs-card-section-title {
  color: var(--text-secondary);
  margin: 0;
}

.placeholder-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  padding: 4px var(--space-2);
  border-radius: var(--radius-sm);
}
.placeholder-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.placeholder-card__hint {
  font-size: var(--font-small);
  color: var(--text-tertiary);
  text-align: center;
  max-width: 32ch;
}

/* ============================================================
   Loading skeletons — paired with vercel/js/bs-skeleton.js
   ------------------------------------------------------------
   Shimmer animation runs on a CSS variable gradient so a single
   keyframes block drives every variant. Respects prefers-reduced-
   motion: in that case we hold a static muted background.
   ============================================================ */

@keyframes bs-skeleton-shimmer {
  0%   { background-position: -120% 0; }
  100% { background-position:  220% 0; }
}

.bs-skeleton {
  display: block;
  width: 100%;
}
.bs-skeleton__sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Shared shimmer surface — applied to every "block" element below. */
.bs-skeleton__card,
.bs-skeleton__line,
.bs-skeleton__cell,
.bs-skeleton__chart-bar {
  position: relative;
  background: linear-gradient(
    90deg,
    var(--bg-hover) 0%,
    var(--bg-elevated) 40%,
    var(--bg-hover) 80%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: bs-skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  .bs-skeleton__card,
  .bs-skeleton__line,
  .bs-skeleton__cell,
  .bs-skeleton__chart-bar { animation: none; background: var(--bg-hover); }
}

/* Default card variant */
.bs-skeleton__card { width: 100%; min-height: 140px; }

/* KPI strip variant — flex row of mini tiles */
.bs-skeleton--kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.bs-skeleton__kpi {
  flex: 1 1 160px;
  min-width: 140px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.bs-skeleton__line { height: 12px; border-radius: 4px; }
.bs-skeleton__line--label { width: 55%; height: 10px; opacity: 0.7; }
.bs-skeleton__line--value { width: 75%; height: 22px; }
.bs-skeleton__line--text  { width: 100%; height: 12px; margin-bottom: var(--space-2); }
.bs-skeleton__line--text:nth-child(even)     { width: 92%; }
.bs-skeleton__line--text:last-child           { width: 60%; }

/* Chart variant — fake bar chart */
.bs-skeleton__chart {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  height: 240px;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.bs-skeleton__chart-bar {
  flex: 1;
  min-width: 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* Table-rows variant — N rows × ~4 cells */
.bs-skeleton__table { display: flex; flex-direction: column; gap: var(--space-2); }
.bs-skeleton__row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.bs-skeleton__cell { flex: 1; height: 16px; }
.bs-skeleton__cell--wide { flex: 2.5; }

/* ============================================================
   FILTER ATOMS — Phase 2 of filter consolidation
   ------------------------------------------------------------
   Section-local controls reused across BS dashboards. Most lean
   on existing pnl-compare-toggle + filter-item shells so the
   visual language stays uniform; only net-new bits live here.
   ============================================================ */

/* SearchableMultiSelect — popover header + checkbox-style rows */
.searchable-multi__actions {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}
.searchable-multi__act {
  font-size: var(--font-xs, 0.6875rem);
  color: var(--color-action);
  background: none;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  text-decoration: underline;
}
.searchable-multi__act:hover { opacity: 0.8; }
.searchable-multi__opt {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-align: left;
}
.searchable-multi__check {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: var(--font-body);
  color: var(--text-tertiary);
  width: 1em;
  flex-shrink: 0;
}
.searchable-multi__opt--checked .searchable-multi__check { color: var(--color-action); }
.searchable-multi__opt--checked .searchable-multi__label  { color: var(--text-primary); font-weight: 600; }

/* PeriodComparePills + GranularitySegment + ViewToggle
   piggy-back on existing .pnl-compare-toggle shells.
   Only need namespacing hooks here. */
.period-compare-pills,
.granularity-segment,
.view-toggle { display: inline-flex; }
.view-toggle__btn {
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.view-toggle__btn svg { display: block; }

/* TopNDropdown — single native select dressed as a filter-item */
.top-n-dropdown { display: inline-flex; align-items: center; gap: var(--space-2); }
.top-n-dropdown__select {
  min-width: 64px;
  padding: 4px 8px;
  height: 28px;
}
