/* ===========================================================================
   insights.css — the Insights page (#/insights, insights.js).

   A sibling of Home: the same gallery measure and glass, the worth in gold,
   the line drawn in the colour of what it shows (gold for the total, the
   accent for cards, violet for what is on display). Scoped to `.ins` and
   `.view-insights`; Home's teaser keeps its own rules in home.css.

   Motion: the chart draws itself in at Full (the line's stroke, then the wash
   under it rising), a short fade at Reduced, nothing at Off. The hero's glow
   is still, so a page left open costs nothing. Only transforms, opacity and
   the line's dash offset ever animate.
   =========================================================================== */

.view-insights {
  height: calc(100vh - 52px - var(--pfbar-h, 0px));
  height: calc(100dvh - 52px - var(--pfbar-h, 0px));
  overflow-y: auto; overflow-x: hidden;
  background:
    radial-gradient(1000px 380px at 22% -170px, color-mix(in srgb, var(--gold) 9%, transparent), transparent 70%),
    radial-gradient(820px 360px at 88% -120px, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 72%),
    var(--bg);
}
/* Phones: the bottom bar covers the end of the page otherwise. */
body.has-bottomnav .view-insights { padding-bottom: var(--bottomnav-h, 0px); scroll-padding-bottom: var(--bottomnav-h, 0px); }

.ins {
  --gut: clamp(16px, 4vw, 48px);
  --measure: 1240px;
  /* The page's own edge: centres the measure, keeps a gutter when narrow. Used only on
     `.ins`'s direct children, where 100% is the page's width (the hero runs full bleed). */
  --edge: max(var(--gut), calc((100% - var(--measure)) / 2));
  --ins-glass: color-mix(in srgb, var(--surface) 72%, transparent);
  --ins-glass-line: color-mix(in srgb, var(--ink) 9%, transparent);
  /* Up and down: green and rose on the dark ground, deepened on paper (both 4.5:1 or better as text). */
  --ins-up: #34d399;
  --ins-down: #fb7185;
  --gold-hi: color-mix(in srgb, var(--gold) 55%, #fff);
  position: relative;
  padding: 0 0 56px;
  overflow-x: clip;
}
.ins > :not(.ins-hero) { margin-left: var(--edge); margin-right: var(--edge); }
:root[data-theme="light"] .ins {
  --ins-glass: color-mix(in srgb, #fff 78%, transparent);
  --ins-glass-line: rgba(20,24,32,.09);
  --ins-up: #047857;
  --ins-down: #be123c;
  --gold-hi: color-mix(in srgb, var(--gold) 72%, #fff);
}

.ins-money { font-variant-numeric: tabular-nums; }
.ins-money.is-masked { color: var(--ink-3); letter-spacing: .04em; }
.ins-money.is-gold { color: var(--gold-text); font-weight: 700; }
.ins-money.is-none { color: var(--ink-3); }

.ins-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--ins-glass);
  border: 1px solid var(--ins-glass-line);
  box-shadow: var(--glass-edge), var(--shadow-1);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
}

.ins-kicker {
  margin: 0;
  font-size: var(--fs-micro); font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--gold-text);
}
.ins-h2 {
  margin: 0;
  font-size: clamp(19px, 1.2vw + 12px, 25px);
  letter-spacing: -0.028em; line-height: 1.15;
}
.ins-h3 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -0.012em; }
.ins-sub { margin: 6px 0 0; color: var(--ink-3); font-size: var(--fs-sm); max-width: 62ch; }
.ins-fine { margin: 0; color: var(--ink-3); font-size: 12px; line-height: 1.5; max-width: 90ch; }
.ins-empty-line { margin: 6px 2px; color: var(--ink-3); font-size: var(--fs-sm); }

