/* My Portfolio + SuperCategory stats embeds (#home toggles via .home-secondary-embed) */

.home-secondary-embed.collector-pulse-skin[hidden] {
  display: none !important;
}

.collector-pulse-skin .collector-pulse-intro {
  color: var(--theme-text-panel-subtitle, #8892b0);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 52rem;
  margin-bottom: 1.25rem;
}

.collector-pulse-skin .pulse-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 20px;
}

.collector-pulse-skin .pulse-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--carolina-blue, #4b9cd3);
  color: var(--carolina-blue, #4b9cd3);
  background: transparent;
  font-family: inherit;
}

.collector-pulse-skin .pulse-link-btn:hover {
  background: rgba(75, 156, 211, 0.12);
}

.collector-pulse-skin .pulse-mini-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.08));
}

.collector-pulse-skin .pulse-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

/* Portfolio tracked/pinned metric grids — uniform column rhythm across every group card */
.collector-pulse-skin .pulse-mini-table--portfolio-stats {
  table-layout: fixed;
  width: 100%;
  min-width: 44rem;
}

/* Tracked: Δ 1d (trend) + listing-sample metrics (no range Δ Med) */
.collector-pulse-skin .pulse-mini-table--portfolio-tracked {
  min-width: 42rem;
}

.collector-pulse-skin .pulse-mini-table--portfolio-stats th:first-child,
.collector-pulse-skin .pulse-mini-table--portfolio-stats td:first-child {
  width: 13rem;
  max-width: min(13rem, 32vw);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.collector-pulse-skin .pulse-mini-table--portfolio-stats th.num,
.collector-pulse-skin .pulse-mini-table--portfolio-stats td.num {
  width: 4.75rem;
  min-width: 4.35rem;
  padding-left: 8px;
  padding-right: 8px;
  white-space: nowrap;
}

.collector-pulse-skin .pulse-mini-table--portfolio-stats tbody tr.pulse-portfolio-group-avg-row th.num,
.collector-pulse-skin .pulse-mini-table--portfolio-stats tbody tr.pulse-portfolio-group-avg-row td.num {
  white-space: nowrap;
}

.collector-pulse-skin .pulse-mini-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--theme-text-panel-subtitle, #8892b0);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.06));
}

.collector-pulse-skin .pulse-mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--theme-border-muted, rgba(255, 255, 255, 0.04));
}

.collector-pulse-skin .pulse-mini-table tbody tr:last-child td {
  border-bottom: none;
}

.collector-pulse-skin .pulse-mini-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.collector-pulse-skin .pulse-mini-table .pos {
  color: #4cd964;
  font-weight: 600;
}

.collector-pulse-skin .pulse-mini-table .neg {
  color: #ff3b30;
  font-weight: 600;
}

.collector-pulse-skin .pulse-mini-table tbody tr[data-trend-key] {
  cursor: pointer;
}

.collector-pulse-skin .pulse-mini-table tbody tr[data-trend-key]:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.collector-pulse-skin .pulse-muted {
  color: var(--theme-text-panel-subtitle, #8892b0);
  font-size: 0.85rem;
  margin-top: 8px;
}

.collector-pulse-skin .pulse-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 12px 0;
}

.collector-pulse-skin .pulse-stat {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.1));
  min-width: 120px;
  background: var(--theme-bg-surface, #1b1f2b);
}

.collector-pulse-skin .pulse-stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--theme-text-heading, #fff);
}

.collector-pulse-skin .pulse-stat span.label {
  font-size: 0.75rem;
  color: var(--theme-text-panel-subtitle, #8892b0);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.collector-pulse-skin button.pulse-stat--toggle {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--theme-text-heading, #f5f5f5);
  flex: 1 1 auto;
  min-width: min(220px, 100%);
  text-align: left;
  align-items: center;
  display: inline-flex;
  flex-direction: row;
  gap: 10px;
  box-sizing: border-box;
  background: var(--theme-bg-surface, #1b1f2b);
  border: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.12));
}

