:root {
  color-scheme: light;
  --cf-font-sans: "IBM Plex Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cf-font-mono: "IBM Plex Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --cf-body-bg: #f5f6fa;
  --cf-surface: #ffffff;
  --cf-surface-alt: #f0f2f8;
  --cf-surface-soft: #f8f9fd;
  --cf-border: #d9deeb;
  --cf-border-strong: #c3c9d9;
  --cf-shadow-sm: 0 10px 28px rgba(15, 23, 42, 0.08);
  --cf-shadow-lg: 0 30px 60px rgba(15, 23, 42, 0.12);

  --cf-text: #101828;
  --cf-muted: #5b647a;
  --cf-subtle: #858fa6;
  --cf-link: #0f62fe;
  --cf-link-hover: #0040d9;

  --cf-primary: #0f62fe;
  --cf-primary-soft: rgba(15, 98, 254, 0.12);
  --cf-accent: #2ecdff;
  --cf-success: #0bbf62;
  --cf-danger: #ff4d67;
  --cf-warning: #f59f18;

  --cf-radius-lg: 22px;
  --cf-radius-md: 16px;
  --cf-radius-sm: 12px;

  --cf-gradient-hero: radial-gradient(120% 140% at 0% 0%, rgba(15, 98, 254, 0.18), transparent 60%),
    radial-gradient(90% 90% at 100% 0%, rgba(46, 205, 255, 0.16), transparent 55%),
    radial-gradient(130% 130% at 50% 120%, rgba(15, 23, 42, 0.12), transparent 70%);
  --cf-gradient-cta: linear-gradient(135deg, #0f62fe 0%, #5a66ff 52%, #0dcaf0 100%);

  --bs-body-font-family: var(--cf-font-sans);
  --bs-body-bg: var(--cf-body-bg);
  --bs-body-color: var(--cf-text);
  --bs-border-color: var(--cf-border);
  --bs-primary: var(--cf-primary);
  --bs-link-color: var(--cf-link);
  --bs-link-hover-color: var(--cf-link-hover);
  --bs-card-bg: var(--cf-surface);
  --bs-card-border-color: var(--cf-border);
  --bs-card-border-radius: var(--cf-radius-md);
  --bs-btn-border-radius: 14px;
  --bs-table-bg: transparent;
  --bs-table-color: var(--cf-text);
}

d[data-theme="dark"],
:root[data-theme="dark"] {
  color-scheme: dark;
  --cf-body-bg: #080d1c;
  --cf-surface: #101a33;
  --cf-surface-alt: #122043;
  --cf-surface-soft: #16274f;
  --cf-border: rgba(148, 163, 184, 0.18);
  --cf-border-strong: rgba(148, 163, 184, 0.28);
  --cf-shadow-sm: 0 22px 44px rgba(3, 7, 18, 0.54);
  --cf-shadow-lg: 0 32px 80px rgba(3, 7, 18, 0.6);

  --cf-text: #f8fafc;
  --cf-muted: #9ca9c4;
  --cf-subtle: #7683a2;
  --cf-link: #84b2ff;
  --cf-link-hover: #c7deff;

  --cf-primary: #6ea8ff;
  --cf-primary-soft: rgba(110, 168, 255, 0.2);
  --cf-accent: #49d6ff;
  --cf-success: #42dd9c;
  --cf-danger: #ff6a8a;
  --cf-warning: #ffc35e;

  --cf-gradient-hero: radial-gradient(120% 140% at 0% 0%, rgba(110, 168, 255, 0.24), transparent 60%),
    radial-gradient(90% 90% at 100% 0%, rgba(73, 214, 255, 0.22), transparent 55%),
    radial-gradient(130% 130% at 50% 120%, rgba(3, 7, 18, 0.45), transparent 70%);
  --cf-gradient-cta: linear-gradient(135deg, #6ea8ff 0%, #93c5ff 50%, #42dd9c 100%);

  --bs-link-color: var(--cf-link);
  --bs-link-hover-color: var(--cf-link-hover);
}

/* Force dark theme text utilities to switch to light text */
[data-theme="dark"] .text-dark,
[data-theme="dark"] .text-black,
[data-theme="dark"] .link-dark {
  color: var(--cf-text) !important;
}

/* Ensure badges that explicitly request dark text remain legible */
[data-theme="dark"] .badge.bg-light.text-dark,
[data-theme="dark"] .badge.text-dark {
  color: var(--cf-text) !important;
}

/* Tables: ensure body text is light in dark theme */
[data-theme="dark"] .table,
[data-theme="dark"] .table td,
[data-theme="dark"] .table th {
  color: var(--cf-text) !important;
}

html, body {
  min-height: 100%;
}

body {
  background: linear-gradient(180deg, var(--cf-body-bg) 0%, var(--cf-surface-soft) 70%, var(--cf-body-bg) 100%);
  color: var(--cf-text);
  font-family: var(--cf-font-sans);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cf-link);
  text-decoration: none;
}

a:hover {
  color: var(--cf-link-hover);
}

h1, h2, h3, h4, h5, h6 {
  color: var(--cf-text);
  font-weight: 600;
  letter-spacing: -0.015em;
}

.site-header {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--cf-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="dark"] .site-header {
  background: rgba(10, 19, 39, 0.78);
  box-shadow: 0 18px 46px rgba(2, 6, 23, 0.5);
}

.navbar {
  padding: 0.85rem 0;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--cf-text);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.1rem;
}