/* Full motion: reveals travel a little, as on Home. */
:root[data-motion="full"] .ins [data-reveal] {
  transition: opacity 560ms var(--ease-out), transform 720ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
:root[data-motion="full"] .ins [data-reveal]:not(.is-revealed) { transform: translate3d(0, 16px, 0); }

/* ======================================================================= hero */

.ins-hero {
  position: relative;
  isolation: isolate;
  padding: clamp(26px, 3.6vw, 56px) var(--edge) clamp(18px, 2vw, 26px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
}
.ins-sky {
  position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  /* The glow thins out into the page instead of stopping at an edge. */
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent);
  mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.ins-blob {
  position: absolute; display: block;
  width: clamp(320px, 44%, 760px); aspect-ratio: 1.6;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--blob) 30%, transparent), transparent 100%);
  filter: blur(8px);
}
.ins-blob.is-a { --blob: var(--gold); left: -8%; top: -46%; }
.ins-blob.is-b { --blob: var(--accent); right: -6%; top: -30%; }
.ins-blob.is-c { --blob: var(--accent-2); left: 38%; top: 10%; opacity: .6; }
:root[data-theme="light"] .ins-blob { opacity: .55; }

.ins-hero-copy { position: relative; min-width: 0; container-type: inline-size; }
.ins-title {
  margin: 6px 0 0;
  font-size: clamp(15px, .5vw + 12px, 18px);
  font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink-2);
}
.ins-title.is-display {
  margin-top: 10px;
  font-size: clamp(32px, 3vw + 14px, 54px);
  line-height: 1.04; letter-spacing: -0.04em; font-weight: 720;
  color: var(--ink);
  text-wrap: balance;
}

/* The worth, sized to its column by how many characters it holds (--chars, insights.js). */
.ins-worth {
  margin: 6px 0 0;
  font-size: clamp(40px, 4.2vw + 18px, 88px);
  font-size: min(clamp(40px, 4.2vw + 18px, 88px), calc(100cqi / (var(--chars, 9) * .62)));
  line-height: 1.02;
  font-weight: 720;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.ins-worth .ins-money { color: var(--gold-text); font-variant-numeric: normal; }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .ins-worth .ins-money:not(.is-masked) {
    background: linear-gradient(100deg, var(--gold) 0%, var(--gold-hi) 36%, var(--gold) 58%,
      color-mix(in srgb, var(--gold) 70%, #5a3a08) 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    padding-bottom: .06em;
  }
  :root[data-theme="light"] .ins-worth .ins-money:not(.is-masked) {
    background-image: linear-gradient(100deg, #7a5712 0%, #a67c22 45%, #8a6519 70%, #664609 100%);
  }
}
.ins-worth .ins-money.is-masked { color: var(--ink-3); }

.ins-change-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  margin: 12px 0 0;
  font-size: var(--fs-sm); color: var(--ink-3);
}
.ins-change-line.is-quiet { font-size: var(--fs-sm); }
.ins-note { margin: 12px 0 0; color: var(--ink-3); font-size: var(--fs-sm); max-width: 70ch; }
.ins-lede { margin: 14px 0 0; color: var(--ink-2); font-size: clamp(14.5px, .4vw + 13px, 16.5px); line-height: 1.55; max-width: 52ch; }
.ins-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.ins-cta .btn-lg { height: 44px; padding: 0 22px; }
.ins-empty-art { width: clamp(180px, 22vw, 280px); color: var(--gold); opacity: .9; }
.ins-empty-art svg { display: block; width: 100%; height: auto; }
.ins-hero.is-empty { min-height: min(60vh, 520px); align-items: center; }

/* At a glance, beside the worth: the split between cards and what is on display, then the figures. */
.ins-glance {
  width: clamp(280px, 30vw, 360px);
  padding: 16px 18px 15px;
  display: grid; gap: 14px;
}
.ins-split { display: flex; gap: 2px; height: 8px; }
.ins-split i { display: block; height: 100%; flex-basis: 0; min-width: 4px; border-radius: 8px; }
.ins-split .is-cards { flex-grow: var(--cards, .5); background: var(--accent); }
.ins-split .is-kits { flex-grow: calc(1 - var(--cards, .5)); background: var(--accent-2); }
.ins-glance-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ins-glance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 12px; }
.ins-glance-row + .ins-glance-row { padding-top: 10px; border-top: 1px solid var(--line-soft); }
.ins-glance-label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); min-width: 0; }
.ins-key { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--ink-3); }
.ins-glance-row.is-cards .ins-key { background: var(--accent); }
.ins-glance-row.is-kits .ins-key { background: var(--accent-2); }
.ins-glance-value { justify-self: end; font-size: 18px; font-weight: 720; letter-spacing: -0.02em; }
.ins-glance-value .ins-delta { font-size: 12.5px; }
.ins-glance-sub { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-3); }