/* Overrides native button / vague `inherit`; labels stay readable on dark surface */
.collector-pulse-skin button.pulse-stat--toggle .pulse-stat-toggle-inner .label {
  color: var(--theme-text-caption, #c5cdd8);
}

.collector-pulse-skin button.pulse-stat--toggle strong {
  color: var(--theme-text-on-dark, #fff);
}

.collector-pulse-skin button.pulse-stat--toggle .pulse-stat-toggle-affordance {
  color: var(--theme-text-caption, #c5cdd8);
  opacity: 0.92;
}

.collector-pulse-skin button.pulse-stat--toggle:focus-visible {
  outline: 2px solid var(--carolina-blue, #4b9cd3);
  outline-offset: 2px;
}

.collector-pulse-skin button.pulse-stat--toggle:hover {
  border-color: var(--theme-border-home-default-summary-hover, rgba(255, 255, 255, 0.22));
  background: var(--theme-bg-surface-elevated, #252a3a);
}

.collector-pulse-skin button.pulse-stat--toggle[aria-expanded="true"] {
  border-color: rgba(75, 156, 211, 0.65);
  background: rgba(75, 156, 211, 0.16);
  box-shadow: 0 0 0 1px rgba(75, 156, 211, 0.12);
}

.pulse-stat-toggle-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.pulse-stat-toggle-affordance {
  flex-shrink: 0;
  font-size: 0.7rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.collector-pulse-skin button.pulse-stat--toggle[aria-expanded="true"] .pulse-stat-toggle-affordance {
  transform: rotate(-180deg);
}

/* My Portfolio — mirror Home pin-group chrome (see home.css home-pin-group-card) */

.pulse-portfolio-block-title {
  margin: 1.35rem 0 0.5rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--theme-text-panel-subtitle, #8892b0);
}

.pulse-portfolio-block-title--pinned {
  margin-top: 1rem;
}

.pulse-portfolio-readonly-group {
  margin-bottom: 12px;
}

.pulse-portfolio-readonly-group:last-child {
  margin-bottom: 0;
}

.pulse-portfolio-group-summary .pulse-portfolio-group-count {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.72;
  margin-left: 8px;
  letter-spacing: 0.06em;
}

.pulse-portfolio-group-summary .home-pin-group-card__chev {
  margin-left: auto;
}

.pulse-portfolio-group-table-body .pulse-mini-table-wrap {
  overflow-x: auto;
  margin: 4px 0 0;
  border-radius: 8px;
  border: 1px solid var(--theme-border-muted, rgba(255, 255, 255, 0.06));
}

.pulse-portfolio-group-table-body .pulse-mini-table--in-group {
  margin-bottom: 0;
}

.collector-pulse-skin .pulse-mini-table th.num {
  white-space: nowrap;
}

.collector-pulse-skin tbody tr.pulse-portfolio-group-avg-row th,
.collector-pulse-skin tbody tr.pulse-portfolio-group-avg-row td {
  background: rgba(75, 156, 211, 0.08);
  border-bottom: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.08));
}

.collector-pulse-skin tbody tr.pulse-portfolio-group-avg-row th.pulse-portfolio-avg-label {
  text-align: left;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-text-caption, #a8b4c8);
}

.collector-pulse-skin tbody tr.pulse-portfolio-group-avg-row td.num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.collector-pulse-skin tbody tr.pulse-portfolio-group-avg-row .pulse-portfolio-avg-meta {
  display: inline;
  margin-left: 4px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--theme-text-caption, #8892b0);
}

.collector-pulse-skin tbody tr[data-pinned-product-id] {
  cursor: pointer;
}

.collector-pulse-skin tbody tr[data-pinned-product-id]:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* —— My Portfolio hero: side-by-side like Market overview (chart | collections) —— */
#home-portfolio-embed .pulse-portfolio-hero-split.home-split-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 24px;
  width: 100%;
  margin-bottom: 24px;
  /* Same row height feel as Market Performance + Watchlist */
  height: clamp(650px, 75vh, calc(100vh - 100px));
  max-height: calc(100vh - 80px);
  min-height: 360px;
  overflow: hidden;
}

#home-portfolio-embed .pulse-portfolio-hero-chart-col.home-chart-column {
  flex: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#home-portfolio-embed .pulse-portfolio-hero-chart-col .pulse-portfolio-hero-canvas-wrap.chart-container {
  flex: 1 1 0%;
  min-height: 0;
}

#home-portfolio-embed .pulse-portfolio-collections-rail.home-pinned-column {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Row 1: Trend|Collections only (center). Row 2: title | date range | metric + Legend — aligned on one baseline */
#home-portfolio-embed .pulse-portfolio-hero-chart-col .pulse-portfolio-hero-panel-header.panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 6px;
}

#home-portfolio-embed .pulse-portfolio-hero-titles {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
  align-self: center;
  min-width: 0;
}

