/* --- 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 — fund search + fund bubbles ----------------------- */
.ds-analytics-search .input-group-text {
  background: #fff;
  color: var(--ds-ink-soft);
  border-color: var(--ds-parchment-shadow);
}
.ds-analytics-search .form-control {
  border-color: var(--ds-parchment-shadow);
}
.ds-analytics-search .form-control:focus {
  border-color: var(--ds-brass);
  box-shadow: 0 0 0 0.2rem rgba(184, 134, 11, 0.15);
}

.ds-fund-bubble-grid {
  min-height: 120px;
}

.ds-fund-bubble-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  padding: 10px;
  text-align: center;
  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-fund-bubble-label {
  font-family: var(--ds-font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.ds-fund-bubble:hover .ds-fund-bubble-circle {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.04);
}
.ds-fund-bubble.is-selected .ds-fund-bubble-circle {
  box-shadow:
    0 0 0 3px rgba(184, 134, 11, 0.45),
    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);
}
.ds-fund-bubble.is-selected .ds-bubble-caption {
  color: var(--ds-mahogany-deep);
  font-weight: 700;
}

.ds-fund-bubble-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.ds-fund-bubble-circle-hero {
  width: 148px;
  height: 148px;
}
.ds-fund-bubble-label-hero {
  font-size: 1.15rem;
  -webkit-line-clamp: 4;
}
.ds-fund-bubble-hero-meta {
  letter-spacing: 0.02em;
}

/* --- 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: var(--ds-font-sans);
  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;
}

/* Analytics document-table notes cell: keep admin investor notes from
 * stretching the table. Truncate to one line with a tooltip (title attr)
 * carrying the full text. */
.ds-analytics-notes-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inline notes editor in the admin Investors roster. Compact, grows on
 * focus so longer notes are comfortable to type. */
.ds-investor-notes-input {
  resize: vertical;
  min-height: 31px;
}

/* Click-to-edit notes: read-only one-line preview in the roster cell.
 * Truncates with an ellipsis and reads as clickable; the popover editor
 * opens on click. Keeps the table a scannable list, not a form. */
.ds-notes-display {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 6px;
  margin: -2px -6px;
}
.ds-notes-display:hover {
  background: var(--ds-surface-2, #f1f5f9);
}
.ds-notes-popover {
  max-width: 320px;
}
.ds-notes-popover .popover-body {
  min-width: 240px;
}

/* Banner noting the active sub-document slice above the KPIs. */
.ds-analytics-slice-note {
  color: var(--ds-ink-soft);
}

/* ====================================================================
 * Admin → Investors workspace (Directory / Groups / Assignments)
 * ==================================================================== */

/* Second-level segmented control selecting which panel shows. Reuses
 * the dbc Tabs markup but renders as a lighter, pill-ish strip. */
.ds-subtabs {
  border-bottom: 1px solid var(--ds-border, #e5e7eb);
  gap: 2px;
}
.ds-subtabs .nav-link {
  font-family: var(--ds-font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ds-ink-soft, #64748b);
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 8px 14px;
}
.ds-subtabs .nav-link:hover {
  color: var(--ds-mahogany-deep);
  background: transparent;
}
.ds-subtabs .nav-link.active {
  color: var(--ds-mahogany-deep);
  background: transparent;
  border-bottom-color: var(--ds-mahogany-deep);
}

/* Card wrapper shared by each sub-tab panel — soft shadow, no hard
 * border, matching the redesigned Documents page. */
.ds-admin-card {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Card header row: section title on the left, primary action (e.g.
 * "+ New group") pinned right. */
.ds-admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ds-admin-card-title {
  font-family: var(--ds-font-sans);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ds-mahogany-deep);
}

/* ====================================================================
 * Fund → sub-document radial graph (analytics fund chooser)
 * Selected fund node sits at the centre; its template nodes pop off
 * around it, joined by rotated-bar CSS edges. Nodes are buttons that
 * drive the dashboard slice.
 * ==================================================================== */
.ds-fund-graph-wrap {
  overflow-x: auto;
  display: flex;
  justify-content: center;
}
.ds-fund-graph {
  position: relative;
  flex: 0 0 auto;
  margin: 0 auto;
}
.ds-fund-graph-edge {
  position: absolute;
  height: 2px;
  background: rgba(125, 91, 47, 0.35);
  transform-origin: 0 50%;
  z-index: 1;
}
.ds-fund-graph-edge.is-active {
  height: 3px;
  background: var(--ds-brass);
}
.ds-fund-graph-node {
  position: absolute;
  z-index: 2;
  border: 0;
  border-radius: 50%;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ds-fund-graph-node:hover {
  transform: scale(1.06);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22);
}
.ds-fund-graph-center {
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}
.ds-fund-graph-center.is-selected {
  outline: 3px solid var(--ds-gold, #c9a227);
  outline-offset: 3px;
}
.ds-fund-graph-center-label {
  font-size: 0.82rem;
  line-height: 1.1;
  padding: 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Sub-document leaves: rounded squares sharing the fund node's brass
 * colour scheme (set inline). The active leaf gets the same gold ring
 * as the selected centre node. */
.ds-fund-graph-leaf {
  border-radius: 12px;        /* square — overrides the round base node */
  color: #fff;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}
.ds-fund-graph-leaf.is-selected {
  outline: 3px solid var(--ds-gold, #c9a227);
  outline-offset: 3px;
}
.ds-fund-graph-leaf-label {
  font-size: 0.72rem;
  line-height: 1.06;
  max-width: 96px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Per-node metrics — document count + committed capital, shown on both
 * the centre (fund total) and leaf (per-template) nodes. */
.ds-fund-graph-node-count {
  font-size: 0.68rem;
  opacity: 0.92;
  margin-top: 3px;
  line-height: 1;
}
.ds-fund-graph-node-committed {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1;
}