/* A change: an arrow, the amount, the percentage — coloured by direction, never by colour alone. */
.ins-delta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.ins-delta.is-up { color: var(--ins-up); background: color-mix(in srgb, var(--ins-up) 13%, transparent); }
.ins-delta.is-down { color: var(--ins-down); background: color-mix(in srgb, var(--ins-down) 13%, transparent); }
.ins-delta-arrow { font-size: .72em; line-height: 1; }
.ins-delta-pct { font-weight: 600; opacity: .88; }
.ins-delta.is-big { font-size: 15px; padding: 5px 13px 5px 10px; }
.ins-row .ins-delta { padding: 2px 9px 2px 7px; font-size: 12.5px; }

/* =================================================================== controls */

.ins-controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 16px;
  margin: 4px 0 14px;
}
.ins-seg {
  display: inline-flex; align-items: center;
  padding: 3px; gap: 2px;
  border-radius: var(--radius-pill);
  background: var(--ins-glass);
  border: 1px solid var(--ins-glass-line);
  box-shadow: var(--glass-edge);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.ins-seg::-webkit-scrollbar { display: none; }
.ins-seg-opt {
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 32px; padding: 0 13px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 620; color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: color var(--t-1) var(--ease-out), background var(--t-1) var(--ease-out);
}
.ins-seg-opt:hover { color: var(--ink); }
.ins-seg-opt.is-on {
  color: var(--ink);
  background: var(--bg-3);
  box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 1px 0 var(--hairline);
}
:root[data-theme="light"] .ins-seg-opt.is-on { background: #fff; box-shadow: 0 1px 3px rgba(20,24,32,.14); }
.ins-seg-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ====================================================================== chart */

.ins-chart-card {
  --series: var(--gold);
  padding: clamp(14px, 1.6vw, 22px) clamp(14px, 1.6vw, 22px) 14px;
}
.ins-chart-card.is-cards { --series: var(--accent); }
.ins-chart-card.is-kits { --series: var(--accent-2); }

.ins-chart-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-height: 48px;
}
.ins-chart-head .ins-h3 { padding-top: 3px; color: var(--ink-2); }
.ins-readout {
  display: grid; justify-items: end; gap: 1px;
  min-width: 0; text-align: right;
}
.ins-readout-day { font-size: 11.5px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.ins-readout-value { font-size: 22px; font-weight: 720; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.ins-readout-parts { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.ins-plot {
  position: relative;
  /* A sideways drag reads the chart; up and down still scroll the page. */
  touch-action: pan-y;
  border-radius: 10px;
  outline-offset: 4px;
  transition: opacity var(--t-2) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.ins-chart-card.is-busy .ins-plot { opacity: .5; }
.ins-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.ins-chart { user-select: none; -webkit-user-select: none; }

.ins-grid line { stroke: var(--line-soft); stroke-width: 1; shape-rendering: crispEdges; }
:root[data-theme="light"] .ins-grid line { stroke: var(--line); stroke-opacity: .7; }
.ins-tick { fill: var(--ink-3); font-size: 11px; font-weight: 550; font-variant-numeric: tabular-nums; font-family: var(--font); }
.ins-since { stroke: var(--ink-3); stroke-opacity: .5; stroke-width: 1; shape-rendering: crispEdges; }
.ins-grad-top { stop-color: var(--series); stop-opacity: .24; }
.ins-grad-bottom { stop-color: var(--series); stop-opacity: 0; }
.ins-line { fill: none; stroke: var(--series); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.ins-end { fill: var(--series); stroke: var(--surface); stroke-width: 2.5; }
.ins-cross line { stroke: var(--ink-2); stroke-opacity: .55; stroke-width: 1; shape-rendering: crispEdges; }
.ins-cross circle { fill: var(--series); stroke: var(--surface); stroke-width: 2.5; }
.ins-hit { cursor: crosshair; }

/* The draw-in: the line's stroke runs left to right, then the wash rises under it. */
:root[data-motion="full"] .ins-chart.is-intro .ins-line {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: ins-draw 1500ms var(--ease-out) 120ms forwards;
}
:root[data-motion="full"] .ins-chart.is-intro .ins-area {
  opacity: 0;
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: ins-rise 900ms var(--ease-out) 700ms forwards;
}
:root[data-motion="full"] .ins-chart.is-intro .ins-end { opacity: 0; animation: ins-fade 300ms var(--ease-out) 1450ms forwards; }
:root[data-motion="full"] .ins-chart.is-swap .ins-line,
:root[data-motion="full"] .ins-chart.is-swap .ins-area,
:root[data-motion="reduced"] .ins-chart.is-intro,
:root[data-motion="reduced"] .ins-chart.is-swap { animation: ins-fade-in 280ms var(--ease-out) both; }
@keyframes ins-draw { to { stroke-dashoffset: 0; } }
@keyframes ins-rise { from { opacity: 0; transform: scaleY(.55); } to { opacity: 1; transform: none; } }
@keyframes ins-fade { to { opacity: 1; } }
@keyframes ins-fade-in { from { opacity: 0; } }

.ins-chart-foot { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }  /* one column no wider than the card: the table scrolls inside it */
.ins-chart-err { margin: 8px 0 0; color: var(--danger); font-size: var(--fs-sm); }

.ins-short {
  display: flex; align-items: flex-start; gap: 14px;
  padding: clamp(28px, 4vw, 52px) clamp(10px, 2vw, 24px);
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}
.ins-short-ico { flex: none; color: var(--gold); display: inline-flex; }
.ins-short-title { margin: 0; font-weight: 680; font-size: 15px; }
.ins-short-body { margin: 4px 0 0; color: var(--ink-2); font-size: var(--fs-sm); max-width: 62ch; }

.ins-table summary {
  display: inline-flex; align-items: center; gap: 6px;
  width: max-content;
  padding: 4px 10px; margin-left: -10px;
  border-radius: var(--radius-pill);
  color: var(--accent-text); font-size: 12.5px; font-weight: 650;
  cursor: pointer; list-style: none;
}
.ins-table summary::-webkit-details-marker { display: none; }
.ins-table summary::before { content: "▸"; font-size: 10px; transition: transform var(--t-1) var(--ease-out); }
.ins-table[open] summary::before { transform: rotate(90deg); }
.ins-table summary:hover { background: var(--bg-3); }
.ins-table-scroll {
  max-height: 320px; overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
}
.ins-table table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ins-table th, .ins-table td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.ins-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-2);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
}
.ins-table tbody th { font-weight: 550; color: var(--ink-2); }
.ins-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ins-table thead th:nth-child(n + 2):nth-child(-n + 4) { text-align: right; }
.ins-how { color: var(--ink-3); }

.ins-tile-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }

/* =================================================================== sections */

.ins-sec { margin-top: clamp(36px, 4vw, 60px); }
.ins-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 16px; margin-bottom: 14px;
}
.ins-head-text { min-width: 0; }

/* A row: a picture, a name and where it is, the figures on the right. */
.ins-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  color: inherit; text-decoration: none;
  transition: background var(--t-1) var(--ease-out);
}
.ins-row:has(> .ins-rank) { grid-template-columns: auto auto minmax(0, 1fr) auto; }
a.ins-row:hover, a.ins-row:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ins-row-body { display: grid; gap: 2px; min-width: 0; }
.ins-row-name { font-size: 13.5px; font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ins-row:hover .ins-row-name { color: var(--accent-text); }
.ins-row-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12px; color: var(--ink-3); }
.ins-row-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-row-nums { display: grid; justify-items: end; gap: 3px; text-align: right; }
.ins-row-top { display: inline-flex; align-items: center; gap: 8px; }
.ins-spark { width: 52px; height: 18px; }
@media (max-width: 400px) { .ins-spark { display: none; } }
.ins-row-sub { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

.ins-dot {
  flex: none; width: 8px; height: 8px; border-radius: 2px;
  background: var(--dot, #2f6f4f);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}

.ins-thumb {
  position: relative; flex: none;
  width: 40px; aspect-ratio: var(--card-ratio);
  display: grid; place-items: center;
  border-radius: 5px; overflow: hidden;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 22%, var(--bg-3)), var(--bg-3));
  box-shadow: 0 2px 8px rgba(0,0,0,.28), inset 0 0 0 1px var(--hairline);
}
.ins-thumb.is-photo { width: 46px; aspect-ratio: 1; border-radius: 10px; background: linear-gradient(150deg, color-mix(in srgb, var(--accent-2) 22%, var(--bg-3)), var(--bg-3)); }
.ins-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ins-thumb.is-photo img { object-fit: cover; }
.ins-thumb-mono { font-size: 11px; font-weight: 800; color: var(--ink-3); letter-spacing: -0.02em; }

/* ---- movers */
.ins-movers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ins-movers-col { padding: 14px 10px 10px; border-radius: var(--radius-lg); background: var(--ins-glass); border: 1px solid var(--ins-glass-line); box-shadow: var(--glass-edge); }
.ins-col-title { display: flex; align-items: center; gap: 8px; margin: 0 6px 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.ins-col-arrow { font-size: 10px; }
.ins-col-arrow.is-up { color: var(--ins-up); }
.ins-col-arrow.is-down { color: var(--ins-down); }
.ins-movers-list, .ins-holdings, .ins-paid-list { list-style: none; margin: 0; padding: 0; }
.ins-movers-list > li + li, .ins-paid-list > li + li { border-top: 1px solid var(--line-soft); }

/* ---- holdings */
.ins-holdings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.ins-holdings .ins-row { padding: 10px 12px; }
.ins-rank {
  min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}
.ins-rank.is-1 { color: #2a1c02; background: linear-gradient(135deg, #fbe3a0, #c8952f); }
.ins-rank.is-2 { color: #1b1f27; background: linear-gradient(135deg, #f3f5f9, #9aa3b2); }
.ins-rank.is-3 { color: #2a1405; background: linear-gradient(135deg, #f0bd98, #a8663b); }
.ins-share { display: block; width: 88px; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.ins-share i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left center; transform: scaleX(var(--p, 0)); border-radius: 3px; }

/* ---- allocation (insights.js breakdownSection): a donut and a sortable table */
.ins-alloc { padding: clamp(14px, 1.8vw, 22px); }
.ins-alloc-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.ins-donut-wrap { position: relative; width: 220px; aspect-ratio: 1; }
.ins-donut { display: block; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ins-donut-track { fill: none; stroke: color-mix(in srgb, var(--ink) 7%, transparent); stroke-width: 22; }
.ins-donut-arc {
  fill: none; stroke-width: 22; cursor: pointer;
  transition: opacity var(--t-2) var(--ease-out), stroke-width var(--t-2) var(--ease-out);
}
.ins-donut-arc.is-dim { opacity: .28; }
.ins-donut-arc:not(.is-dim):hover { stroke-width: 26; }
.ins-donut-mid {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  pointer-events: none; text-align: center;
}
.ins-donut-total { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--gold-text); }
.ins-donut-sub { font-size: 12px; color: var(--ink-3); }
:root[data-motion="full"] .ins [data-reveal]:not(.is-revealed) .ins-donut { opacity: 0; transform: rotate(-150deg) scale(.9); }
:root[data-motion="full"] .ins [data-reveal] .ins-donut { transition: opacity 600ms var(--ease-out), transform 900ms var(--ease-out); }

.ins-alloc-side { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ins-alloc-scroll { max-height: 380px; overflow-y: auto; overscroll-behavior: contain; border-radius: 10px; }
.ins-alloc-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ins-alloc-table thead th {
  position: sticky; top: 0; z-index: 1; padding: 0; text-align: left;
  background: var(--bg-2); border-bottom: 1px solid var(--line);
}
.ins-alloc-table th.is-num, .ins-alloc-table td.is-num { text-align: right; }
.ins-alloc-sort {
  display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 8px 8px;
  border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
th.is-num .ins-alloc-sort { justify-content: flex-end; }
.ins-alloc-sort.is-on { color: var(--ink); }
.ins-alloc-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.ins-alloc-caret { font-size: 9px; min-width: 9px; }
.ins-alloc-table td { padding: 7px 8px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); vertical-align: middle; }
.ins-alloc-table tbody tr { transition: background var(--t-1) var(--ease-out); }
.ins-alloc-table tbody tr.is-on { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.ins-alloc-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ins-alloc-swatch { flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--sw, var(--ink-3)); }
.ins-alloc-label { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.ins-alloc-label a { color: inherit; text-decoration: none; }
.ins-alloc-label a:hover { text-decoration: underline; }
.ins-alloc-sub { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.ins-alloc-table td .ins-money { font-weight: 700; color: var(--ink); }
.ins-alloc-share { width: 110px; }
td.ins-alloc-share { display: table-cell; }
td.ins-alloc-share > span { display: block; font-weight: 650; }
.ins-alloc-bar { display: block; height: 4px; margin-top: 4px; margin-left: auto; width: 80px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.ins-alloc-bar i { display: block; height: 100%; border-radius: 4px; }
.ins-alloc-count { color: var(--ink-3); white-space: nowrap; }
.ins-alloc-note { margin: 0; font-size: 12px; color: var(--ink-3); }
.ins-alloc-empty { margin: 0; padding: 24px 4px; color: var(--ink-3); text-align: center; }
.ins-alloc-loading { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: center; }
.ins-alloc-skel-ring { display: block; width: 200px; height: 200px; border-radius: 50%; }
.ins-alloc-skel-rows { display: block; height: 180px; border-radius: 12px; }
/* allocation over time: a stacked chart under the donut */
.ins-alloc-wrap { display: flex; flex-direction: column; gap: 18px; }
.ins-over { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.ins-over-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.ins-over-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.ins-over-skel { display: block; height: 190px; border-radius: 12px; }
.ins-over-plot { position: relative; border-radius: 8px; cursor: crosshair; touch-action: pan-y; }
.ins-over-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.ins-over-chart { display: block; width: 100%; height: auto; }
.ins-over-band { opacity: .88; stroke: var(--bg-2); stroke-width: .6; }
.ins-over-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ink-2); opacity: .6; pointer-events: none; }
.ins-over-tip {
  position: absolute; top: 4px; z-index: 2; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 3px; min-width: 180px; max-width: 260px; padding: 8px 10px; border-radius: 10px;
  font-size: 12px; pointer-events: none;
  background: var(--bg-3); border: 1px solid var(--line); box-shadow: var(--shadow-1, 0 8px 20px rgba(0,0,0,.35));
}
.ins-over-tip.is-left { transform: translateX(10px); }
.ins-over-tip.is-right { transform: translateX(calc(-100% - 10px)); }
.ins-over-tip b { font-size: 12px; font-weight: 700; }
.ins-over-tip-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.ins-over-tip-row i { width: 9px; height: 9px; border-radius: 2px; }
.ins-over-tip-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ins-over-tip-row em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 650; }
.ins-over-tip[hidden], .ins-over-cross[hidden] { display: none; }
.ins-over-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ins-over-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); }
.ins-over-legend li { display: inline-flex; align-items: center; gap: 6px; }
.ins-over-legend i { width: 10px; height: 10px; border-radius: 3px; }

@media (max-width: 760px) {
  .ins-alloc-body, .ins-alloc-loading { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .ins-alloc-side { width: 100%; }
  .ins-donut-wrap { width: min(220px, 64vw); }
  .ins-alloc-count { display: none; }
  .ins-alloc-scroll { max-height: none; }
}

:root[data-motion="full"] .ins [data-reveal]:not(.is-revealed) .ins-share i { transform: scaleX(0); }
:root[data-motion="full"] .ins [data-reveal] .ins-share i { transition: transform 900ms var(--ease-out) 200ms; }

/* ---- paid versus worth */
.ins-paid { padding: 16px clamp(12px, 1.6vw, 20px) 14px; display: grid; gap: 12px; }
.ins-paid-sum {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 22px;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.ins-paid-fig { display: grid; justify-items: start; gap: 3px; }
.ins-paid-fig .ins-money { font-size: 22px; font-weight: 720; letter-spacing: -0.03em; }
.ins-paid-arrow { color: var(--ink-3); font-size: 18px; padding-bottom: 3px; }
.ins-paid-fig:last-child { margin-left: auto; }
.ins-gain-bar { display: block; width: 88px; height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--ink) 9%, transparent); overflow: hidden; }
.ins-gain-bar i { display: block; height: 100%; width: 100%; transform-origin: left center; transform: scaleX(var(--p, 0)); background: var(--ink-3); }
.ins-gain-bar.is-up i { background: var(--ins-up); }
.ins-gain-bar.is-down i { background: var(--ins-down); }
.ins-more { justify-self: start; }

/* ---- foot */
.ins-foot {
  margin-top: clamp(40px, 5vw, 72px);
  padding: 22px 0 8px;
  border-top: 1px solid var(--line-soft);
}
.ins-how-list { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; color: var(--ink-3); font-size: 12.5px; max-width: 90ch; }

/* ==================================================================== loading */

.ins.is-loading .ins-chart-card { padding: 16px; }

/* ================================================================= responsive */

@media (max-width: 1000px) {
}

@media (max-width: 760px) {
  .ins-hero { grid-template-columns: minmax(0, 1fr); }
  .ins-empty-art { justify-self: start; width: 180px; }
  .ins-glance { width: 100%; }
  .ins-movers, .ins-holdings { grid-template-columns: minmax(0, 1fr); }
  .ins-chart-head { min-height: 0; }
  .ins-readout { justify-items: start; text-align: left; width: 100%; }
}

@media (max-width: 520px) {
  .ins-controls { gap: 8px; }
  .ins-controls .ins-seg { width: 100%; justify-content: space-between; }
  .ins-controls .ins-seg-opt { flex: 1 1 0; min-width: 0; padding: 0 8px; }
  /* At a glance, tighter: the two figures side by side, the gain under them. */
  .ins-glance { padding: 14px 14px 12px; gap: 12px; }
  .ins-glance-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .ins-glance-row { grid-template-columns: minmax(0, 1fr); }
  .ins-glance-row + .ins-glance-row { padding-top: 0; border-top: 0; }
  .ins-glance-row:nth-child(3) { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; padding-top: 10px; border-top: 1px solid var(--line-soft); }
  .ins-glance-value { justify-self: start; font-size: 17px; }
  .ins-glance-row:nth-child(3) .ins-glance-value { justify-self: end; }
  .ins-row { gap: 10px; padding: 8px 6px; }
  .ins-holdings .ins-row { padding: 8px 6px; }
  .ins-share, .ins-gain-bar { width: 64px; }
  .ins-paid-fig:last-child { margin-left: 0; flex-basis: 100%; }
  .ins-paid-arrow { display: none; }
  .ins-paid-sum { gap: 10px 18px; }
  .ins-readout-value { font-size: 19px; }
}

/* A phone on its side: the chart keeps to the height there is. */
@media (max-height: 480px) and (orientation: landscape) {
  .ins-hero { padding-top: 16px; }
  .ins-worth { font-size: min(44px, calc(100cqi / (var(--chars, 9) * .62))); }
}

@media print {
  .ins-sky, .ins-controls, .ins-table summary { display: none !important; }
}

/* ---- Fix history: the button under the chart, and its dialog */
.ins-fix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ins-fix .ins-fine { margin: 0; }
.modal.modal-fix { width: min(520px, 100%); }
.ins-fix-hint {
  margin: 0; padding: 10px 12px; border-radius: var(--radius);
  font-size: 13px; line-height: 1.45; color: var(--ink-2);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, var(--line));
}
.ins-fix-opt { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.ins-fix-opt input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.ins-fix-opt > span { display: flex; flex-direction: column; gap: 2px; }
.ins-fix-opt b { font-size: 14px; }
.ins-fix-opt > span > span { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.ins-fix-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: -4px 0 4px 26px; }
.ins-fix-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.ins-fix-dates.is-off { opacity: .45; }
@media (max-width: 420px) { .ins-fix-dates { grid-template-columns: 1fr; } }

/* ---- Sold: a sale's row keeps a small × to take it back */
.ins-sale { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.ins-sale-amt { font-weight: 700; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.ins-sale-x { color: var(--ink-3); }

/* ---- Export CSV (insights-export.js): a button with the controls, and its dialog's four files */
.ins-export-btn { margin-left: auto; gap: 6px; }
.ins-report-btn { gap: 6px; }
.ins-history-btn { gap: 6px; }
.ins-export-list { display: flex; flex-direction: column; gap: 8px; }
.ins-export-opt {
  display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 12px 14px; text-align: left;
  border-radius: 12px; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line);
}
.ins-export-opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ins-export-opt:disabled { opacity: .6; cursor: progress; }
.ins-export-opt b { font-size: 14.5px; font-weight: 700; }
.ins-export-opt span { font-size: 12.5px; color: var(--ink-3); }