/* Flatten so mode toggle (row 1) and range (row 2) are separate grid areas */
#home-portfolio-embed .pulse-portfolio-header-center {
  display: contents;
}

#home-portfolio-embed .pulse-portfolio-hero-panel-header .pulse-portfolio-mode-toggle {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

#home-portfolio-embed .pulse-portfolio-hero-panel-header .pulse-portfolio-range-below-mode {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  align-self: center;
}

#home-portfolio-embed .pulse-portfolio-range-below-mode {
  display: flex;
  justify-content: center;
  width: 100%;
}

#home-portfolio-embed .pulse-portfolio-range-below-mode[hidden] {
  display: none !important;
}

#home-portfolio-embed .pulse-portfolio-header-trailing {
  grid-column: 3;
  grid-row: 2;
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 12px;
  min-width: 0;
}

#home-portfolio-embed .pulse-portfolio-line-controls {
  display: contents;
}

#home-portfolio-embed .pulse-portfolio-line-controls[hidden] {
  display: none !important;
}

#home-portfolio-embed #pulsePortfolioRangeSelector {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 0;
  width: auto;
}

#home-portfolio-embed #pulsePortfolioMetricSlot {
  justify-self: end;
}

#home-portfolio-embed .pulse-portfolio-mode-toggle,
#home-portfolio-embed .pulse-portfolio-pie-metric-toggle {
  display: inline-flex;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.12));
}

#home-portfolio-embed .pulse-portfolio-pie-metric-toggle[hidden] {
  display: none !important;
}

#home-portfolio-embed .pulse-portfolio-pie-metric-toggle--overlay {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 4;
  background: rgba(12, 16, 28, 0.68);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

#home-portfolio-embed .pulse-mode-btn {
  margin: 0;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--theme-text-panel-subtitle, #8892b0);
  font-family: inherit;
}

#home-portfolio-embed .pulse-mode-btn.is-active {
  background: rgba(75, 156, 211, 0.22);
  color: #e8eef8;
}

@media (max-width: 900px) {
  #home-portfolio-embed .pulse-portfolio-hero-chart-col .pulse-portfolio-hero-panel-header.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }

  #home-portfolio-embed .pulse-portfolio-hero-titles,
  #home-portfolio-embed .pulse-portfolio-header-trailing,
  #home-portfolio-embed .pulse-portfolio-hero-panel-header .pulse-portfolio-mode-toggle,
  #home-portfolio-embed .pulse-portfolio-hero-panel-header .pulse-portfolio-range-below-mode {
    grid-column: unset;
    grid-row: unset;
    justify-self: unset;
    align-self: unset;
  }

  #home-portfolio-embed .pulse-portfolio-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    width: 100%;
  }

  #home-portfolio-embed .pulse-portfolio-mode-toggle {
    justify-content: center;
  }

  #home-portfolio-embed .pulse-portfolio-header-trailing {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  #home-portfolio-embed .pulse-portfolio-line-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
  }
}

