/* Hero (net-worth masthead) and the key figures strip. */

#hero {
  position: relative;
  overflow: hidden;
  padding: 1.6rem 1.75rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
}

.hero-label {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.hero-label .info-pill { margin-left: 0.45rem; flex-basis: 1.1rem; width: 1.1rem; min-width: 1.1rem; height: 1.1rem; min-height: 1.1rem; }

.hero-value {
  margin: 0.45rem 0 0.2rem;
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.6vw, 3.9rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  line-height: 1.02;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Net worth: the second figure, stacked like the key figures below (label
   over value, left-aligned). What is lent out rides beside it in blue
   (still yours, not available). */
.hero-networth {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  margin: 0.35rem 0 0;
  font-variant-numeric: tabular-nums;
}
.hero-networth[hidden] { display: none; }
.hero-networth-label {
  color: var(--muted-2);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.hero-networth-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
  white-space: nowrap;
}
.hero-networth-value {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hero-networth-note {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 500;
}
/* Reserved even without lendings (fixed layout). */
.hero-networth-note.is-empty { visibility: hidden; }
.hero-networth-note:empty::before { content: "\00a0"; }

/* Holdings: only with the asset filter on. The native amount of each
   filtered asset, stacked like Net worth; a long list truncates (tap opens
   it in full), the box never grows with it. */
/* Holdings and Avg entry share one row (filtered home only). */
/* Avg entry wraps under Holdings when the row is too narrow (phones):
   the holding is never cut to make room for it. */
.hero-hold-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 1.6rem; min-width: 0; }
.hero-hold-row > .hero-holdings { flex: 0 1 auto; max-width: 100%; }
.hero-holdings {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  margin: 0.55rem 0 0;
  font-variant-numeric: tabular-nums;
}
.hero-holdings[hidden] { display: none; }
.hero-holdings-label {
  color: var(--muted-2);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.hero-holdings-value {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

/* Key figures: three equal cells under a hairline, label over value. The
   cells never resize with their numbers: long amounts truncate. */
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 1.05rem 0 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--border);
}
.hero-metrics[hidden] { display: none; }
.hero-metric {
  display: grid;
  gap: 0.3rem;
  min-width: 0;
  padding: 0 0.9rem;
  border-left: 1px solid var(--border);
}
.hero-metric:first-child { padding-left: 0; border-left: none; }
.hero-metric dt {
  color: var(--muted-2);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.hero-metric dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.hero-metric dd.hero-pl.gain { color: var(--gain); }
.hero-metric dd.hero-pl.loss { color: var(--loss); }
/* The arrow carries the direction, so meaning never rests on color alone. */
.hero-metric dd.hero-pl.gain::before { content: "▲"; margin-right: 0.4em; font-size: 0.6em; vertical-align: 0.15em; }
.hero-metric dd.hero-pl.loss::before { content: "▼"; margin-right: 0.4em; font-size: 0.6em; vertical-align: 0.15em; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
}

/* Gain = green wash, loss = deep red wash. Both also carry an arrow, so the
   meaning never depends on color alone. */
.pill.gain { color: var(--gain); background: var(--gain-bg); border-color: var(--gain-line); }
.pill.gain::before { content: "▲"; margin-right: 0.5em; font-size: 0.62em; }
.pill.loss { color: var(--loss); background: var(--loss-bg); border-color: var(--loss-line); }
.pill.loss::before { content: "▼"; margin-right: 0.5em; font-size: 0.62em; }

.hero-sub {
  margin: 0.85rem 0 0;
  color: var(--muted-2);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gain { color: var(--gain); }
.loss { color: var(--loss); }
.card-value.gain::before { content: "+"; }

/* ————— Key figures strip ————— */
#overview { padding: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card {
  padding: 0.95rem 1.2rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  border-left: 1px solid var(--border);
}

.card:first-child { border-left: none; }

.card-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live-price loading state: same box, same layout — a soft shimmer that
   says "fetching, no error yet". Unknown-by-design values keep the plain '—'
   and never pulse. */
.card-value.is-loading, .acct-value.is-loading, .acct-pl.is-loading,
#hero-value.is-loading, #hero-value-num.is-loading {
  opacity: 0.85;
}
@media (prefers-reduced-motion: no-preference) {
  .is-loading { animation: price-pulse 1.4s ease-in-out infinite; }
  @keyframes price-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
  }
}

#summary-cards > p {
  grid-column: 1 / -1;
  padding: 1.1rem 1.25rem;
  margin: 0;
}
