/* Global theme palette. Dark by default; .light on <html> or <body> swaps.
 * Lifted from web/institutions/index.html and unified for all pages.
 * To toggle: localStorage.setItem('theme', 'light'|'dark'). The pre-render
 * script in each <head> applies the class before paint to avoid FOUC.
 */

:root {
  /* ── Core palette (TradingView-inspired) ── */
  --bg:           #131722;
  --bg-card:      #1e222d;
  --bg-chip:      #2a2e39;
  --bg-panel:     #0c0e15;
  --bg-elevated:  #232732;
  --border:       #2a2e39;
  --border-soft:  #1e222d;
  --border-hover: #363a45;
  --text:         #d1d4dc;
  --text-strong:  #e0e3eb;
  --text-soft:    #b2b5be;
  --muted:        #787b86;
  --muted-dim:    #434651;
  --accent:       #c8a84b;
  --accent-blue:  #2962ff;
  --accent-hover: #1e53e5;
  --up:           #26a69a;
  --down:         #ef5350;
  --bench:        #42a5f5;

  /* ── Badges ── */
  --badge-new-bg:  #134e3a; --badge-new-fg:  #26a69a;
  --badge-exit-bg: #4b1818; --badge-exit-fg: #ef5350;
  --badge-add-bg:  #133748; --badge-add-fg:  #42a5f5;
  --badge-trim-bg: #3a2d10; --badge-trim-fg: #fde68a;
  --tm-hold-fill: #1e2a3d; --tm-hold-stroke: #434651;
  --tm-new-fill:  #154935; --tm-new-stroke:  #26a69a;
  --tm-add-fill:  #13445a; --tm-add-stroke:  #42a5f5;
  --tm-trim-fill: #4a3a10; --tm-trim-stroke: #fde68a;
  --tm-label:     #e0e3eb;
  --tm-sublabel:  #787b86;
  --grid:         #1e222d;
  --shadow:       0 4px 20px rgba(0,0,0,0.5);

  /* ── Spacing scale ── */
  --space-xs: 4px;  --space-sm: 8px;  --space-md: 16px;
  --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;

  /* ── Radius ── */
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px;

  /* ── Transitions ── */
  --transition-fast: 0.1s ease;
  --transition-default: 0.2s ease;

  /* ── Typography ── */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'Cascadia Code', monospace;
}

/* Star icon (favorites toggle). Pages render <button class="star-icon"
 * data-star-type="stock|fund" data-star-id="..."> and stars.js wires
 * click + reflects the .is-starred state.
 */
.star-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--muted-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s, transform 0.08s;
  font-family: inherit;
}
.star-icon::before { content: "☆"; }
.star-icon:hover { color: var(--accent); }
.star-icon:active { transform: scale(0.92); }
.star-icon.is-starred { color: var(--accent); }
.star-icon.is-starred::before { content: "★"; }

html.light, body.light {
  --bg:           #f5f7fa;
  --bg-card:      #ffffff;
  --bg-chip:      #eef2f7;
  --bg-panel:     #f8fafc;
  --border:       #dde3ec;
  --border-soft:  #e8edf3;
  --text:         #1a2332;
  --text-strong:  #6b4e1a;
  --text-soft:    #334155;
  --muted:        #64748b;
  --muted-dim:    #94a3b8;
  --accent:       #8b6f1e;
  --up:           #15803d;
  --down:         #b91c1c;
  --bench:        #0e7490;
  --badge-new-bg:  #d1fae5; --badge-new-fg:  #065f46;
  --badge-exit-bg: #fee2e2; --badge-exit-fg: #991b1b;
  --badge-add-bg:  #cffafe; --badge-add-fg:  #155e75;
  --badge-trim-bg: #fef3c7; --badge-trim-fg: #78350f;
  --tm-hold-fill: #e2e8f0; --tm-hold-stroke: #94a3b8;
  --tm-new-fill:  #d1fae5; --tm-new-stroke:  #059669;
  --tm-add-fill:  #cffafe; --tm-add-stroke:  #0891b2;
  --tm-trim-fill: #fef3c7; --tm-trim-stroke: #d97706;
  --tm-label:     #1a2332;
  --tm-sublabel:  #475569;
  --grid:         #e2e8f0;
  --shadow:       0 4px 18px rgba(15,23,42,0.10);
}
