/* ============================================================================
 * StockCard — shared card stylesheet
 *
 * Used by every page that wants to render a stock card (mockups.html for the
 * swipe-deck; search, trade, compare for the "view card" pop-out sheet).
 *
 * Scope: this file owns everything inside .card-stage / .card and the bottom-
 * sheet host that wraps it (.sc-sheet-*). Page-level chrome (top bar, drawer,
 * bottom bar) lives in each page's own <style> block.
 * ========================================================================== */

/* === Card chassis ===
 *
 * The card carries two cosmetic axes:
 *   1. sector-<slug>  → 11 sector palettes that recolour subtle accents
 *      (chip, top-glow, section title, sparkline, summary tint, locked panel).
 *      Each `.sector-*` rule below sets two custom properties:
 *        --sec-rgb    : the sector accent as "r, g, b" so we can compose alpha
 *        --sec-strong : a denser fallback (used where alpha-tints look weak)
 *   2. tier-0..3      → score-driven gold-trim intensity around the card.
 *      Drives drop-shadow (on `.card-stage`) and border / inset glow
 *      (on `.face-alpha` below).
 *
 * Default values (`--sec-*`, `--trim-*`) are a neutral fallback; every card
 * always gets a sector + tier class so the defaults are rarely used.
 * ======================================================================= */
.card-stage {
  perspective: 1600px;
  width: 320px;
  height: 580px;
  /* Detail panels grow the stage taller via inline style; transition smooths
     the height change so the panel doesn't pop in / out abruptly. */
  transition: height 0.22s ease;
  /* Sector + tier defaults — overridden by `.sector-*` / `.tier-*` rules */
  --sec-rgb: 148, 163, 184;       /* slate-400 fallback */
  --sec-strong: #94a3b8;
  --trim-rgb: 0, 0, 0;
  --trim-glow: 0;
  --trim-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  filter: drop-shadow(var(--trim-shadow));
}

/* === Score-tier GOLD trim ===
 * Every tier wears gold — only the intensity changes. Drives drop-shadow
 * on `.card-stage`; the border + inset glow on `.face-alpha` also key off
 * `--trim-glow` set here. */
.card-stage.tier-0 {
  --trim-glow: 0.20;
  --trim-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
}
.card-stage.tier-1 {
  --trim-glow: 0.38;
  --trim-shadow: 0 10px 26px rgba(120, 90, 30, 0.30), 0 4px 12px rgba(0, 0, 0, 0.45);
}
.card-stage.tier-2 {
  --trim-glow: 0.60;
  --trim-shadow: 0 12px 32px rgba(190, 130, 40, 0.40), 0 5px 14px rgba(0, 0, 0, 0.40);
}
.card-stage.tier-3 {
  --trim-glow: 0.95;
  --trim-shadow: 0 16px 40px rgba(217, 161, 64, 0.55), 0 6px 18px rgba(0, 0, 0, 0.40);
}

/* === Sector palettes ===
 *
 * Each sector defines THREE colour stops:
 *   --sec-rgb     : accent (chip background tint, sparkline tint, etc.)
 *   --sec-strong  : saturated accent (section titles, sparkline mid stop)
 *   --bg-deep     : deep-saturated tint for the card base (bottom of gradient)
 *   --bg-mid      : lighter mid-tint for the top of the base gradient
 *
 * --bg-* are kept dark enough (lightness ≤ 16%) that white/light text
 * stays high-contrast. The strong accent goes BIG via a top wash so the
 * card front reads as the sector colour at a glance.
 *
 * NOTE: the selectors below intentionally target `.sector-<slug>` alone
 * (not `.card-stage.sector-<slug>`) so the SAME palette tokens can be
 * inherited by ANY element that carries a sector class — e.g. the
 * compare-page mini-cards (`.stock-header.sector-tech`) and the
 * search-page result rows / preview (`.result-row.sector-tech`,
 * `.preview-card.sector-tech`). Card-stage rules elsewhere in this file
 * still consume the tokens because CSS custom-property inheritance flows
 * down from whichever ancestor sets them. */
.sector-tech {
  --sec-rgb: 124, 138, 232;  --sec-strong: #8b9aff;
  --bg-deep: #0c1030;        --bg-mid:   #16204a;
}
/* NB: Comms ⇄ Healthcare and Cyclical ⇄ Defensive palettes swapped — design
   call to put the rose on the more "human" comms sector and clinical-feeling
   sky on healthcare, and to put the calmer sage on cyclical / warmer amber
   on defensive staples. */
