:root {
  --page: #f3f4f6;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --border: #eef0f3;
  --row-border: #f3f4f6;
  --green: #22c55e;
  --green-soft: #dcfce7;
  --green-text: #16a34a;
  --red: #ef4444;
  --red-text: #dc2626;
  --badge-bg: #f3f4f6;
  --tooltip: #374151;
  --chart-line: #22c55e;
  --chart-dash: #9ca3af;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --gap: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "DM Sans", sans-serif;
  background: var(--page);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding: 24px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }

.dashboard {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

/* —— Top metrics —— */
.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
}

.metric {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 118px;
}

.metric__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.metric__value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}

.metric__delta {
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.metric__delta--up { color: var(--green-text); }
.metric__delta--down { color: var(--red-text); }
.metric__delta--muted { color: var(--muted); }

.metric__delta .arrow {
  font-size: 11px;
  line-height: 1;
}

/* —— Middle row —— */
.middle {
/*       display: grid; */
  grid-template-columns: 1.85fr 1fr;
  gap: var(--gap);
  align-items: stretch;
}

.panel {
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.panel__meta {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chip {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--badge-bg);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

.panel__link {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.panel__link:hover { color: var(--ink); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-bottom: 14px;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend__pct--up { color: var(--green-text); }
.legend__pct--down { color: var(--red-text); }

/* —— Chart —— */
.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 260px;
  margin-top: 4px;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.chart-grid line {
  stroke: #eef0f3;
  stroke-width: 1;
}

.chart-axis {
  fill: var(--muted-2);
  font-size: 11px;
  font-family: "DM Sans", sans-serif;
}

.chart-portfolio {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-benchmark {
  fill: none;
  stroke: var(--chart-dash);
  stroke-width: 1.75;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: url(#chartFill);
  opacity: 0.35;
}

.chart-hit {
  fill: transparent;
  cursor: crosshair;
}

.chart-point {
  fill: var(--chart-line);
  stroke: #fff;
  stroke-width: 2.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chart-point.is-active { opacity: 1; }

.chart-crosshair {
  stroke: #d1d5db;
  stroke-width: 1;
  stroke-dasharray: 3 3;
  pointer-events: none;
  opacity: 0;
}

.chart-crosshair.is-active { opacity: 1; }

.tooltip {
  position: absolute;
  top: 28%;
  left: 58%;
  transform: translateX(-50%);
  background: var(--tooltip);
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.18);
  pointer-events: none;
  min-width: 148px;
  opacity: 0;
  transition: opacity 0.12s ease, left 0.15s ease;
  z-index: 2;
}

.tooltip.is-visible { opacity: 1; }

.tooltip__date {
  color: #d1d5db;
  font-weight: 500;
  margin-bottom: 4px;
  font-size: 11.5px;
}

.tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-weight: 500;
}

.tooltip__row span:last-child { font-variant-numeric: tabular-nums; }
.tooltip__up { color: #86efac; }
.tooltip__down { color: #fca5a5; }

/* —— Holdings table —— */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
}

.holdings-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-2);
  padding: 0 8px 10px 0;
  border-bottom: 1px solid var(--border);
}

.holdings-table th:last-child,
.holdings-table td:last-child {
  text-align: right;
  padding-right: 0;
}

.holdings-table th:nth-child(3),
.holdings-table td:nth-child(3) {
  width: 28%;
}

.holdings-table td {
  padding: 12px 8px 12px 0;
  border-bottom: 1px solid var(--row-border);
  vertical-align: middle;
  font-size: 13px;
}

.holdings-table tr:last-child td { border-bottom: none; }

.holdings-table tbody tr {
  transition: background 0.12s ease;
}

.holdings-table tbody tr:hover td {
  background: #fafafa;
}

.asset {
  display: flex;
  align-items: center;
  gap: 10px;
}

.asset__icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.asset__icon--matic { background: #8247e5; }
.asset__icon--doge { background: #c2a633; }
.asset__icon--sol { background: linear-gradient(135deg, #9945ff, #14f195); }
.asset__icon--xrp { background: #23292f; }
.asset__icon--ada { background: #0033ad; }

.asset__ticker {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.2;
}

.asset__name {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 1px;
}

.price {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.weight {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 56px;
}

.weight__pct {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.weight__bar {
  height: 4px;
  background: #eef2f6;
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
  max-width: 72px;
}

.weight__fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}

.pl-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-text);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 4px 9px;
  font-variant-numeric: tabular-nums;
}

/* —— Bottom row —— */
.bottom {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.activity {
  background: #f9fafb;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.activity__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity__user {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.activity__action {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s ease;
}

.activity__action:hover { color: var(--ink); }

.time-ago {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted-2);
  white-space: nowrap;
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .middle { grid-template-columns: 1fr; }
  .bottom { grid-template-columns: 1fr 1fr; }
  .bottom .panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  body { padding: 14px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:first-child { grid-column: 1 / -1; }
  .metric__value { font-size: 24px; }
  .bottom { grid-template-columns: 1fr; }
  .legend { gap: 10px 14px; }
  .chart-wrap { min-height: 220px; }
}