/* ==========================================================================
 * Festival Studio - a stand's dashboard and leads (js/ui/stand-dashboard.js, Milestone B12)
 *
 *  1. Numbers         st-sd-tiles  st-sd-updated
 *  2. Busiest hours   st-sd-chart  st-sd-col (booth visits and check-ins stacked)
 *  3. By activity     st-sd-acts
 *  4. Leads           st-sd-lead
 *  5. In the stand drawer (compact), narrow screens, reduced motion
 * ========================================================================== */

/* ---------- 1. Numbers ---------- */
.st-sd-body { display: flex; flex-direction: column; gap: 16px; }
.st-sd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.st-sd-tiles .st-stat { padding: 10px 12px; background: var(--st-bg-elev); }
.st-sd-tiles .st-stat__label { white-space: nowrap; }
.st-sd-tiles .st-stat__value { font-size: 24px; }
.st-sd-updated { align-self: center; font-size: 12px; color: var(--st-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-sd-note { font-size: 12.5px; line-height: 1.5; color: var(--st-text-muted); }
.st-sd-note[hidden] { display: none; }

/* ---------- 2. Busiest hours ---------- */
.st-sd-chart { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--st-r-12); border: 1px solid var(--st-border); background: var(--st-bg-elev); }
.st-sd-chart__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; }
.st-sd-chart__title { font-size: 13px; font-weight: 600; }
.st-sd-chart__legend { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--st-text-muted); }
.st-sd-key { display: inline-flex; align-items: center; gap: 6px; }
.st-sd-key::before { content: ''; width: 10px; height: 10px; border-radius: 3px; }
.st-sd-key--visits::before { background: var(--st-violet-2); }
.st-sd-key--checkins::before { background: var(--st-green); }
.st-sd-chart__plot { display: flex; align-items: stretch; gap: 4px; height: 150px; border-bottom: 1px solid var(--st-border-strong); }
/* A column: its number, then its bar, stacked from the bottom. */
.st-sd-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.st-sd-col__value { height: 16px; line-height: 16px; text-align: center; font-size: 10.5px; color: var(--st-text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-sd-col__stack { display: flex; flex-direction: column; min-height: 0; border-radius: 4px 4px 0 0; overflow: hidden; }
.st-sd-col__stack > span { display: block; min-height: 2px; }
.st-sd-col__visits { background: var(--st-violet-2); }
.st-sd-col__checkins { background: var(--st-green); }
.st-sd-col.is-peak .st-sd-col__value { color: var(--st-text); font-weight: 600; }
.st-sd-col.is-peak .st-sd-col__visits { background: #9b85ff; }
.st-sd-chart__axis { display: flex; gap: 4px; }
.st-sd-chart__axis span { flex: 1 1 0; min-width: 0; font-size: 10.5px; color: var(--st-text-muted); text-align: center; white-space: nowrap; overflow: visible; }
.st-sd-chart__summary { font-size: 12.5px; color: var(--st-text-dim); }
.st-sd-chart__empty { display: flex; align-items: center; gap: 10px; padding: 18px 4px; font-size: 13px; color: var(--st-text-muted); }

/* ---------- 3. By activity ---------- */
.st-sd-acts:empty { display: none; }
.st-sd-acts__head, .st-sd-acts__row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 76px; gap: 10px; align-items: center; }
.st-sd-acts__head { padding: 0 2px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--st-text-muted); }
.st-sd-acts__head span:not(:first-child), .st-sd-acts__row span:not(:first-child) { text-align: right; }
.st-sd-acts__list { margin: 0; padding: 0; list-style: none; }
.st-sd-acts__row { padding: 8px 2px; border-top: 1px solid var(--st-border); font-size: 13.5px; }

/* ---------- 4. Leads ---------- */
.st-sd-leads__list { margin: 0; padding: 0; list-style: none; }
.st-sd-lead { display: flex; flex-direction: column; gap: 4px; padding: 10px 2px; border-top: 1px solid var(--st-border); }
.st-sd-lead:first-child { border-top: 0; padding-top: 0; }
.st-sd-lead__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.st-sd-lead__name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.st-sd-lead__when { flex: 0 0 auto; font-size: 12px; color: var(--st-text-muted); white-space: nowrap; }
.st-sd-lead__fields { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.st-sd-lead__fields .st-link { overflow-wrap: anywhere; }
.st-sd-lead__shared { font-size: 12px; color: var(--st-text-muted); }

/* ---------- 5. In the stand drawer, narrow screens, reduced motion ---------- */
.st-sd-card--compact { background: transparent; border: 0; box-shadow: none; }
.st-sd-card--compact > .st-card__header, .st-sd-card--compact > .st-card__body { padding-left: 0; padding-right: 0; }
@media (max-width: 560px) {
  .st-sd-chart__plot { height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-sd-col__stack { transition: none; }
}
