
  /* ═══════════════════════════════════════════════════════════
     STOCK HERO
  ═══════════════════════════════════════════════════════════ */
  /* ═══════════ STOCK HERO — logo + name, one clean row ═══════════ */
  .stock-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 8px;
    min-width: 0;
  }
  .stock-hero-body { min-width: 0; flex: 1; }
  .stock-ticker {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.08em;
    margin-bottom: 4px;
  }
  .stock-name {
    font-family: var(--font-body);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    color: var(--text);
    line-height: 1.15;
  }
  .stock-meta {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .stock-score-big { text-align: right; margin: 20px 0; }
  .stock-score-big .val {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    line-height: 1;
    color: var(--accent);
  }

  /* ═══════════ CONFIDENCE PANEL — one card, full width, no duplicates ═══════════ */
  .conf-panel {
    margin: 22px 0 28px;
    padding: 22px 26px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    --conf-color: var(--accent);
  }
  [data-theme="light"] .conf-panel { box-shadow: var(--shadow-md); }
  .conf-strong   { --conf-color: var(--buy); }
  .conf-high     { --conf-color: var(--accent3); }
  .conf-moderate { --conf-color: var(--warn); }
  .conf-weak     { --conf-color: var(--sell); }
  .conf-bearish  { --conf-color: var(--sell); }

  .conf-panel-top { display: flex; align-items: baseline; gap: 22px; }
  /* The score used to be a donut gauge. A ring around a number doesn't say
     anything the number doesn't — so it's just the figure now. */
  .conf-figure { flex-shrink: 0; display: flex; align-items: baseline; gap: 2px; }
  .conf-figure .n {
    font-family: var(--font-display); font-size: clamp(2.6rem, 6vw, 3.6rem);
    font-weight: 600; color: var(--conf-color); line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .conf-figure .d { font-size: 1rem; color: var(--text-dim); font-weight: 500; }
  .conf-body { min-width: 0; flex: 1; }
  .conf-eyebrow {
    font-family: var(--font-body); font-weight: 600; font-size: 0.85rem; color: var(--text-dim);
    margin-bottom: 6px;
    display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline;
  }
  .conf-tier {
    font-family: var(--font-body); font-size: 1.35rem; font-weight: 600; color: var(--text);
    display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
    line-height: 1.15;
  }
  .conf-delta { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
  .conf-delta.up { color: var(--buy); }
  .conf-delta.down { color: var(--sell); }
  .conf-why { font-size: 0.92rem; color: var(--text-muted); margin-top: 10px; line-height: 1.5; text-wrap: balance; }
  /* The measured hit rate. Deliberately plain and deliberately not coloured by
     tier — it is the same kind of fact whether the number flatters the score
     or not, and styling it as good news when it reads 47% would undo the
     point of showing it. */
  .conf-measured {
    font-size: 0.86rem; color: var(--text-muted); margin-top: 12px;
    padding: 10px 12px; line-height: 1.55;
    border-left: 3px solid var(--border); background: var(--bg-subtle, rgba(127,127,127,.06));
    border-radius: 0 6px 6px 0;
  }
  .conf-measured strong { color: var(--text); font-weight: 650; }
  .conf-measured a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
  .conf-measured a:hover { color: var(--text); }
  .conf-measured--none { border-left-style: dashed; }

  /* Sparkline sits inline in the card too */
  .conf-spark {
    display: flex; align-items: center; gap: 12px;
    margin-top: 14px; padding-top: 14px;
    border-top: 1px dashed var(--border);
  }
  .conf-spark svg { flex: 1; height: 30px; display: block; min-width: 0; }
  .conf-spark .spark-line { fill: none; stroke: var(--conf-color); stroke-width: 1.6; stroke-linejoin: round; }
  .conf-spark .spark-fill { fill: color-mix(in srgb, var(--conf-color) 15%, transparent); }
  .conf-spark .spark-dot  { fill: var(--conf-color); }
  .conf-spark-lbl,
  .conf-spark-note { font-family: var(--font-body); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }


  /* ── Source deck: the counts behind the score, centred, one column per
     source that has something to say (1, 2 or 3). ── */
  .conf-deck {
    display: flex; justify-content: center; align-items: stretch;
    margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border);
  }
  .conf-deck-col {
    flex: 0 1 230px; min-width: 0; text-align: center; padding: 2px 22px;
  }
  .conf-deck-col + .conf-deck-col { border-left: 1px solid var(--border); }
  .conf-deck-n {
    font-family: var(--font-display); font-weight: 600; line-height: 1;
    font-size: clamp(2.3rem, 5vw, 3.1rem); color: var(--text);
    font-variant-numeric: tabular-nums;
  }
  .conf-deck-label {
    font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
    color: var(--text); margin-top: 8px; text-wrap: balance;
  }
  .conf-deck-detail {
    font-family: var(--font-body); font-size: 0.8rem; color: var(--text-dim);
    margin-top: 4px; line-height: 1.4; text-wrap: balance;
  }
  /* No fund holds it, so no score: the counts are the whole card. */
  .conf-panel--counts .conf-eyebrow { justify-content: center; margin-bottom: 0; }
  .conf-panel--counts .conf-deck { margin-top: 14px; padding-top: 0; border-top: 0; }
  @media (max-width: 600px) {
    .conf-deck-col { padding: 2px 10px; flex-basis: 0; flex-grow: 1; }
    .conf-deck-n { font-size: 2.1rem; }
    .conf-deck-label { font-size: 0.82rem; }
    .conf-deck-detail { font-size: 0.74rem; }
  }

  .conf-panel-foot {
    margin-top: 16px; padding-top: 14px;
    border-top: 1px dashed var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  }
  .conf-raw { font-family: var(--font-body); font-size: 0.8rem; color: var(--text-dim); }
  .conf-raw a { color: var(--accent); text-decoration: none; }
  .conf-raw a:hover { text-decoration: underline; }
  .conf-consensus-cta {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; color: var(--accent); text-decoration: none;
    padding: 7px 14px; border-radius: var(--radius);
    border: 1px solid var(--card-hover-border); background: var(--accent-glow);
    transition: box-shadow var(--t);
  }
  .conf-consensus-cta:hover { box-shadow: var(--shadow-glow); }

  @media (max-width: 720px) {
    .stock-hero { gap: 14px; }
    .conf-panel { padding: 18px 18px; margin: 16px 0 22px; }
    .conf-panel-top { flex-direction: column; align-items: flex-start; gap: 10px; }
    .conf-tier { font-size: 1.15rem; }
    .conf-panel-foot { flex-direction: column; align-items: flex-start; }
    .conf-consensus-cta { align-self: stretch; text-align: center; justify-content: center; }
  }

  .stock-score-big .label {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 4px;
    text-align: right;
  }

  /* ═══════════════════════════════════════════════════════════
     SUMMARY CHIPS
  ═══════════════════════════════════════════════════════════ */
  .summary-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 28px 0 36px;
  }

  .summary-chip {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px 22px;
    flex: 1 1 100px;
    min-width: 90px;
    max-width: 180px;
    text-align: center;
    transition: all var(--t);
  }

  .summary-chip:hover {
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
  }

  [data-theme="light"] .summary-chip {
    background: #ffffff;
    backdrop-filter: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }

  [data-theme="light"] .summary-chip:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--card-hover-border);
  }

  .summary-chip .chip-val {
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1;
  }

  .summary-chip .chip-val.buy  { color: var(--buy); }
  .summary-chip .chip-val.sell { color: var(--sell); }
  .summary-chip .chip-val.hold { color: var(--text-dim); }
  .summary-chip .chip-val.total { color: var(--text); }

  .summary-chip .chip-label {
    font-family: var(--font-body);
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 5px;
  }

  /* ═══════════════════════════════════════════════════════════
     INVESTOR CARDS
  ═══════════════════════════════════════════════════════════ */
  .inv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin-bottom: 36px;
  }

  .inv-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
  }

  [data-theme="light"] .inv-card {
    background: #ffffff;
    backdrop-filter: none;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }

  [data-theme="light"] .inv-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--card-hover-border);
  }

  /* The action already shows as a labelled badge inside the card; a coloured
     bar on all 17 of them just made the grid stripey. */
  .inv-card:hover {
    border-color: var(--card-hover-border);
    box-shadow: var(--shadow-md);
  }

  .inv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .inv-name {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.3;
  }

  .inv-weight {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 2px;
  }

  .inv-action-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
  }

  .inv-action-badge.buy  { background: rgba(52,211,153,0.1); color: var(--buy); border: 1px solid rgba(52,211,153,0.2); }
  .inv-action-badge.sell { background: rgba(248,113,113,0.1); color: var(--sell); border: 1px solid rgba(248,113,113,0.2); }
  .inv-action-badge.hold { background: var(--surface2); color: var(--text-dim); border: 1px solid var(--border); }

  .inv-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .inv-detail-item {
    display: flex;
    flex-direction: column;
  }

  .inv-detail-label {
    font-family: var(--font-body);
    font-size: 0.58rem;
    color: var(--text-dim);
    margin-bottom: 2px;
  }

  .inv-detail-val {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
  }

  /* ═══════════════════════════════════════════════════════════
     PORTFOLIO BAR CHART
  ═══════════════════════════════════════════════════════════ */
  .pct-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
  }

  .pct-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gradient-2);
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 6px rgba(34,211,238,0.25);
  }

  [data-theme="light"] .pct-bar-fill {
    box-shadow: none;
  }

  .pct-label {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
  }

  /* ═══════════════════════════════════════════════════════════
     SECTION HEADING
  ═══════════════════════════════════════════════════════════ */
  .stock-section {
    margin-bottom: 28px;
  }

  .stock-section-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--text);
    margin-bottom: 6px;
  }

  .stock-section-sub {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-dim);
    letter-spacing: 0.06em;
  }


  /* ═══════════════════════════════════════════════════════════
     BACK LINK
  ═══════════════════════════════════════════════════════════ */
  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    letter-spacing: 0.06em;
    margin-bottom: 24px;
    transition: color var(--t);
  }

  .back-link:hover { color: var(--accent); }

  /* ═══════════════════════════════════════════════════════════
     NOT FOUND
  ═══════════════════════════════════════════════════════════ */
  .stock-404 {
    text-align: center;
    padding: 80px 24px;
  }

  .stock-404 h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--text-muted);
    margin-bottom: 12px;
  }

  .stock-404 p {
    font-size: 0.82rem;
    color: var(--text-dim);
  }

  /* Range buttons */
  .stock-range-btn {
    padding: 6px 14px;
    border: 1px solid var(--border2);
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .stock-range-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  .stock-range-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0e17;
  }

  [data-theme="light"] .stock-range-btn.active { color: #ffffff; }
  .stock-range-btn.loading { opacity: 0.5; pointer-events: none; }
