/* ============================================================
   Brand & Store — Store Traffic  (bs-tr-*)
   Scoped to .bs-tr-page. Tokens only.
   ============================================================ */

.bs-tr-page { display: flex; flex-direction: column; gap: var(--space-5, 20px); min-width: 0; }
.bs-tr-page > * { min-width: 0; }

.bs-tr-approx-note { font-size: var(--font-xs, 11px); color: var(--text-tertiary, #8C95A4); }

.bs-tr-section { display: flex; flex-direction: column; gap: var(--space-3, 12px); }
.bs-tr-section-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3, 12px); }

.bs-tr-state { padding: var(--space-6, 24px); text-align: center; color: var(--text-tertiary, #8C95A4); font-size: var(--font-small, 12px); }
.bs-tr-state--error { color: var(--color-danger, #DC2626); }
.bs-tr-empty-title { font-size: var(--font-base, 15px); font-weight: 600; color: var(--text-secondary, #5F6775); margin-bottom: var(--space-2, 8px); }
.bs-tr-empty-sub { font-size: var(--font-small, 12px); color: var(--text-tertiary, #8C95A4); max-width: 420px; margin: 0 auto; line-height: 1.5; }

/* KPI band — AUD-TRA-A1: 5-card primary + Show-more secondary grid */
.bs-tr-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4, 16px); margin-top: var(--space-3, 12px); }
.bs-tr-kpi-grid--primary { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bs-tr-kpi-grid--secondary { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 0; }
.bs-tr-kpi-card--secondary { background: var(--bg-base); border-style: dashed; }

/* Expander row (mirrors bs-overall-performance) */
.bs-tr-expander-row { display: flex; align-items: center; gap: var(--space-3, 12px); margin-top: var(--space-4, 16px); }
.bs-tr-expander-line { flex: 1; height: 1px; background: var(--border-default); }
.bs-tr-btn-expand { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--space-4, 16px); border-radius: var(--radius-full, 999px); border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; transition: all var(--transition-fast, 0.15s); white-space: nowrap; }
.bs-tr-btn-expand:hover { border-color: var(--color-action); color: var(--color-action); }
.bs-tr-btn-expand--open { border-color: var(--color-action); color: var(--color-action); background: color-mix(in srgb, var(--color-action) 10%, var(--bg-surface)); }
.bs-tr-kpi-secondary { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.3s ease, opacity 0.25s ease, margin-top 0.2s ease; margin-top: 0; }
.bs-tr-kpi-secondary--open { max-height: 600px; opacity: 1; margin-top: var(--space-3, 12px); }
.bs-tr-kpi-card { display: flex; flex-direction: column; gap: 4px; padding: var(--space-4, 16px); background: var(--bg-surface, #fff); border: 1px solid var(--border-subtle, #E2E8F0); border-radius: var(--radius-md, 8px); min-width: 0; }
.bs-tr-kpi-label { font-size: 11px; font-weight: 600; color: var(--text-tertiary, #8C95A4); text-transform: uppercase; letter-spacing: 0.4px; display: inline-flex; align-items: center; }
.bs-tr-kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-right: 6px; color: var(--color-action, #2563EB); }
.bs-tr-kpi-icon svg { width: 14px; height: 14px; }
.bs-tr-kpi-value { font-size: 22px; font-weight: 700; font-family: var(--font-mono, 'Geist Mono', monospace); font-variant-numeric: tabular-nums; color: var(--text-primary, #111318); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-tr-approx { color: var(--text-tertiary, #8C95A4); font-weight: 400; margin-left: 3px; }

/* trend */
.bs-tr-trend-wrap { width: 100%; min-width: 0; }
.bs-tr-legend { display: flex; justify-content: center; gap: var(--space-5, 20px); margin-top: var(--space-2, 8px); font-size: 11px; color: var(--text-secondary, #5F6775); }
.bs-tr-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bs-tr-sw { display: inline-block; width: 10px; height: 10px; }

/* source of revenue ranked bars
   .bs-tr-sor-total is a sibling of .card__title inside .bs-tr-section-header
   (flex, space-between). The earlier `float: right` made it render as a
   superscript on top of the title; the section-header's space-between
   naturally pushes it to the right edge without any float. */
.bs-tr-sor-total { font-size: 12px; font-weight: 600; color: var(--text-secondary, #5F6775); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-tr-sor { display: flex; flex-direction: column; gap: var(--space-2, 8px); margin-top: var(--space-2, 8px); }
.bs-tr-sor-row { display: grid; grid-template-columns: 120px 1fr 110px 56px; align-items: center; gap: var(--space-3, 12px); }
.bs-tr-sor-name { font-size: 13px; color: var(--text-primary, #111318); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-tr-sor-bar-wrap { background: var(--bg-inset, #EAEBEE); border-radius: var(--radius-xs, 4px); height: 18px; overflow: hidden; }
.bs-tr-sor-bar { height: 100%; background: var(--color-action, #2563EB); border-radius: var(--radius-xs, 4px); }
.bs-tr-sor-gmv, .bs-tr-sor-pct { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary, #5F6775); }

/* SoR summary table — dashboard table styling standard (design-guideline.md
   "Dashboard table styling standard", 2026-05-31). Flat table, no frozen
   column → S1 bold+centered headers · S2 zebra · numeric right + tabular-nums. */
.bs-tr-sor-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bs-tr-sor-table-wrap { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: auto; }
.bs-tr-sor-table thead { position: sticky; top: var(--bs-header-h, 0); z-index: 2; }
.bs-tr-sor-table th { background: var(--bg-inset); font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--font-xs); padding: var(--space-2, 8px) var(--space-3, 12px); color: var(--text-secondary, #5F6775); border-bottom: 1px solid var(--border-default, #E2E8F0); white-space: nowrap; }
.bs-tr-sor-table td { padding: var(--space-2, 8px) var(--space-3, 12px); color: var(--text-primary, #111318); border-bottom: 1px solid var(--border-subtle); }
.bs-tr-sor-table .td-src { text-align: left; white-space: nowrap; }
.bs-tr-sor-table .td-num, .bs-tr-sor-table .td-pct { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono, 'Geist Mono', monospace); }
.bs-tr-sor-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--text-primary) 3.5%, transparent); }
.bs-tr-sor-table tbody tr:hover td { background: var(--bg-hover); }
.bs-tr-sor-table .bs-tr-sor-total-row td { font-weight: 700; border-top: 1px solid var(--border-default, #E2E8F0); background: transparent; }
.bs-tr-sor-dot { display: inline-block; width: 9px; height: 9px; border-radius: var(--radius-xs, 3px); margin-right: 7px; vertical-align: middle; }

@media (max-width: 1024px) {
  .bs-tr-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bs-tr-sor-row { grid-template-columns: 90px 1fr 90px 48px; }
}

/* ── Period-compare KPI deltas (mig 226) ── */
.bs-tr-kpi-value-row { display: flex; align-items: baseline; gap: var(--space-2, 8px); flex-wrap: wrap; min-width: 0; justify-content: flex-end; } /* feedback 2026-06-09 #1 — right-align the value+delta cluster */
.bs-tr-delta { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; font-family: var(--font-mono, monospace); }
.bs-tr-delta--good { color: var(--color-success, #16A34A); background: color-mix(in srgb, var(--color-success) 14%, transparent); }
.bs-tr-delta--bad { color: var(--color-danger, #DC2626); background: color-mix(in srgb, var(--color-danger) 14%, transparent); }
.bs-tr-delta--flat { color: var(--text-tertiary, #8C95A4); }
.bs-tr-section-header--note { margin-top: 4px; }
