/* --- Analytics dashboard -------------------------------------------- */
/* KPI strip: horizontal scroll on narrow screens, fixed cards on wide. */
.ds-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.ds-kpi-card {
  background: #fff;
  border: 1px solid var(--ds-parchment-shadow);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ds-kpi-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-kpi-icon {
  font-size: 1rem;
}
.ds-kpi-label {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ds-ink-soft);
  font-weight: 600;
}
.ds-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ds-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
@media (max-width: 900px) {
  .ds-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Aggregate cards: two-column grid of per-field cards with bars. */
.ds-aggregate-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .ds-aggregate-grid {
    grid-template-columns: 1fr;
  }
}
.ds-agg-card {
  background: #fff;
  border: 1px solid var(--ds-parchment-shadow);
  border-radius: 10px;
  padding: 14px 16px;
}
.ds-agg-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ds-parchment-shadow);
}
.ds-agg-label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ds-ink);
  word-break: break-word;
}
.ds-agg-meta {
  white-space: nowrap;
}
.ds-agg-bar {
  margin-bottom: 8px;
}
.ds-agg-bar:last-child {
  margin-bottom: 0;
}
.ds-agg-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
  font-size: 0.82rem;
}
.ds-agg-bucket {
  font-weight: 500;
  color: var(--ds-ink);
}
.ds-agg-count {
  color: var(--ds-ink-soft);
  font-variant-numeric: tabular-nums;
}
.ds-agg-bar-track {
  background: var(--ds-parchment-mid);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.ds-agg-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--ds-brass) 0%, var(--ds-leather) 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.ds-agg-text-item {
  padding: 6px 0;
  border-bottom: 1px solid var(--ds-parchment-shadow);
}
.ds-agg-text-item:last-child {
  border-bottom: none;
}
.ds-agg-text-val {
  color: var(--ds-ink);
  font-size: 0.88rem;
}
.ds-agg-text-doc {
  margin-top: 2px;
}

/* --- Analytics 2 — bubble matrix ------------------------------------ */
/* One row per fund. Bubbles inside each row are circular buttons sized
   by document count. Whole row is on a soft surface so the bubbles
   feel like they're floating on a fund's own canvas. */
.ds-bubble-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ds-bubble-fund-row {
  background: #fff;
  border: 1px solid var(--ds-parchment-shadow);
  border-radius: 12px;
  padding: 14px 18px 18px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease;
}
.ds-bubble-fund-row:hover {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.ds-bubble-fund-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--ds-parchment-shadow);
}
.ds-bubble-fund-title {
  display: flex;
  align-items: center;
}
.ds-bubble-fund-name {
  font-family: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ds-mahogany-deep);
  letter-spacing: 0.01em;
}
.ds-bubble-fund-count {
  font-variant-numeric: tabular-nums;
}

.ds-bubble-row-bubbles {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 22px;
  min-height: 150px;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* The outer button is a transparent column container: circle on top,
   always-visible caption underneath. This guarantees the status name
   stays readable no matter how small the bubble itself becomes. */
.ds-bubble {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ds-ink);
  outline: none;
  width: 110px;     /* fixed column width so captions line up tidily */
  text-align: center;
}

/* The circle owns the colour, size, and shadow. Sized inline by the
   renderer (width / height in px) — everything else is here. */
.ds-bubble-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  box-shadow:
    0 4px 14px rgba(15, 23, 42, 0.18),
    inset 0 -6px 14px rgba(0, 0, 0, 0.12),
    inset 0 4px 10px rgba(255, 255, 255, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.ds-bubble:hover .ds-bubble-circle {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 8px 22px rgba(15, 23, 42, 0.24),
    inset 0 -6px 14px rgba(0, 0, 0, 0.10),
    inset 0 4px 10px rgba(255, 255, 255, 0.30);
  filter: brightness(1.04);
}
.ds-bubble:focus-visible .ds-bubble-circle {
  box-shadow:
    0 0 0 3px rgba(37, 99, 235, 0.45),
    0 4px 14px rgba(15, 23, 42, 0.18);
}
.ds-bubble-count {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  font-variant-numeric: tabular-nums;
}

/* Caption sits below the circle and is always rendered, regardless
   of bubble diameter. We allow up to two lines so longer labels like
   "Filled — in review" never get ellipsed. */
.ds-bubble-caption {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ds-ink-soft);
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  max-width: 100%;
}
.ds-bubble:hover .ds-bubble-caption {
  color: var(--ds-ink);
}

/* Legend strip below the page hint. */
.ds-bubble-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
}
.ds-bubble-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ds-bubble-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.18);
}
.ds-bubble-legend-text {
  color: var(--ds-ink-soft);
  letter-spacing: 0.01em;
}

/* Detail panel — fills when a bubble is clicked. */
.ds-bubble-detail {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--ds-parchment-shadow);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 60px;
}
.ds-bubble-detail-empty {
  padding: 6px 2px;
}
.ds-bubble-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ds-parchment-shadow);
}
.ds-bubble-detail-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.18);
}

/* On narrow screens, let bubble columns shrink a bit so two fit
   side-by-side on phones. The captions still get up to two lines. */
@media (max-width: 700px) {
  .ds-bubble-fund-row {
    padding: 12px 14px;
  }
  .ds-bubble-row-bubbles {
    gap: 12px 14px;
    min-height: 120px;
  }
  .ds-bubble {
    width: 92px;
  }
  .ds-bubble-caption {
    font-size: 0.68rem;
  }
}

/* Invite-accept page meta chips. Pills next to the welcome heading
 * that surface the new user's role + team + inviter as structured
 * data rather than plain "Role: X" lines. */
.ds-invite-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ds-invite-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(218, 165, 32, 0.10);
  border: 1px solid rgba(218, 165, 32, 0.28);
  color: var(--ds-ink);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