.navbar-brand i {
  font-size: 1.3rem;
  color: var(--cf-primary);
}

.navbar-light .navbar-toggler {
  border-color: transparent;
  color: var(--cf-muted);
  padding: 0.4rem 0.65rem;
}

.navbar-light .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.2);
}

.navbar-light .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(91, 100, 122, 0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-nav {
  gap: 0.3rem;
}

.navbar-nav .nav-link {
  font-weight: 500;
  color: var(--cf-subtle);
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition: color 0.2s ease, background 0.2s ease;
}

.navbar-nav .nav-link.active,
.navbar-nav .nav-link:hover {
  color: var(--cf-text);
  background: var(--cf-primary-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  border: 1px solid var(--cf-border);
  background: var(--cf-surface);
  color: var(--cf-text);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  position: relative;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: var(--cf-shadow-sm);
  border-color: var(--cf-primary-soft);
}

.theme-toggle__icon {
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle__icon[data-theme-icon="moon"] {
  position: absolute;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.58rem 1.4rem;
  border-radius: 999px;
  background: var(--cf-gradient-cta);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 18px 32px rgba(15, 98, 254, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-link:hover {
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 25px 40px rgba(15, 98, 254, 0.28);
}

.site-main {
  flex: 1 1 auto;
  padding-top: 2.4rem;
  padding-bottom: 3rem;
}

.site-container {
  max-width: 1240px;
}

.page-intro {
  margin-bottom: 2.5rem;
}

.hero-panel {
  position: relative;
  border-radius: var(--cf-radius-lg);
  overflow: hidden;
  background: var(--cf-gradient-hero);
  border: 1px solid rgba(15, 98, 254, 0.12);
  padding: 2.4rem;
  box-shadow: var(--cf-shadow-lg);
  color: var(--cf-text);
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

.hero-panel__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-panel__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.1rem;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.65);
  border-radius: var(--cf-radius-md);
  padding: 1rem 1.1rem;
  color: #0f172a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] .hero-stat {
  background: rgba(10, 20, 43, 0.78);
  color: #f8faff;
  box-shadow: 0 18px 38px rgba(3, 7, 18, 0.55);
}

.hero-stat__label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.hero-stat__value {
  margin-top: 0.4rem;
  font-weight: 600;
  font-size: 1.35rem;
}

.page-intro__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--cf-primary-soft);
  color: var(--cf-primary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-intro__title {
  font-size: clamp(2.4rem, 3vw, 2.9rem);
  font-weight: 700;
  margin-top: 0.9rem;
  margin-bottom: 0.8rem;
}

.page-intro__text {
  max-width: 660px;
  color: var(--cf-muted);
  font-size: 1.08rem;
}

/* New hero */
.hero {
  border-radius: var(--cf-radius-lg);
  background: radial-gradient(160% 120% at 0% 0%, rgba(34, 211, 238, 0.12), transparent 60%),
              radial-gradient(120% 100% at 100% 0%, rgba(37, 99, 235, 0.14), transparent 60%),
              var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-lg);
  padding: 2rem;
}
.hero__grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.4rem; align-items: center; }
.hero__content {}
.hero__eyebrow { display: inline-flex; align-items: center; gap: .45rem; background: var(--cf-primary-soft); color: var(--cf-primary); border-radius: 999px; padding: .3rem .7rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; font-size: .8rem; }
.hero__title { font-size: clamp(2.2rem, 3vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; margin: .6rem 0; }
.hero__lead { color: var(--cf-muted); font-size: 1.06rem; max-width: 580px; }
.hero__actions { display: flex; gap: .6rem; margin-top: 1rem; }
.hero__bullets { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .5rem 1rem; list-style: none; padding: 0; margin: 1rem 0 0; color: var(--cf-text); }
.hero__bullets li { display: flex; align-items: center; gap: .5rem; }

.hero__panel { border: 1px solid var(--cf-border); background: var(--cf-surface); border-radius: var(--cf-radius-md); padding: 1rem; box-shadow: var(--cf-shadow-sm); display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .8rem; align-content: start; }
.hero-metric {}
.hero-metric__label { color: var(--cf-subtle); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.hero-metric__value { font-weight: 800; font-size: 1.25rem; margin-top: .25rem; }
.hero-range { grid-column: 1 / -1; }

@media (max-width: 991.98px) {
  .hero__grid { grid-template-columns: 1fr; }
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
}

.metric-card {
  border-radius: var(--cf-radius-md);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  padding: 1.3rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 170px;
}

.metric-card__value {
  font-weight: 600;
  font-size: 1.6rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
}

.metric-card__change {
  font-weight: 600;
  font-size: 0.9rem;
}

.metric-card__change.is-up {
  color: var(--cf-success);
}

.metric-card__change.is-down {
  color: var(--cf-danger);
}

.ticker-strip {
  border-radius: var(--cf-radius-md);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  overflow: hidden;
}

.ticker-strip__inner {
  display: flex;
  gap: 1.5rem;
  padding: 0.85rem 1.2rem;
  animation: tickerMove 42s linear infinite;
  white-space: nowrap;
}

.ticker-strip:hover .ticker-strip__inner {
  animation-play-state: paused;
}

.ticker-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--cf-surface-soft);
  border: 1px solid var(--cf-border);
  color: var(--cf-text);
  transition: border 0.2s ease, transform 0.2s ease;
}

.ticker-strip__item:hover {
  border-color: var(--cf-primary);
  transform: translateY(-1px);
}

.ticker-strip__change.is-up {
  color: var(--cf-success);
  font-weight: 600;
}

.ticker-strip__change.is-down {
  color: var(--cf-danger);
  font-weight: 600;
}

@keyframes tickerMove {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* ------------------------------------
   Homepage Redesign Additions
-------------------------------------*/
/* Hero spotlight tweak */
.hero-spotlight {
  background: radial-gradient(120% 140% at 0% 0%, rgba(15, 98, 254, 0.18), transparent 60%),
              radial-gradient(80% 80% at 100% 0%, rgba(46, 205, 255, 0.18), transparent 55%),
              linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 60%),
              var(--cf-surface);
  border: 1px solid var(--cf-border);
}

/* Stat tiles */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}
.stat-tile {
  border-radius: var(--cf-radius-md);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  padding: 0.9rem 1rem;
}
.stat-tile__label { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cf-subtle); }
.stat-tile__value { margin-top: 0.35rem; font-weight: 700; font-size: 1.25rem; }

