/* ============================================================================
   dash.css — styles for the interactive dashboard component.
   Uses the site tokens from style.css. No new colours introduced.
   ========================================================================== */

.dash {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: clamp(18px, 3vw, 30px);
  container-type: inline-size;
}

/* ---------- head ---------- */
.dash__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.dash__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 4px;
}
.dash__sub { font-size: 14px; color: var(--muted-2); margin: 0; }

.dash__reset {
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.dash__reset:hover { border-color: var(--ink); color: var(--ink); }
.dash__reset[hidden] { display: none; }

/* ---------- filters ---------- */
.dash__filters { display: grid; gap: 14px; padding: 20px 0; }
.dash__group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash__glab {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  min-width: 104px;
}
.dash__pill {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), transform 0.1s var(--ease);
}
.dash__pill:hover { border-color: var(--ink); color: var(--ink); }
.dash__pill:active { transform: scale(0.97); }
.dash__pill.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- KPIs ---------- */
.dash__kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
@container (min-width: 640px) {
  .dash__kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.dash__kpi { background: var(--paper); padding: 16px 18px; }
.dash__kpilab {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin: 0 0 6px;
}
.dash__kpival {
  font-size: clamp(21px, 3.4cqi, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- cards ---------- */
.dash__card {
  margin: 0 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 10px;
}
.dash__card[hidden] { display: none; }
.dash__cardlab {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.dash__grid { display: grid; gap: 20px; }
.dash__grid[hidden] { display: none; }
@container (min-width: 720px) {
  .dash__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash__grid .dash__card { margin-bottom: 0; }
}

.dash__svg { width: 100%; height: auto; display: block; overflow: visible; }

/* ---------- chart primitives ---------- */
.dash__gridline { stroke: var(--line); stroke-width: 1; }
.dash__axis { font-size: 11px; fill: var(--muted-2); font-family: inherit; }
.dash__line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.dash__area { fill: var(--accent); opacity: 0.09; }
.dash__dot { fill: var(--accent); opacity: 0; transition: opacity 0.15s var(--ease); }
.dash__dot:hover { opacity: 1; }

.dash__barlab { font-size: 12.5px; fill: var(--ink); font-family: inherit; }
.dash__barval { font-size: 12px; fill: var(--muted-2); font-family: inherit; font-variant-numeric: tabular-nums; }
.dash__barfill { fill: var(--accent); opacity: 0.85; transition: opacity 0.18s var(--ease); }
.dash__bar.is-pickable { cursor: pointer; }
.dash__bar.is-pickable:hover .dash__barfill { opacity: 1; }
.dash__bar.is-pickable:hover .dash__barlab { fill: var(--accent); }
.dash__bar:focus { outline: none; }
.dash__bar:focus-visible .dash__barfill { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- states ---------- */
.dash__loading, .dash__empty {
  font-size: 14px;
  color: var(--muted-2);
  padding: 28px 0;
  margin: 0;
  text-align: center;
}
.dash__empty[hidden] { display: none; }

.dash__live {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .dash__pill, .dash__reset, .dash__barfill, .dash__dot { transition: none; }
}
