:root {
  --bg: #07111f;
  --bg-soft: rgba(13, 24, 43, 0.72);
  --panel: rgba(10, 20, 37, 0.88);
  --line: rgba(125, 211, 252, 0.16);
  --text: #edf6ff;
  --muted: #8ea5c5;
  --aqua: #38bdf8;
  --shadow: 0 24px 60px rgba(2, 12, 27, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.14), transparent 25%),
    linear-gradient(180deg, #040a13 0%, #07111f 36%, #09192b 100%);
}
body.modal-open { overflow: hidden; }
.bg-grid {
  position: fixed; inset: 0; pointer-events: none; opacity: 0.28;
  background-image:
    linear-gradient(rgba(56,189,248,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56,189,248,.06) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
}
.shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.hero {
  padding: 56px 0 24px;
}
.hero-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
  align-items: center;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.hero-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(56,189,248,.14), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(34,197,94,.10), transparent 18%);
  pointer-events: none;
}
.hero-copy,
.hero-strip {
  position: relative;
  z-index: 1;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--aqua);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: 12px;
}
h1, h2, h3 { margin: 0; font-family: "Space Grotesk", sans-serif; }
h1 {
  font-size: clamp(28px, 3.2vw, 48px);
  line-height: 1.02;
  white-space: nowrap;
  letter-spacing: -0.03em;
}
h2 { font-size: clamp(24px, 3vw, 32px); }
.lede, .section-head p, .modal-sub { color: var(--muted); margin: 10px 0 0; line-height: 1.6; }
.hero-panel { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.hero-strip {
  grid-template-columns: 1fr;
  gap: 10px;
}
.stat-pill, .panel, .investor-card, .glow-button, .modal-panel {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  box-shadow: var(--shadow);
}
.stat-pill {
  border-radius: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
}
.stat-pill span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.stat-pill strong { font-size: 16px; }
.section { padding: 20px 0; }
.section-head { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin-bottom: 16px; }
.section-head.compact { display: block; margin-bottom: 14px; }
.panel { border-radius: 28px; padding: 18px; }
.dashboard-stack, .analytics-stack { display: grid; gap: 18px; }
.spotlight-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(320px, 1.05fr) minmax(280px, 0.95fr);
  align-items: stretch;
}
.pie-column,
.legend-column {
  display: grid;
  align-content: stretch;
}
.investor-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}
.investor-card {
  position: relative;
  padding: 12px 12px 11px;
  border-radius: 18px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  min-height: 0;
}
.investor-card::after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  right: -26px;
  top: -30px;
  background: radial-gradient(circle, var(--accent), transparent 68%);
  opacity: 0.22;
}
.investor-card.active { outline: 2px solid var(--aqua); transform: translateY(-1px); }
.investor-card-top, .investor-card p, .legend-item p, .change-item p, .modal-metrics span, .cusip { color: var(--muted); }
.investor-card-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  font-size: 11px;
}
.investor-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 14px;
  line-height: 1.3;
  min-height: 36px;
  max-width: 92%;
}
.investor-card p {
  margin: 0 0 10px;
  min-height: 28px;
  font-size: 12px;
  line-height: 1.35;
  max-width: 92%;
}
.investor-card-foot {
  display: grid;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.investor-card-foot span { font-family: "Space Grotesk", sans-serif; font-size: 16px; }
.investor-card-foot em {
  font-style: normal;
  color: #bfe7ff;
  font-size: 11px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 94%;
}
.spotlight-panel { overflow: hidden; }
.legend-head { margin-bottom: 14px; }
.legend-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.legend-column {
  min-height: 100%;
}
.legend-panel {
  height: calc(100% - 74px);
  max-height: none;
  overflow: auto;
  padding-right: 6px;
}
.pie-stage {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 0;
  height: 100%;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
}
#donutChart { width: 100%; height: 100%; }
.holding-detail-card {
  margin-top: auto;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(125,211,252,.16);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
}
.holding-detail-card .detail-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 12px;
}
.holding-detail-card .detail-top strong {
  display: block;
  font-size: 18px;
  margin-bottom: 4px;
}
.holding-detail-card .detail-top p,
.holding-detail-card .detail-meta p,
.holding-detail-card .detail-bottom p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.holding-detail-card .detail-meta {
  text-align: right;
}
.holding-detail-card .detail-meta strong {
  display: block;
  font-size: 22px;
}
.holding-detail-card .detail-bottom {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.holding-detail-card .detail-bottom strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}
#donutChart.hovering {
  cursor: pointer;
}
.pie-center {
  position: absolute;
  width: 48%;
  min-width: 200px;
  text-align: center;
  padding: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at top, rgba(56,189,248,.18), rgba(7,17,31,.96));
  box-shadow: inset 0 0 24px rgba(56,189,248,.12);
}
.pie-center h3 { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.35; margin: 6px 0 10px; }
.pie-center strong { display: block; font-size: 24px; margin-bottom: 16px; }
.glow-button {
  border-radius: 999px;
  padding: 12px 18px;
  color: var(--text);
  cursor: pointer;
  background: linear-gradient(90deg, rgba(56,189,248,.26), rgba(34,197,94,.2));
}
.legend-list, .changes-list { display: grid; gap: 12px; }
.legend-item, .change-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.05);
}
.legend-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 14px currentColor; }
.legend-item strong,
.change-item strong { font-size: 14px; }
.legend-item p,
.change-item p {
  font-size: 12px;
  line-height: 1.4;
  margin: 4px 0 0;
}
.legend-metrics { text-align: right; }
.legend-metrics strong { font-size: 14px; }
.legend-metrics p { font-size: 12px; }
.badge {
  min-width: 64px;
  text-align: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
}
.badge.new, .badge.increased { background: rgba(34,197,94,.14); color: #86efac; }
.badge.reduced, .badge.exited { background: rgba(251,113,133,.12); color: #fda4af; }
.badge.flat { background: rgba(148,163,184,.14); color: #cbd5e1; }
.chart-wrap { min-height: 320px; }
.chart-panel {
  position: relative;
  min-height: 360px;
  padding: 10px 2px 0;
}
.chart-tooltip {
  position: absolute;
  min-width: 144px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(56,189,248,.24);
  background: rgba(7,17,31,.96);
  box-shadow: 0 14px 36px rgba(2, 12, 27, 0.45);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  z-index: 2;
}
.chart-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.chart-tooltip p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.chart-tooltip.hidden {
  display: none;
}
.warning-panel { border-color: rgba(245,158,11,.35); }
canvas { width: 100%; height: 320px; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}
.modal.hidden {
  display: none;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 10, 21, 0.82);
}
.modal-panel {
  position: relative;
  width: min(1040px, calc(100% - 24px));
  max-height: min(86vh, 900px);
  overflow: hidden;
  border-radius: 32px;
  padding: 28px 22px 22px 28px;
  background: linear-gradient(180deg, rgba(8,18,34,.96), rgba(7,17,31,.94));
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}
.modal-metrics { text-align: right; }
.modal-metrics strong { display: block; font-size: 26px; margin-top: 8px; }
.modal-table {
  max-height: calc(86vh - 170px);
  overflow: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56,189,248,.55) rgba(255,255,255,.03);
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 12px; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; }
th { color: var(--muted); font-size: 13px; font-weight: 500; }
tr:hover td { background: rgba(56,189,248,.04); }

.legend-panel::-webkit-scrollbar,
.modal-table::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.legend-panel::-webkit-scrollbar-track,
.modal-table::-webkit-scrollbar-track {
  background: rgba(255,255,255,.03);
  border-radius: 999px;
}
.legend-panel::-webkit-scrollbar-thumb,
.modal-table::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56,189,248,.78), rgba(34,197,94,.5));
  border-radius: 999px;
  border: 2px solid rgba(7,17,31,.55);
}

@media (max-width: 1180px) {
  .investor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .investor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spotlight-grid { grid-template-columns: 1fr; }
  .legend-panel { height: auto; max-height: none; }
  .pie-stage { height: 500px; }
}

@media (max-width: 960px) {
  .hero-shell { grid-template-columns: 1fr; padding: 16px; }
  .hero-panel { grid-template-columns: 1fr; }
  .investor-grid { grid-template-columns: 1fr; }
  .holding-detail-card .detail-top,
  .holding-detail-card .detail-bottom {
    grid-template-columns: 1fr;
    display: grid;
  }
  h1 { white-space: normal; }
  .section-head, .modal-head { display: block; }
  .pie-stage { height: min(88vw, 420px); }
  .pie-center { width: 56%; min-width: 180px; }
}