/* Ticker inline */
.ticker-inline { display: flex; gap: 0.6rem; overflow-x: auto; padding-bottom: 0.2rem; }
.ticker-inline__item { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.75rem; border-radius: 999px; border: 1px solid var(--cf-border); background: var(--cf-surface); white-space: nowrap; }
.ticker-inline__symbol { font-weight: 700; }
.ticker-inline__price { color: var(--cf-text); }
.ticker-inline__change.is-up { color: var(--cf-success); font-weight: 700; }
.ticker-inline__change.is-down { color: var(--cf-danger); font-weight: 700; }

/* Movers (Gainers/Losers) */
.mover-card { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; border: 1px solid var(--cf-border); background: var(--cf-surface); border-radius: var(--cf-radius-sm); padding: 0.6rem 0.8rem; color: var(--cf-text); margin-bottom: 0.5rem; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.mover-card:hover { transform: translateY(-1px); box-shadow: var(--cf-shadow-sm); border-color: var(--cf-primary); }
.mover-card__name { display: flex; flex-direction: column; line-height: 1.1; }
.mover-card__change { font-weight: 700; }

.card {
  border-radius: var(--cf-radius-md) !important;
  border-color: var(--cf-border) !important;
  background: var(--cf-surface) !important;
  box-shadow: var(--cf-shadow-sm);
}

.card-header,
.card-footer {
  border-color: var(--cf-border) !important;
  background: var(--cf-surface-alt) !important;
  font-weight: 600;
  color: var(--cf-subtle);
}

.table {
  border-color: var(--cf-border) !important;
  font-size: 0.95rem;
}

.table thead {
  background: var(--cf-surface-alt);
  color: var(--cf-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.82rem;
}

.table > :not(caption) > * > * {
  border-color: var(--cf-border) !important;
  padding: 0.9rem 1rem;
}

.table tbody tr:nth-child(even) {
  background: var(--cf-surface-soft);
}

.table tbody tr:hover {
  background: var(--cf-primary-soft);
}

/* Screener */
.screener-table thead tr th {
  position: sticky;
  top: 0;
  background: var(--cf-surface-alt);
  z-index: 1;
}

.th-sort {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
}

.th-sort .th-caret { opacity: 0.7; }
.th-sort.active { color: var(--cf-text); }
.th-sort:hover { color: var(--cf-link); }

.form-control,
.form-select {
  border-radius: 14px;
  border-color: var(--cf-border);
  background: var(--cf-surface);
  color: var(--cf-text);
  padding: 0.68rem 0.9rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cf-primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.18);
}

.btn-primary {
  background: var(--cf-primary);
  border-color: var(--cf-primary);
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  box-shadow: 0 12px 20px rgba(15, 98, 254, 0.22);
}

.btn-primary:hover {
  background: var(--cf-link-hover);
  border-color: var(--cf-link-hover);
}

.btn-outline-secondary,
.btn-outline-primary {
  border-radius: 999px;
  font-weight: 500;
}

.badge {
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
}

.badge.bg-light {
  background: var(--cf-primary-soft) !important;
  color: var(--cf-primary) !important;
}

.badge.bg-secondary {
  background: rgba(15, 23, 42, 0.08) !important;
  color: var(--cf-text) !important;
}

/* Filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--cf-border);
  background: var(--cf-surface-soft);
  color: var(--cf-text);
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-chip:hover {
  transform: translateY(-1px);
  border-color: var(--cf-primary);
  background: var(--cf-primary-soft);
  color: var(--cf-primary);
}

.search-panel {
  margin-bottom: 2.2rem;
}

.search-panel__inner {
  position: relative;
  border-radius: var(--cf-radius-lg);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  padding: 1.4rem 1.7rem;
}

.search-panel__group {
  border-radius: 999px;
  background: var(--cf-surface-soft);
  border: 1px solid var(--cf-border);
  overflow: hidden;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.search-panel__group:focus-within {
  border-color: var(--cf-primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.16);
}

.search-panel__icon {
  border: 0;
  background: transparent;
  color: var(--cf-muted);
}

.search-panel__input {
  border: 0 !important;
  background: transparent !important;
  color: var(--cf-text) !important;
  padding: 0.8rem 0.2rem;
  font-size: 1.05rem;
}

.search-panel__input::placeholder {
  color: var(--cf-muted);
}

.search-panel__results {
  position: absolute;
  left: 1.7rem;
  right: 1.7rem;
  top: calc(100% + 0.7rem);
  border-radius: var(--cf-radius-md);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-lg);
  overflow: hidden;
  z-index: 30;
}

.search-panel__list {
  max-height: 320px;
  overflow-y: auto;
}

.search-panel__item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--cf-text);
  transition: background 0.15s ease;
}

.search-panel__item + .search-panel__item {
  border-top: 1px solid var(--cf-border);
}

.search-panel__item:hover,
.search-panel__item.active {
  background: var(--cf-primary-soft);
}

.search-panel__icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.search-panel__initial {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cf-primary-soft);
  color: var(--cf-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.search-panel__symbol {
  min-width: 60px;
  font-weight: 600;
  color: var(--cf-subtle);
}

.search-panel__name {
  color: var(--cf-text);
}

.search-panel__name mark,
.search-panel__symbol mark {
  background: rgba(245, 159, 24, 0.35);
  border-radius: 4px;
  padding: 0 0.15rem;
}

.search-panel__footer {
  border-top: 1px solid var(--cf-border);
  padding: 0.6rem 1.1rem;
  background: var(--cf-surface-alt);
  text-align: right;
}

.icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cf-primary-soft);
  color: var(--cf-primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.pill-input {
  border-radius: 999px;
  padding: 0.6rem 1rem;
}

.ghost-btn {
  border-radius: 999px;
  border: 1px solid var(--cf-border);
  padding: 0.6rem 1.1rem;
  font-weight: 500;
  background: var(--cf-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: border 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ghost-btn:hover {
  border-color: var(--cf-primary);
  color: var(--cf-primary);
  background: var(--cf-primary-soft);
  transform: translateY(-1px);
}

/* Ghost-btn favorite active state */
.ghost-btn.is-fav-active {
  border-color: var(--cf-primary);
  color: var(--cf-primary);
  background: var(--cf-primary-soft);
}

.ghost-btn.is-fav-active .bi-heart {
  content: "";
}
.ghost-btn.is-fav-active .bi-heart::before {
  /* swap to filled heart via class toggle in JS; this block ensures visibility parity */
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--cf-primary-soft);
  color: var(--cf-primary);
  font-weight: 600;
  font-size: 0.83rem;
}