#home-portfolio-embed .pulse-portfolio-metric-slot .metric-selector-group,
#home-portfolio-embed .pulse-portfolio-metric-slot select {
  max-width: min(220px, 42vw);
}

#home-portfolio-embed .pulse-portfolio-hero-canvas-wrap {
  position: relative;
}

#home-portfolio-embed .pulse-chart-status {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 8px 12px;
  font-size: 0.85rem;
  text-align: center;
  max-width: 92%;
  pointer-events: none;
}

#home-portfolio-embed .pulse-portfolio-collections-rail .panel-header {
  flex-wrap: wrap;
  gap: 8px;
}

#home-portfolio-embed .pulse-portfolio-collections-blurb {
  padding: 0 18px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#home-portfolio-embed .pulse-portfolio-collections-intro {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.45;
}

#home-portfolio-embed .pulse-portfolio-collections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#home-portfolio-embed .pulse-portfolio-coll-row,
#home-portfolio-embed .pulse-portfolio-coll-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  margin: 0;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--theme-border-default, rgba(255, 255, 255, 0.1));
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  font-family: inherit;
  transition: background 0.15s ease;
}

#home-portfolio-embed .pulse-portfolio-coll-row {
  gap: 4px;
  padding: 10px 12px;
}

#home-portfolio-embed .pulse-portfolio-coll-card {
  gap: 8px;
  padding: 12px 14px;
}

#home-portfolio-embed .pulse-portfolio-coll-row:hover,
#home-portfolio-embed .pulse-portfolio-coll-card:hover {
  background: rgba(75, 156, 211, 0.12);
}

#home-portfolio-embed .pulse-portfolio-coll-row__title,
#home-portfolio-embed .pulse-portfolio-coll-card__title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

#home-portfolio-embed .pulse-portfolio-coll-row__meta,
#home-portfolio-embed .pulse-portfolio-coll-card__meta,
#home-portfolio-embed .pulse-portfolio-coll-card__secondary {
  font-size: 0.74rem;
  color: var(--theme-text-panel-subtitle, #8892b0);
}

#home-portfolio-embed .pulse-portfolio-coll-row__meta,
#home-portfolio-embed .pulse-portfolio-coll-card__meta {
  text-transform: capitalize;
}

#home-portfolio-embed .pulse-portfolio-coll-card__top,
#home-portfolio-embed .pulse-portfolio-coll-card__value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

#home-portfolio-embed .pulse-portfolio-coll-card__value {
  font-size: 1.05rem;
  line-height: 1.1;
  color: var(--theme-text-primary, #f4f7fb);
}

#home-portfolio-embed .pulse-portfolio-coll-value-source {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#home-portfolio-embed .pulse-portfolio-coll-value-source--tracked {
  color: #d8f7ff;
  background: rgba(75, 156, 211, 0.24);
}

#home-portfolio-embed .pulse-portfolio-coll-value-source--estimate {
  color: #fff3c4;
  background: rgba(251, 191, 36, 0.2);
}

#home-portfolio-embed .pulse-portfolio-coll-value-source--empty {
  color: var(--theme-text-panel-subtitle, #8892b0);
  background: rgba(255, 255, 255, 0.08);
}

#home-portfolio-embed .pulse-portfolio-coll-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.08);
  color: var(--theme-text-caption, #a8b4c8);
}

#home-portfolio-embed .pulse-portfolio-coll-pill--priv {
  opacity: 0.85;
}

#home-portfolio-embed .pulse-portfolio-hero-titles {
  flex: 1 1 180px;
  min-width: min(100%, 220px);
}

#home-portfolio-embed .pulse-portfolio-hero-sub {
  max-width: 42ch;
}

@media (max-width: 900px) {
  #home-portfolio-embed .pulse-portfolio-hero-split.home-split-layout {
    flex-direction: column;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  #home-portfolio-embed .pulse-portfolio-hero-chart-col .chart-container {
    min-height: 280px;
  }
}