.sector-comms {
  --sec-rgb: 224, 110, 130;  --sec-strong: #f08296;
  --bg-deep: #210b14;        --bg-mid:   #391624;
}
.sector-cyclical {
  --sec-rgb: 130, 192, 130;  --sec-strong: #97d997;
  --bg-deep: #0b1c12;        --bg-mid:   #14301f;
}
.sector-defensive {
  --sec-rgb: 232, 168,  76;  --sec-strong: #f0b86b;
  --bg-deep: #20140a;        --bg-mid:   #36241a;
}
.sector-healthcare {
  --sec-rgb:  86, 175, 224;  --sec-strong: #5dc1ff;
  --bg-deep: #07182a;        --bg-mid:   #0e2842;
}
.sector-financial {
  --sec-rgb:  85, 188, 156;  --sec-strong: #6ed4b2;
  --bg-deep: #08201a;        --bg-mid:   #0f3a2e;
}
.sector-energy {
  --sec-rgb: 232, 130,  70;  --sec-strong: #ff9a5d;
  --bg-deep: #220f08;        --bg-mid:   #3a1d10;
}
.sector-industrials {
  --sec-rgb: 156, 175, 200;  --sec-strong: #b6c5dc;
  --bg-deep: #0d1320;        --bg-mid:   #1a2233;
}
.sector-utilities {
  --sec-rgb:  90, 192, 192;  --sec-strong: #71d6d6;
  --bg-deep: #06212a;        --bg-mid:   #0d3540;
}
.sector-realestate {
  --sec-rgb: 196, 152, 110;  --sec-strong: #d6ad82;
  --bg-deep: #1c1108;        --bg-mid:   #2f2014;
}
.sector-materials {
  --sec-rgb: 196, 130,  98;  --sec-strong: #d69874;
  --bg-deep: #1d0e08;        --bg-mid:   #321a10;
}
.sector-neutral {
  --sec-rgb: 148, 163, 184;  --sec-strong: #cbd5e1;
  --bg-deep: #0a0d18;        --bg-mid:   #161b2b;
}
.card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.card.flipped { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  /* Primary mechanism (works on browsers that respect it correctly). */
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
  /* v17 flip-bleed fix: backface-visibility silently fails on some
     browsers (e.g. iOS Safari when an ancestor has its own transform
     like .sc-sheet's translateY). Without a fallback the front face's
     mirror image bleeds through the back when the card flips. We add
     an OPACITY fallback that hides the away-facing face — but with a
     delay matching the rotation midpoint so the visual flip still
     animates smoothly. .card has transition 0.7s, so we swap opacity
     at 0.35s (the moment both faces are edge-on / invisible anyway). */
  transition: opacity 0s linear 0.35s;
  border-radius: 20px;
  overflow: hidden;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
}
.face.front { transform: translateZ(1px); }
.face.back {
  transform: rotateY(180deg) translateZ(1px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* Hidden by default — only fades in at flip midpoint */
  opacity: 0;
}
/* Once flipped: front hides, back shows. The delayed transition above
   means each face changes opacity at t=0.35s, after the card has
   rotated past 90° (when both faces are edge-on, so the swap is
   invisible to the user). */
.card.flipped .face.front { opacity: 0; }
.card.flipped .face.back  { opacity: 1; }
/* Without this the flex-column children default to flex-shrink: 1 and the
   locked-block (which packs Buy-timing + Insider Track subsections) collapses
   to ~60% of its natural height, hiding the Insider Track subsection AND
   making scrollHeight report the compressed size — which then makes the
   stage-growth measurement undershoot. Pinning every direct child stops the
   squeeze and lets scrollHeight return the true content size. */
.face > * { flex-shrink: 0; }
/* Route clicks to the visible face only — without this, clicks on screen
   positions that overlap the hidden face's content can silently activate
   controls (e.g. the Custom Score picker) on the back. */
.card.flipped .face.front { pointer-events: none; }
.card:not(.flipped) .face.back { pointer-events: none; }

/* === Shared inner structure === */
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  z-index: 2;
}
.ticker-block { min-width: 0; }
.ticker {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}
.company-name {
  font-size: 11px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chips {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.chips-row { margin: 6px 0 4px; }
.chip {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-block { text-align: right; min-width: 0; }
/* When a share button is rendered on the front face, give the price block
   enough right-padding so the rightmost digit clears the 32px share icon
   (which is absolutely positioned at right: 12px). Skips when a lev-chip
   pushes the share button to the LEFT instead. */
.face.front:has(.share-btn):not(:has(.lev-chip)) .price-block { padding-right: 40px; }
.price { font-size: 18px; font-weight: 700; line-height: 1; }
.day-change { font-size: 11px; font-weight: 600; margin-top: 3px; color: #10b981; }
.day-change.neg { color: #ef4444; }

.score-block {
  margin: 12px 0 6px;
  padding: 9px 12px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 2;
}
.score-block:has(.custom-picker[data-state="open"]) { z-index: 60; }
.score-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.score-row-premium { opacity: 0.78; }
.score-row-custom {
  opacity: 0.85;
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background 0.2s ease;
}
.score-row-custom:hover { background: rgba(251, 191, 36, 0.06); }
.score-row-custom .picker-chevron {
  font-size: 9px;
  opacity: 0.7;
  margin-left: 3px;
  display: inline-block;
  transition: transform 0.2s ease;
}
.score-row-custom[data-picker-open="true"] .picker-chevron { transform: rotate(180deg); }

.edition-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.edition-values {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.score-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.3px;
}
.score-letter {
  font-size: 14px;
  font-weight: 800;
}
.premium-lock { font-size: 10px; }
.score-premium-value {
  font-size: 14px;
  font-weight: 800;
  filter: blur(3px);
  user-select: none;
  line-height: 1;
}
.score-pitch {
  font-size: 9.5px;
  font-style: italic;
  text-align: center;
  line-height: 1.3;
  margin-top: 1px;
}

/* === Custom Score picker (inline overlay anchored to score block) ===
   Scoped to `.score-block .custom-picker` so these rules ONLY apply to the
   in-card picker that lives inside a stock card's score block (mockups,
   trade, search preview). compare.html has its own `.custom-picker` (a
   sibling of matrix rows, not inside a score block) with its own layout —
   the absolute/top: calc(100% + 4px) below previously bled into compare and
   shoved that picker hundreds of px below the row it should drop under. */
.score-block .custom-picker {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: rgba(14, 12, 36, 0.96);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(251, 191, 36, 0.45);
  border-radius: 12px;
  padding: 10px 12px 12px;
  z-index: 50;
  display: none;
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}
.score-block .custom-picker[data-state="open"] { display: block; }
.custom-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.custom-picker-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #fde68a;
}
.custom-picker-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.custom-picker-sub {
  font-size: 9.5px;
  line-height: 1.4;
  color: #cbd5e1;
  margin-bottom: 8px;
}
.custom-picker-sub strong { color: #fde68a; }
.custom-picker-options {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.picker-option {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 4px;
  font-size: 11px;
  color: #e2e8f0;
  cursor: pointer;
  border-radius: 6px;
  user-select: none;
}
.picker-option:hover { background: rgba(255, 255, 255, 0.04); }
.picker-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin: 0;
}
.picker-option input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #fbbf24;
}
.picker-option input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
  color: #1e1b4b;
  line-height: 1;
}
.picker-option.premium-axis { color: #fde68a; }
.picker-option.premium-axis .axis-lock { font-size: 9px; opacity: 0.85; margin-right: 1px; }
.picker-divider {
  border-top: 1px dashed rgba(251, 191, 36, 0.2);
  margin: 4px 2px;
}
/* Group heading for mixed-kind picker on the compare page (Stock axes /
   Shared / ETF axes). Subtle uppercase label that separates the groups
   without making the picker feel like a heavy header. */
.picker-group-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 8px 2px;
  margin: 2px 0 0;
}

/* === Stat list === */
.stats {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 6px;
  z-index: 2;
}
.stat-row { width: 100%; }
.stat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.stat-label { font-size: 11px; font-weight: 500; }
.stat-value { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bar-track {
  position: relative;
  height: 5px;
  border-radius: 3px;
  overflow: visible;
}
.bar-track::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
}
.bar-zero {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 2;
}
.bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
}
.bar-fill.pos {
  left: 50%;
  background: linear-gradient(90deg, #10b981, #34d399);
}
.bar-fill.neg {
  right: 50%;
  background: linear-gradient(90deg, #fca5a5, #ef4444);
}

/* ============================================================================
 * Per-axis raw-data drawer (inline expansion on stat rows)
 * Tap-target is the chevron on the right of the row; the panel below renders
 * sub-signals (raw value + sector median) with tone-coloured indicators and
 * a locked Premium subsection for the historical / percentile-rank upsell.
 * ========================================================================== */
/* When a row has a chevron the head goes from 2 children → 3. Stop the
   default `space-between` from spreading value into the middle: push label
   to fill remaining space so value + chevron sit together on the right. */
.stat-row.has-detail .stat-head { padding-right: 2px; }
.stat-row.has-detail .stat-label { margin-right: auto; }
.stat-detail-toggle {
  background: transparent;
  border: 0;
  padding: 0 4px;
  margin-left: 6px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s ease, color 0.15s ease;
  align-self: center;
}
.stat-detail-toggle:hover { color: rgba(255, 255, 255, 0.85); }
.stat-row.detail-open .stat-detail-toggle {
  transform: rotate(90deg);
  color: #fde68a;
}

.stat-detail-panel {
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 9px 10px 10px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10.5px;
  line-height: 1.35;
}
.stat-detail-meta {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}
.stat-detail-sigs { display: flex; flex-direction: column; gap: 4px; }
.sig-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.sig-row:last-child { border-bottom: 0; }
.sig-name { font-weight: 500; color: #e6ebf3; }
.sig-value { font-weight: 700; font-variant-numeric: tabular-nums; color: #f1f5f9; }
.sig-median {
  font-size: 10px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}
.sig-glyph { font-size: 9px; }
.sig-row.tone-good .sig-glyph { color: #10b981; }
.sig-row.tone-bad  .sig-glyph { color: #ef4444; }
.sig-row.tone-neutral .sig-glyph { color: #94a3b8; }

.stat-detail-method {
  margin-top: 7px;
  font-size: 9.5px;
  font-style: italic;
  color: #94a3b8;
  line-height: 1.4;
}

.stat-detail-locked {
  margin-top: 9px;
  padding: 7px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(0, 0, 0, 0.3));
  border: 1px dashed rgba(251, 191, 36, 0.4);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.stat-detail-locked .lock { font-size: 12px; }
.stat-detail-locked-body strong {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: #fde68a;
  letter-spacing: 0.2px;
}
.stat-detail-locked-body p {
  margin: 2px 0 0;
  font-size: 9.5px;
  color: #cbd5e1;
  line-height: 1.35;
}
.stat-detail-locked .upgrade-pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 999px;
  padding: 3px 7px;
  white-space: nowrap;
}

/* === Summary + footer === */
.summary {
  font-size: 11px;
  line-height: 1.45;
  margin-top: auto;
  padding: 9px 11px;
  border-radius: 10px;
  z-index: 2;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  z-index: 2;
}
.disclaimer {
  font-size: 9px;
  text-align: left;
  z-index: 2;
  flex: 1;
  min-width: 0;
}

/* === Compare toggle (pill on card front) ===
   Bumped from the earlier subtle treatment. Users were missing this
   feature entirely because the OFF state read as decoration rather than a
   real action: muted gray text on faint-gold border. Now the OFF state
   uses a clear gold tint + gold text + larger box, so it visibly invites
   the tap. The ON state stays as a full gold pill so the state difference
   is still obvious. */
.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 8px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.10);
  border: 1.4px solid rgba(251, 191, 36, 0.50);
  font-family: inherit;
  font-size: 11px;
  font-weight: 800;
  color: #fde68a;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
}
.compare-toggle:hover {
  background: rgba(251, 191, 36, 0.18);
  border-color: rgba(251, 191, 36, 0.70);
  color: #fbbf24;
}
.compare-toggle .compare-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.6px solid rgba(251, 191, 36, 0.70);
  background: rgba(0, 0, 0, 0.30);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.compare-toggle[data-on="true"] {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.32) 0%, rgba(245, 158, 11, 0.28) 100%);
  border-color: #fbbf24;
  color: #1e1b4b;
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.30), 0 4px 12px rgba(251, 191, 36, 0.20);
}
.compare-toggle[data-on="true"] .compare-box {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-color: #fbbf24;
  color: #1e1b4b;
}

/* === Back face === */
.back-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  margin-bottom: 10px;
  position: relative;
  z-index: 2;
}
.back-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  /* Gold (premium) bleeds into sector tint — ties the rating identity to
     the per-sector palette across the divider line. */
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.35) 20%, rgba(var(--sec-rgb), 0.45) 60%, transparent);
}
.back-id { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.back-ticker { font-size: 15px; font-weight: 800; letter-spacing: -0.3px; }
.back-dot { font-size: 12px; }
.back-sector-name { font-size: 11px; font-weight: 500; }
.back-score-mini {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.back-score-row { display: flex; align-items: baseline; gap: 5px; }
.back-score-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 700;
}
.back-score-lock { font-size: 8px; margin-right: 1px; }
.back-score-value {
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
/* Locked Full Score in the back header — mirrors the front's
   .score-premium-value blur so the upsell signal is consistent. */
.back-score-row-locked .back-score-value { font-size: 12px; }
.back-score-value-blurred { filter: blur(3px); user-select: none; }

.section-block { margin-bottom: 11px; z-index: 2; }
.section-title {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.accent-line { width: 12px; height: 1px; }

.contrib-list { display: flex; flex-direction: column; gap: 5px; }
.contrib-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px;
  border-radius: 8px;
}
.contrib-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.contrib-icon.pos { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.contrib-icon.neg { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.contrib-text { flex: 1; min-width: 0; }
.contrib-label { font-size: 11px; font-weight: 600; line-height: 1.2; }
.contrib-detail { font-size: 9.5px; margin-top: 1px; line-height: 1.25; }
.contrib-value { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.contrib-value.pos { color: #34d399; }
.contrib-value.neg { color: #fca5a5; }

.trajectory { margin-top: 9px; }
.trajectory-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.trajectory-label { font-size: 9.5px; font-weight: 500; }
.traj-upgrade-hint {
  display: inline-block;
  font-size: 8.5px; font-weight: 700;
  color: #cbd5e1;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(148,163,184,0.18) 100%);
  border: 1px solid rgba(255,255,255,0.18);
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 4px;
  letter-spacing: 0.2px;
  vertical-align: 1px;
}
.trajectory-now {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
  font-variant-numeric: tabular-nums;
}

.back-stats { display: flex; flex-direction: column; gap: 7px; }

/* === Locked block (premium teaser) === */
.locked-block {
  border-radius: 12px;
  padding: 8px 10px;
  margin: 4px 0 8px;
  position: relative;
  overflow: hidden;
  z-index: 2;
}
.locked-block::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(251, 191, 36, 0.12), transparent 60%);
  pointer-events: none;
}
.locked-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: relative;
}
.locked-head .lock-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
}
.locked-head .upgrade-pill {
  font-size: 9px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.disagree-callout {
  margin-bottom: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.35;
  display: flex;
  gap: 7px;
  align-items: flex-start;
  position: relative;
}
.disagree-callout .warn { flex-shrink: 0; font-size: 11px; }
.locked-row { margin-bottom: 4px; position: relative; }
.locked-row:last-child { margin-bottom: 0; }
.locked-row .stat-head { margin-bottom: 3px; }
.locked-row .stat-value { filter: blur(4px); user-select: none; opacity: 0.85; }
.locked-row .bar-fill { filter: blur(2.5px) opacity(0.5); }

.locked-subsection { margin-bottom: 8px; }
.locked-subsection:last-child { margin-bottom: 0; }
.locked-subsection + .locked-subsection {
  border-top: 1px dashed rgba(251, 191, 36, 0.18);
  padding-top: 8px;
}
.locked-subsection-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.9;
}

/* === Insider Track event rows === */
.ie-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
  font-size: 10px;
  line-height: 1.2;
}
.ie-type {
  font-size: 8.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.2;
}
.ie-type.ie-buy      { background: rgba(52, 211, 153, 0.22); color: #34d399; }
.ie-type.ie-sell     { background: rgba(252, 165, 165, 0.22); color: #fca5a5; }
.ie-type.ie-earnings { background: rgba(251, 191, 36, 0.22); color: #fde68a; }
.ie-type.ie-filing   { background: rgba(192, 132, 252, 0.22); color: #c084fc; }
.ie-type.ie-event    { background: rgba(99, 102, 241, 0.25); color: #c7d2fe; }
.ie-label {
  flex: 1;
  filter: blur(3px);
  user-select: none;
  font-weight: 600;
  font-size: 10px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.ie-when {
  font-size: 9px;
  opacity: 0.75;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.stat-row-premium .stat-label {
  color: #fde68a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.row-lock { font-size: 9px; opacity: 0.9; }
.stat-row-premium .stat-value {
  filter: blur(3.5px);
  user-select: none;
  opacity: 0.85;
  color: #fde68a;
}
.stat-row-premium .bar-fill { filter: blur(2.5px); opacity: 0.55; }

/* === Sparkline === */
.sparkline {
  height: 28px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  padding: 2px;
}
.sparkline svg { width: 100%; height: 100%; display: block; }

.disclaimer-back {
  font-size: 8.5px;
  line-height: 1.5;
  margin-top: 8px;
  padding-top: 8px;
  position: relative;
  z-index: 2;
}
.disclaimer-back::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}
.method-link { text-decoration: none; font-weight: 700; }
.method-link:hover { text-decoration: underline; }

/* ============================================================================
 * Alpha variant — the only visual style currently rendered. (β/γ removed
 * during the shared-card extraction; revive from git if we ever need them.)
 *
 * Background uses sector tint as a SUBTLE top wash so the deck reads as
 * "blue-ish = tech, green-ish = defensive" at a glance — without making
 * either side of the card feel chromatically loud. The base is the same
 * deep ink shared across the felt theme.
 * ========================================================================== */
.face-alpha {
  background:
    /* Strong sector wash at the top — this is what makes each card visually
       distinct as a sector at first glance. */
    radial-gradient(ellipse 110% 70% at 50% -10%, rgba(var(--sec-rgb), 0.45) 0%, transparent 60%),
    /* Subtle bottom-right secondary wash for depth */
    radial-gradient(ellipse 90% 55% at 100% 105%, rgba(var(--sec-rgb), 0.18) 0%, transparent 65%),
    /* Sector-tinted base gradient — replaces the universal dark ink */
    linear-gradient(165deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  color: #f1f5f9;
  /* Trim border + glow is provided per-tier (see `.card.tier-N .face-alpha`
     blocks below). Each step up adds a concentric gold line so the pattern
     itself reads richer — not just thicker. */
}

/* === Patterned tier trims ===
 *
 * Pattern complexity scales with score, all in gold:
 *   tier-0 : 1 thin hairline (the floor — still wears the gold brand)
 *   tier-1 : 1 brighter line + faint inner glow
 *   tier-2 : DOUBLE band (outer + inner, dark gap between) + glow
 *   tier-3 : TRIPLE band (outer + mid + inner) + strong inner glow
 *
 * Depths are kept under ~7px even at tier-3 so the trim never collides with
 * the score block / content padding (face is 16–18px from edge). */
.card.tier-0 .face-alpha {
  box-shadow:
    inset 0 0 0 1px rgba(251, 191, 36, 0.38);
}
.card.tier-1 .face-alpha {
  box-shadow:
    inset 0 0 0 1.5px rgba(251, 191, 36, 0.58),
    inset 0 0 16px rgba(251, 191, 36, 0.06);
}
.card.tier-2 .face-alpha {
  box-shadow:
    inset 0 0 0 1.75px rgba(251, 191, 36, 0.78),
    inset 0 0 0 3.5px  rgba(0,   0,   0,   0.32),
    inset 0 0 0 4.5px  rgba(251, 191, 36, 0.45),
    inset 0 0 22px      rgba(251, 191, 36, 0.10);
}
.card.tier-3 .face-alpha {
  box-shadow:
    inset 0 0 0 2px    rgba(251, 191, 36, 0.95),
    inset 0 0 0 3.5px  rgba(0,   0,   0,   0.36),
    inset 0 0 0 4.5px  rgba(251, 191, 36, 0.72),
    inset 0 0 0 6px    rgba(0,   0,   0,   0.22),
    inset 0 0 0 7px    rgba(251, 191, 36, 0.42),
    inset 0 0 30px      rgba(251, 191, 36, 0.18);
}
.face-alpha .ticker {
  /* Ticker always wears gold — it's the brand element shared across all
     cards and reads as the "rating identity" of the deck. */
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 900;
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.3);
}
.face-alpha .company-name { color: rgba(241, 245, 249, 0.82); }
/* Sector chip — coloured by sector. Exchange + Cap remain neutral so the
   eye lands on sector first. */
.face-alpha .chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #cbd5e1;
}
.face-alpha .chip.sector {
  background: rgba(var(--sec-rgb), 0.18);
  border: 1px solid rgba(var(--sec-rgb), 0.45);
  color: var(--sec-strong);
}

/* === Sector chip tappable styling ===
   Any element flagged data-sector-link is a navigation chip into the sectors
   page. We give a subtle hover lift + pointer cursor so it reads as actionable
   without screaming. Applies wherever a sector chip is rendered (card front,
   back, search result row, discovery thumbnail, compare mini-card). */
[data-sector-link] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}
[data-sector-link]:hover {
  filter: brightness(1.18);
}
[data-sector-link]:focus-visible {
  outline: 2px solid rgba(251, 191, 36, 0.6);
  outline-offset: 2px;
}
.face-alpha .chip.exchange {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.32);
  color: #fde68a;
}
.face-alpha .price { color: #f1f5f9; }
/* Score block — gold-keyed "this is a rating, this is the product" surface.
   Same read across all sectors so the rating identity stays consistent. The
   inner gradient sits on a darkened panel so the block reads cleanly against
   any sector BG (including the brighter financial / utilities tints). */
.face-alpha .score-block {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.22)),
    linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(251, 191, 36, 0.30);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.face-alpha .score-row-fundamental .edition-tag { color: #e5e7eb; font-weight: 800; }
.face-alpha .score-row-fundamental .score-value {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: initial;
  color: #e5e7eb;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(226, 232, 240, 0.18);
}
.face-alpha .score-row-fundamental .score-letter { color: #e5e7eb; }
.face-alpha .score-row-premium .edition-tag { color: #fde68a; }
.face-alpha .score-row-premium .score-premium-value { color: #fde68a; }
.face-alpha .score-row-custom .edition-tag { color: #fde68a; }
.face-alpha .score-row-custom .score-premium-value { color: #fde68a; }
.face-alpha .score-row-custom .picker-chevron { color: #fde68a; }
.face-alpha .score-pitch { color: #cbd5e1; }
.face-alpha .score-value {
  background: linear-gradient(135deg, #fde68a, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.face-alpha .score-letter { color: #e5e7eb; }
.face-alpha .stat-label { color: #cbd5e1; }
.face-alpha .stat-value { color: #f1f5f9; }
.face-alpha .bar-track { background: rgba(255, 255, 255, 0.06); }
.face-alpha .bar-zero {
  background: #cbd5e1;
  box-shadow: 0 0 0 1.5px #07061a;
}
.face-alpha .bar-fill.pos { background: linear-gradient(90deg, #10b981, #34d399); }
.face-alpha .bar-fill.neg { background: linear-gradient(270deg, #fca5a5, #ef4444); }
/* Summary tints with the sector accent — ties the bottom of the card back
   to the sector chip at the top. Text drops the cool-purple lavender for a
   neutral white so it reads cleanly against every hue. */
.face-alpha .summary {
  background: rgba(var(--sec-rgb), 0.10);
  border: 1px solid rgba(var(--sec-rgb), 0.28);
  color: #e6ebf3;
}
.face-alpha .disclaimer { color: #94a3b8; }
.face-alpha .back-ticker {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.face-alpha .back-dot { color: #475569; }
.face-alpha .back-sector-name { color: #cbd5e1; }
.face-alpha .back-score-label { color: #94a3b8; }
.face-alpha .back-score-value {
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.face-alpha .section-title { color: var(--sec-strong); }
.face-alpha .accent-line { background: linear-gradient(90deg, var(--sec-strong), transparent); }
.face-alpha .contrib-row {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.face-alpha .contrib-label { color: #f1f5f9; }
.face-alpha .contrib-detail { color: #94a3b8; }
.face-alpha .trajectory-label { color: #94a3b8; }
/* Locked block stays gold-keyed — it's selling the premium upgrade and
   that read needs to be unambiguous. The dashed border is the universal
   "premium teaser" signal. */
.face-alpha .locked-block {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(0, 0, 0, 0.35));
  border: 1px dashed rgba(251, 191, 36, 0.45);
}
.face-alpha .locked-head .lock-title { color: #fde68a; }
.face-alpha .locked-head .upgrade-pill {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1e1b4b;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.35);
}
.face-alpha .disagree-callout {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}
.face-alpha .sparkline {
  background: rgba(var(--sec-rgb), 0.07);
  border: 1px solid rgba(var(--sec-rgb), 0.18);
}
.face-alpha .disclaimer-back { color: #64748b; }
.face-alpha .method-link { color: var(--sec-strong); }
.face-alpha .locked-subsection-title { color: #fde68a; }
.face-alpha .ie-label { color: #fde68a; }
.face-alpha .ie-when { color: #cbd5e1; }

/* Holographic gleam — extra-subtle gold metallic sheen that crosses the
   front face every ~34s. Intensity scales with `--trim-glow` so a tier-3
   card actually shimmers, tier-0 is barely there. */
.face-alpha.front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255, 255, 255, calc(0.01 + var(--trim-glow) * 0.03)) 47%,
    rgba(251, 191, 36, calc(0.015 + var(--trim-glow) * 0.05)) 50%,
    rgba(255, 255, 255, calc(0.01 + var(--trim-glow) * 0.03)) 53%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 3;
  transform: translateX(-100%);
  animation: alpha-gleam 34s ease-in-out infinite;
}
@keyframes alpha-gleam {
  0%, 30% { transform: translateX(-100%); }
  70% { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
/* Background-clip needed so the inset gold glow (box-shadow on `.face-alpha`)
   doesn't bleed past the rounded corners. */
.card-alpha .face { background-clip: padding-box; }

/* ============================================================================
 * Bottom-sheet host — used by StockCard.open() to pop the card from anywhere.
 * Matches the felt theme used by other sheets across the app.
 * ========================================================================== */
.sc-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sc-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sc-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 810;
  max-height: 92vh;
  background: linear-gradient(180deg, #344864 0%, #233347 100%);
  border-radius: 18px 18px 0 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -12px 40px rgba(0,0,0,0.55);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sc-sheet.open { transform: translateY(0); }
.sc-sheet-grabber {
  width: 40px; height: 4px; border-radius: 999px;
  background: rgba(255,255,255,0.25);
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.sc-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 16px 8px;
  flex-shrink: 0;
}
.sc-sheet-title {
  font-size: 13px; font-weight: 800; color: #fafafa; letter-spacing: -0.2px;
  display: flex; align-items: baseline; gap: 6px;
}
.sc-sheet-title .sc-sheet-tk { color: #fbbf24; font-weight: 900; }
.sc-sheet-title .sc-sheet-tk-sep { color: #475569; }
.sc-sheet-title .sc-sheet-tk-name { color: #cbd5e1; font-weight: 600; font-size: 12px; }
.sc-sheet-close {
  width: 30px; height: 30px; border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: #cbd5e1; font-family: inherit; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.sc-sheet-close:hover { background: rgba(255,255,255,0.1); }
.sc-sheet-body {
  padding: 4px 12px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.sc-sheet-hint {
  font-size: 10px;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  padding-bottom: 8px;
  flex-shrink: 0;
}

/* === Add-to-watchlist action row ===
   Sits between the card body and the hint. Two buttons side-by-side:
   the deck picker (which deck to add to) and the primary Add button.
   Stays as a discrete row below the card so it doesn't crowd the card
   front (which already carries the Compare toggle in its footer). */
.sc-sheet-actions {
  position: relative;            /* anchor for the deck-list popover */
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 8px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0) 100%);
}
.sc-sheet-actions[hidden] { display: none; }

.sc-add-deck-picker {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 9px 12px;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sc-add-deck-picker:hover { background: rgba(255, 255, 255, 0.10); }
.sc-add-deck-picker-inner {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;                  /* allow long deck names to ellipsize */
}
.sc-add-deck-label {
  font-size: 9px;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  font-weight: 800;
  flex-shrink: 0;
}
.sc-add-deck-name {
  color: #fafafa;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-add-deck-caret { font-size: 10px; opacity: 0.6; flex-shrink: 0; }

.sc-add-deck-btn {
  flex-shrink: 0;
  background: #fbbf24;
  color: #1f242e;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.2px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.sc-add-deck-btn:hover { background: #fcd34d; }
.sc-add-deck-btn:disabled,
.sc-add-deck-btn.is-added {
  background: rgba(74, 222, 128, 0.18);
  color: #4ade80;
  cursor: default;
}

/* Inline deck-list popover — opens UPWARDS from the picker so the deck
   options sit above the action row (which itself is near the bottom of the
   sheet on mobile). Chosen over a nested sheet to avoid conflicting with
   the card sheet's swipe-down dismissal. */
.sc-add-deck-popover {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(100% + 4px);
  background: linear-gradient(180deg, #2a3a52 0%, #1e2a3d 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 5;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sc-add-deck-popover[hidden] { display: none; }
.sc-add-deck-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sc-add-deck-option:hover { background: rgba(255, 255, 255, 0.06); }
.sc-add-deck-option.is-active {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}
.sc-add-deck-option-meta {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sc-add-deck-option.is-active .sc-add-deck-option-meta { color: #fbbf24; opacity: 0.85; }

/* Tiny self-contained toast for the "Added to <deck>" confirmation. Lives
   directly on body (above the sheet) so it stays visible even if the user
   closes the sheet right after tapping Add. */
.sc-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(251, 191, 36, 0.30);
  color: #fbbf24;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.50);
  opacity: 0;
  pointer-events: none;
  z-index: 900;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
.sc-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Scale the card down on narrow viewports so it always fits the sheet.
   Card is 320×580; sheet content area is the viewport width minus 24px
   horizontal padding. Negative margin compensates for visual shrink so we
   don't leave ghost space below. */
.sc-card-mount {
  transform-origin: top center;
  transform: scale(min(1, calc((100vw - 28px) / 320)));
  margin-bottom: calc(-580px * (1 - min(1, calc((100vw - 28px) / 320))));
}

/* ============================================================================
 * ETF cards — silver palette + ETF-specific back sections
 *
 * The chassis (trim, ticker, sector wash) goes silver to signal "this is an
 * ETF / passive / pooled exposure" instead of the gold "active stock pick"
 * read. The Premium-locked accents (Full Score row, Custom Score row, locked
 * Premium block on the back) STAY gold — that's the upsell-hook convention
 * and we want it consistent across stocks and ETFs.
 *
 * Selectors use `.kind-etf` directly so they win against `.sector-<slug>`
 * (same specificity, later in cascade) — both `.card-stage.kind-etf` and
 * `.card.kind-etf` carry the marker class via cardHtml().
 * ========================================================================== */

/* Override the sector palette variables on ETF cards. Regardless of which
   sector class is also present (`.sector-tech` etc.), silver tokens win. */
.kind-etf {
  --sec-rgb: 185, 195, 210;   /* silvery slate accent */
  --sec-strong: #cbd5e1;      /* slate-300 */
  --bg-deep: #11151c;         /* very dark slate */
  --bg-mid:  #1a2030;         /* lighter slate */
}

/* Silver tier trim — same pattern as the gold tiers but with silver rgba.
   Each tier still steps up in intensity; ETFs with higher Composition Scores
   wear a richer silver border just like high-Full-Score stocks wear richer
   gold. */
.card.kind-etf.tier-0 .face-alpha {
  box-shadow:
    inset 0 0 0 1px rgba(203, 213, 225, 0.32);
}
.card.kind-etf.tier-1 .face-alpha {
  box-shadow:
    inset 0 0 0 1.5px rgba(203, 213, 225, 0.50),
    inset 0 0 16px    rgba(203, 213, 225, 0.06);
}
.card.kind-etf.tier-2 .face-alpha {
  box-shadow:
    inset 0 0 0 1.75px rgba(203, 213, 225, 0.65),
    inset 0 0 0 3.5px  rgba(0,   0,   0,   0.32),
    inset 0 0 0 4.5px  rgba(203, 213, 225, 0.40),
    inset 0 0 22px      rgba(203, 213, 225, 0.10);
}
.card.kind-etf.tier-3 .face-alpha {
  box-shadow:
    inset 0 0 0 2px    rgba(226, 232, 240, 0.80),
    inset 0 0 0 3.5px  rgba(0,   0,   0,   0.30),
    inset 0 0 0 4.5px  rgba(203, 213, 225, 0.60),
    inset 0 0 0 6.5px  rgba(0,   0,   0,   0.32),
    inset 0 0 0 7.5px  rgba(203, 213, 225, 0.40),
    inset 0 0 28px      rgba(203, 213, 225, 0.14);
}
/* Silver drop-shadow on the stage too — replaces the warm-amber glow stocks
   get at higher tiers. */
.card-stage.kind-etf.tier-1 {
  --trim-shadow: 0 10px 26px rgba(160, 170, 185, 0.25), 0 4px 12px rgba(0, 0, 0, 0.45);
}
.card-stage.kind-etf.tier-2 {
  --trim-shadow: 0 12px 32px rgba(180, 190, 205, 0.35), 0 5px 14px rgba(0, 0, 0, 0.40);
}
.card-stage.kind-etf.tier-3 {
  --trim-shadow: 0 16px 40px rgba(203, 213, 225, 0.48), 0 6px 18px rgba(0, 0, 0, 0.40);
}

/* Ticker + back-ticker go silver gradient on ETFs. */
.kind-etf .face-alpha .ticker {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #e2e8f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 30px rgba(203, 213, 225, 0.25);
}
.kind-etf .face-alpha .back-ticker {
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ETF back-of-card sections: holdings list, breakdown bars, perf-vs-benchmark
   rows. All inherit the existing section-block / section-title typography so
   they sit consistently with the rest of the back. */
.hold-list { display: flex; flex-direction: column; gap: 5px; }
.hold-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11px;
}
.hold-row.tappable { cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.hold-row.tappable:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(203, 213, 225, 0.25);
}
.hold-ticker {
  font-weight: 800;
  font-size: 11px;
  color: #cbd5e1;
  letter-spacing: 0.3px;
  min-width: 38px;
}
.hold-name { color: #e6ebf3; }
.hold-weight {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #cbd5e1;
  font-size: 11px;
}

.bd-list { display: flex; flex-direction: column; gap: 4px; }
.bd-row {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  padding: 2px 0;
}
.bd-label { color: #e6ebf3; }
.bd-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}
.bd-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(var(--sec-rgb), 0.65), var(--sec-strong));
  border-radius: 2px;
}
.bd-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #cbd5e1;
  font-size: 10.5px;
  min-width: 40px;
  text-align: right;
}

.perf-list { display: flex; flex-direction: column; gap: 5px; }
.perf-row {
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.perf-period {
  font-weight: 800;
  color: #cbd5e1;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-size: 10px;
}
.perf-etf {
  font-weight: 700;
  color: #f1f5f9;
  font-variant-numeric: tabular-nums;
}
.perf-bench-label {
  font-size: 9.5px;
  color: #94a3b8;
  font-style: italic;
}
.perf-bench {
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
}

/* Leveraged ETF warning chip — red pill at top-right of the card. The chip
   needs to remain visible at any card scale (deck-stack peek cards, sheet,
   compare mini-cards) so it sits ABSOLUTE-positioned at the card top-right
   inside the front face. The chip should always sit ON TOP of the ticker
   block, even when content shifts. */
.lev-chip {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  padding: 3px 8px 4px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid rgba(254, 226, 226, 0.4);
  box-shadow:
    0 2px 8px rgba(185, 28, 28, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}
/* Slight horizontal nudge on the price block when a leverage chip is present
   so the chip + the price + day-change don't collide vertically — the chip
   takes priority and the price-block sits a touch lower. */
.face.front:has(.lev-chip) .price-block { padding-top: 18px; }

/* === Share button (top-right of card, both faces) ============================
   Small ↗ icon. Free for all tiers. Stops propagation so a tap does NOT
   also flip the card. Sits above the leverage chip in z-order; when both
   are present on a leveraged ETF, the share button shifts left to clear it.
   On the back face there's no lev-chip and the back-header gets right-padding
   so the back-score-mini doesn't collide with the button. */
.share-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 7;
  width: 30px;
  height: 30px;
  border-radius: 16px;
  /* Translucent — the card art should read through the button so the
     corner doesn't feel like an applied chrome element. Heavy blur +
     subtle border keeps it legible without blocking the sector wash. */
  background: rgba(15, 23, 42, 0.25);
  border: 1px solid rgba(251, 191, 36, 0.30);
  color: #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.share-btn svg { width: 15px; height: 15px; display: block; opacity: 0.92; }
.share-btn:hover {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.7);
  transform: translateY(-1px);
}
.share-btn:active { transform: scale(0.95); }
/* When a leverage chip is also present on the front face, shift the share
   button left so both fit. The chip is ~80–110px wide; 95px clears it. */
.face.front:has(.lev-chip) .share-btn { right: auto; left: 12px; }
/* Make the back-header give room for the absolutely-positioned share button. */
.face.back .back-header { padding-right: 42px; }