.alert-success {
  border-radius: var(--cf-radius-md);
  border-color: rgba(11, 191, 98, 0.18);
  background: rgba(11, 191, 98, 0.12);
  color: var(--cf-text);
  box-shadow: 0 12px 24px rgba(11, 191, 98, 0.15);
}

.alert-danger {
  border-radius: var(--cf-radius-md);
  border-color: rgba(255, 77, 103, 0.18);
  background: rgba(255, 77, 103, 0.12);
  color: var(--cf-text);
  box-shadow: 0 12px 24px rgba(255, 77, 103, 0.15);
}

/* Watchlist */
.watchlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.watch-card {
  border-radius: var(--cf-radius-md);
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  padding: 0.9rem 1rem;
  color: var(--cf-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.watch-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--cf-shadow-lg);
  border-color: var(--cf-primary);
}

.watch-card__title {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.watch-card__value {
  font-weight: 700;
  font-size: 1.1rem;
}

.watch-card__spark {
  height: 60px;
}

.site-footer {
  background: var(--cf-surface);
  border-top: 1px solid var(--cf-border);
  padding: 3.2rem 0;
  color: var(--cf-muted);
}

.site-footer__brand {
  color: var(--cf-text);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.site-footer__brand i {
  color: var(--cf-primary);
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-links a {
  color: var(--cf-muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--cf-text);
}

.footer-meta {
  border-top: 1px solid var(--cf-border);
  margin-top: 2.2rem;
  padding-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  font-size: 0.9rem;
}

.text-muted {
  color: var(--cf-muted) !important;
}

@media (max-width: 991.98px) {
  .header-actions {
    margin-top: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }
  .cta-link {
    justify-content: center;
    width: 100%;
  }
  .navbar-nav {
    margin-top: 1.2rem;
  }
  .search-panel__inner {
    padding: 1.2rem 1.3rem;
  }
  .search-panel__results {
    left: 1.3rem;
    right: 1.3rem;
  }
}

@media (max-width: 575.98px) {
  .site-main {
    padding-top: 1.8rem;
  }
  .page-intro__title {
    font-size: 2.3rem;
  }
  .metric-row {
    gap: 1rem;
  }
  .ticker-strip__inner {
    gap: 1.1rem;
  }
  .footer-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Year cards (3D) */
.year-card {
  border-radius: var(--cf-radius-md);
  background: linear-gradient(180deg, var(--cf-surface) 0%, var(--cf-surface-alt) 100%);
  border: 1px solid var(--cf-border);
  box-shadow: var(--cf-shadow-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: var(--cf-text);
  transition: transform 300ms cubic-bezier(.2,.8,.2,1), box-shadow 300ms ease, border-color 200ms ease, background 300ms ease;
  transform-style: preserve-3d;
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}

.year-card-3d::before {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  height: 160%;
  width: 160%;
  background: radial-gradient(60% 60% at 20% 20%, rgba(255, 255, 255, 0.16), transparent 60%);
  pointer-events: none;
  transform: rotate(18deg) translateZ(0);
}

.year-card-3d::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 40%);
  pointer-events: none;
}

.year-card:hover {
  transform: translateY(-6px) rotateX(4deg) rotateY(0.6deg);
  box-shadow: var(--cf-shadow-lg);
}

.year-card.is-active {
  border-color: var(--cf-primary);
  box-shadow: 0 18px 42px rgba(15, 98, 254, 0.25);
}

.year-card__year {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.year-card__avg {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
}

.year-card__label {
  color: var(--cf-subtle);
  font-size: 0.85rem;
  font-weight: 600;
}

.year-card__value {
  font-weight: 700;
  font-size: 1.05rem;
}

[data-theme="dark"] .year-card {
  background: linear-gradient(180deg, var(--cf-surface) 0%, rgba(255,255,255,0.02) 100%);
}

[data-theme="dark"] .year-card.is-active {
  box-shadow: 0 24px 60px rgba(110, 168, 255, 0.28);
}

/* Heatmap */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
}

.heatmap-grid--sm {
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.heatmap-grid--lg {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.heatmap-cell {
  border-radius: var(--cf-radius-sm);
  border: 1px solid var(--cf-border);
  background: var(--cf-surface);
  box-shadow: var(--cf-shadow-sm);
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 76px;
  color: var(--cf-text);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.heatmap-grid--sm .heatmap-cell { min-height: 62px; padding: 0.45rem 0.55rem; }
.heatmap-grid--lg .heatmap-cell { min-height: 96px; padding: 0.8rem 0.9rem; }

.heatmap-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--cf-shadow-lg);
  border-color: var(--cf-primary);
}

.heatmap-symbol {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.heatmap-change {
  font-weight: 600;
  font-size: 0.92rem;
}

.heatmap-grid--sm .heatmap-change { font-size: 0.85rem; }
.heatmap-grid--lg .heatmap-change { font-size: 1rem; }

/* Positive scale */
.heat-up-1 { background: rgba(16, 185, 129, 0.12); border-color: rgba(16,185,129,0.25); }
.heat-up-2 { background: rgba(16, 185, 129, 0.18); border-color: rgba(16,185,129,0.32); }
.heat-up-3 { background: rgba(16, 185, 129, 0.26); border-color: rgba(16,185,129,0.4); }
.heat-up-4 { background: rgba(16, 185, 129, 0.34); border-color: rgba(16,185,129,0.48); color: #0b1e15; }
.heat-up-5 { background: rgba(16, 185, 129, 0.44); border-color: rgba(16,185,129,0.6); color: #091911; }

/* Negative scale */
.heat-down-1 { background: rgba(239, 68, 68, 0.12); border-color: rgba(239,68,68,0.25); }
.heat-down-2 { background: rgba(239, 68, 68, 0.18); border-color: rgba(239,68,68,0.32); }
.heat-down-3 { background: rgba(239, 68, 68, 0.26); border-color: rgba(239,68,68,0.4); }
.heat-down-4 { background: rgba(239, 68, 68, 0.34); border-color: rgba(239,68,68,0.48); color: #220b0b; }
.heat-down-5 { background: rgba(239, 68, 68, 0.44); border-color: rgba(239,68,68,0.6); color: #1a0909; }

.heat-flat { background: var(--cf-surface-alt); }

/* Extended bins for 7-step scale */
.heat-up-6 { background: rgba(16, 185, 129, 0.54); border-color: rgba(16,185,129,0.7); color: #07140e; }
.heat-up-7 { background: rgba(16, 185, 129, 0.64); border-color: rgba(16,185,129,0.8); color: #06110c; }
.heat-down-6 { background: rgba(239, 68, 68, 0.54); border-color: rgba(239,68,68,0.7); color: #160707; }
.heat-down-7 { background: rgba(239, 68, 68, 0.64); border-color: rgba(239,68,68,0.8); color: #120606; }

[data-theme="dark"] .heat-up-4,
[data-theme="dark"] .heat-up-5,
[data-theme="dark"] .heat-down-4,
[data-theme="dark"] .heat-down-5 {
  color: #e6f9f0;
}

/* Heatmap legend */
.heatmap-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; }
.heatmap-legend .legend-box { display: inline-block; width: 16px; height: 12px; border-radius: 2px; border: 1px solid var(--cf-border); }
.heatmap-legend .legend-label { margin-left: 0.25rem; margin-right: 0.25rem; }

/* Scroll polish for inline ticker */
.ticker-inline { -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.ticker-inline::-webkit-scrollbar { height: 6px; }
.ticker-inline::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 999px; }
