/* Glassmorphism + RGB theme.
 *
 * - Dark navy base, large blurred colour blobs bleed through frosted glass.
 * - Accent colours follow Taiwan market convention: 紅漲綠跌 (red = up,
 *   green = down). The semantic CSS vars (`--inc`/`--dec`) carry the
 *   role; the underlying RGB triplets are swapped to honour TW custom.
 * - Backdrop blur is the only effect that actually requires modern browser
 *   support; the rest degrades cleanly on older engines.
 */

:root {
  /* Base palette */
  --bg-base: #07091a;
  --fg: #e9ecff;
  --muted: rgba(233, 236, 255, 0.55);
  --border-soft: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);

  /* Glass surfaces */
  --glass-bg: rgba(20, 23, 50, 0.42);
  --glass-bg-strong: rgba(28, 32, 65, 0.55);
  --glass-highlight: rgba(255, 255, 255, 0.07);

  /* Accent RGB — used for the four change types.
   *
   * Taiwan market convention: 紅漲綠跌 (red = up, green = down) — opposite
   * of the West. Variable names map to ROLE not literal colour: `--rgb-r`
   * is the "decrease" hue (now green), `--rgb-g` is the "increase" hue
   * (now red). Swap is contained here; nothing else in the stylesheet
   * needs to know.
   */
  --rgb-r: 51, 255, 168;     /* DECREASE — neon green (TW: 跌) */
  --rgb-g: 255, 64, 129;     /* INCREASE — hot pink (TW: 漲) */
  --rgb-b: 92, 195, 255;     /* NEW */
  --rgb-v: 196, 121, 255;    /* REMOVED */

  --new: rgb(var(--rgb-b));
  --inc: rgb(var(--rgb-g));
  --dec: rgb(var(--rgb-r));
  --rem: rgb(var(--rgb-v));

  --warn-bg: rgba(255, 213, 79, 0.12);
  --warn-fg: #ffe082;
  --warn-border: rgba(255, 213, 79, 0.35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: var(--fg);
  background: var(--bg-base);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* The RGB blobs. Three large radial gradients fixed to the viewport so the
 * background stays alive while the page scrolls. `filter: blur` is overkill
 * here (radial-gradient is already soft) but it adds the dreamy halo. */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  background:
    radial-gradient(45% 55% at 12% 22%, rgba(var(--rgb-r), 0.38), transparent 60%),
    radial-gradient(50% 60% at 88% 18%, rgba(var(--rgb-g), 0.32), transparent 62%),
    radial-gradient(60% 70% at 50% 95%, rgba(var(--rgb-b), 0.42), transparent 65%),
    radial-gradient(40% 50% at 70% 55%, rgba(var(--rgb-v), 0.22), transparent 60%);
  filter: blur(60px) saturate(115%);
  animation: blob-drift 28s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes blob-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2%, -3%, 0) scale(1.04); }
  100% { transform: translate3d(-2%, 2%, 0) scale(0.97); }
}

/* ---- Header / nav ---- */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}
header .brand {
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05rem;
  background: linear-gradient(90deg,
    rgb(var(--rgb-r)) 0%,
    rgb(var(--rgb-g)) 50%,
    rgb(var(--rgb-b)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
header nav a {
  margin-left: 18px;
  color: var(--fg);
  text-decoration: none;
  opacity: 0.78;
  transition: opacity 0.15s ease, color 0.15s ease;
}
header nav a:hover {
  opacity: 1;
  color: rgb(var(--rgb-b));
}

main { max-width: 1200px; margin: 0 auto; padding: 32px 24px 64px; }
footer { padding: 32px 24px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ---- Sections (glass cards) ---- */

main > section {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 22px;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 12px 32px rgba(0, 0, 0, 0.35);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg,
    rgb(var(--rgb-r)) 0%,
    rgb(var(--rgb-g)) 55%,
    rgb(var(--rgb-b)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.muted { color: var(--muted); }

.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--warn-border);
}

code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.88em;
  border: 1px solid var(--border-soft);
  color: rgb(var(--rgb-g));
}

a { color: rgb(var(--rgb-b)); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: rgba(var(--rgb-b), 0.6); }

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0 8px;
  font-size: 14px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}
th, td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
}
th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: none;
  color: rgba(233, 236, 255, 0.85);
}
tr:last-child td { border-bottom: none; }
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: rgba(var(--rgb-b), 0.07);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* RGB-coloured class accents (NEW / INCREASE / DECREASE / REMOVED).
 * The slight text-shadow gives the neon feel without hurting legibility. */
.new, td.num.new, th.num.new, h3.new {
  color: var(--new);
  text-shadow: 0 0 10px rgba(var(--rgb-b), 0.45);
}
.inc, td.num.inc, th.num.inc, h3.inc {
  color: var(--inc);
  text-shadow: 0 0 10px rgba(var(--rgb-g), 0.45);
}
.dec, td.num.dec, th.num.dec, h3.dec {
  color: var(--dec);
  text-shadow: 0 0 10px rgba(var(--rgb-r), 0.45);
}
.rem, td.num.rem, th.num.rem, h3.rem {
  color: var(--rem);
  text-shadow: 0 0 10px rgba(var(--rgb-v), 0.45);
}

/* ---- ETF list grid ---- */

.etf-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px 18px;
  margin: 0;
}
.etf-list li {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.etf-list li:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--rgb-b), 0.45);
  background: rgba(var(--rgb-b), 0.06);
}
.etf-list a { font-weight: 600; }

/* ---- Date picker ---- */

.date-picker { margin-bottom: 18px; }
.date-picker label { color: var(--muted); }
.date-picker select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass-bg-strong);
  color: var(--fg);
  font: inherit;
  margin-left: 6px;
}
.date-picker select:focus {
  outline: 2px solid rgba(var(--rgb-b), 0.55);
  outline-offset: 1px;
}
.date-picker option {
  background: #14172e; /* native dropdowns inherit poorly; force readable bg */
  color: var(--fg);
}

/* ---- Headings inside cards ---- */

h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 1.2rem;
  letter-spacing: 0.4px;
}
h3 { margin: 22px 0 10px; font-size: 1rem; letter-spacing: 0.3px; }

/* Section dividers between cards already come from the gap between
 * glass surfaces, so we kill the old border-top on h2. */

/* ---- Capital flow ranking ---- */

.flow-rank tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* #1 leader gets a neon highlight matching its kind (inc / dec).
 * Box-shadow renders inside the row via inset; outer glow on the tr is
 * clipped by the table's overflow:hidden, so we use a strong inset. */
.flow-rank tr.rank-leader.in {
  background: linear-gradient(
    90deg,
    rgba(var(--rgb-g), 0.18),
    rgba(var(--rgb-g), 0.06) 60%,
    transparent
  );
  box-shadow:
    inset 4px 0 0 rgb(var(--rgb-g)),
    inset 0 0 24px rgba(var(--rgb-g), 0.25);
}
.flow-rank tr.rank-leader.in td:first-of-type + td strong {
  text-shadow: 0 0 14px rgba(var(--rgb-g), 0.55);
}

.flow-rank tr.rank-leader.out {
  background: linear-gradient(
    90deg,
    rgba(var(--rgb-r), 0.18),
    rgba(var(--rgb-r), 0.06) 60%,
    transparent
  );
  box-shadow:
    inset 4px 0 0 rgb(var(--rgb-r)),
    inset 0 0 24px rgba(var(--rgb-r), 0.25);
}
.flow-rank tr.rank-leader.out td:first-of-type + td strong {
  text-shadow: 0 0 14px rgba(var(--rgb-r), 0.55);
}

/* Crown / "1" badge in the leader's # cell — pure CSS, no extra markup. */
.flow-rank tr.rank-leader td:first-child {
  font-weight: 800;
  font-size: 1.05em;
  position: relative;
}
.flow-rank tr.rank-leader td:first-child::after {
  content: "👑";
  margin-left: 4px;
  filter: drop-shadow(0 0 6px rgba(255, 220, 100, 0.65));
}

/* Status pill */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
}
.status-pill.inc { color: var(--inc); }
.status-pill.dec { color: var(--dec); }
.status-pill.mixed {
  color: var(--rem);
  border-color: rgba(var(--rgb-v), 0.6);
}

/* ---- Chart cards (Chart.js wrapped in glass) ---- */

.chart-card .chart-wrap {
  position: relative;
  height: 320px;
  margin-top: 12px;
}
@media (max-width: 700px) {
  .chart-card .chart-wrap { height: 240px; }
}

/* ---- Stock detail: news list ---- */

.news-card h2 .muted { font-size: 0.7em; font-weight: 400; }

.news-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 10px;
}
.news-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.news-item:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--rgb-b), 0.5);
  background: rgba(var(--rgb-b), 0.05);
}
.news-item a {
  display: block;
  color: var(--fg);
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
}
.news-item a:hover {
  color: rgb(var(--rgb-b));
  text-decoration: underline;
  text-decoration-color: rgba(var(--rgb-b), 0.6);
}
.news-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.news-source { font-weight: 600; color: rgba(233, 236, 255, 0.75); }

/* ---- Stock detail: market metric cards ---- */

.market-card .market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.metric {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px;
}
.metric-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric-value {
  font-size: 1.4rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- ETF detail: NAV / 市價 / 溢價 + 警示 ---- */
.premium-bar {
  margin: 12px 0 8px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
}
.premium-bar.premium-warn {
  background: rgba(255, 196, 0, 0.08);
  border-color: rgba(255, 196, 0, 0.45);
}
.premium-bar.premium-danger {
  background: rgba(255, 80, 80, 0.10);
  border-color: rgba(255, 80, 80, 0.55);
}
.premium-bar.premium-discount {
  background: rgba(80, 200, 120, 0.08);
  border-color: rgba(80, 200, 120, 0.40);
}
.premium-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.premium-label {
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.premium-value {
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.premium-warn-msg {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 230, 200, 0.92);
}
.premium-bar.premium-danger .premium-warn-msg {
  color: rgba(255, 220, 220, 0.96);
  background: rgba(120, 0, 0, 0.30);
}
.premium-bar.premium-discount .premium-warn-msg {
  color: rgba(220, 255, 230, 0.92);
  background: rgba(0, 60, 30, 0.30);
}

/* Inline summary above the holders table */
.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  color: var(--muted);
}
.totals strong {
  color: var(--fg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* History table: tint the 動作 cell by action class */
.action-new      { color: var(--new); font-weight: 600; }
.action-increase { color: var(--inc); font-weight: 600; }
.action-decrease { color: var(--dec); font-weight: 600; }
.action-removed  { color: var(--rem); font-weight: 600; }

/* ---- Home: today-active ETF cards ---- */

.active-grid {
  display: grid;
  /* 200px min lets 5 cards fit per row inside the section's content width
   * (~1096px on desktop). Drops gracefully to 4/3/2/1 on narrower screens
   * via auto-fill. */
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.active-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.active-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--rgb-b), 0.55);
  background: rgba(var(--rgb-b), 0.06);
}
.active-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.active-ticker { font-size: 1.05rem; font-weight: 700; }
.active-total {
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.active-name {
  font-size: 0.95rem;
  margin-top: 2px;
  /* Allow long fund names to wrap; the card grows to fit. */
}
.active-issuer, .active-meta { font-size: 0.78rem; margin-top: 2px; }
.active-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.lag-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgb(var(--rgb-v));
  border: 1px solid rgba(var(--rgb-v), 0.55);
  background: rgba(var(--rgb-v), 0.08);
}
.lag-badge.ahead {
  color: rgb(var(--rgb-g));
  border-color: rgba(var(--rgb-g), 0.55);
  background: rgba(var(--rgb-g), 0.08);
}
.active-stats {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.active-stats .stat {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}
.active-stats .stat.new { color: var(--new); }
.active-stats .stat.inc { color: var(--inc); }
.active-stats .stat.dec { color: var(--dec); }
.active-stats .stat.rem { color: var(--rem); }

/* Top-rank highlight for the leader card on the home page inflow preview. */
.active-card.rank-leader-card {
  border-color: rgba(var(--rgb-g), 0.55);
  background:
    linear-gradient(135deg, rgba(var(--rgb-g), 0.14), transparent 70%),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 18px rgba(var(--rgb-g), 0.20);
}
.active-card.rank-leader-card .active-ticker {
  text-shadow: 0 0 10px rgba(var(--rgb-g), 0.55);
}
.active-total.inc { color: var(--inc); font-weight: 700; font-size: 0.85rem; }

/* ---- Home: tracked ETFs ranked by 1m perf ---- */

.perf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.perf-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 14px;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.perf-card:hover {
  transform: translateY(-2px);
  border-color: rgba(var(--rgb-b), 0.55);
  background: rgba(var(--rgb-b), 0.06);
}
.perf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.perf-ticker { font-size: 1.05rem; font-weight: 700; }
.perf-1m {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}
.perf-name { font-size: 0.95rem; margin-top: 2px; }
.perf-meta { font-size: 0.78rem; margin-top: 4px; }

.more-etfs {
  margin-top: 14px;
}
.more-etfs > summary {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.03);
  list-style: none;
  font-weight: 600;
  color: rgba(var(--rgb-b), 1);
  width: fit-content;
}
.more-etfs > summary::-webkit-details-marker { display: none; }
.more-etfs > summary:hover {
  background: rgba(var(--rgb-b), 0.10);
  border-color: rgba(var(--rgb-b), 0.5);
}
.more-etfs > summary::after {
  content: " ▾";
  font-size: 0.85em;
}
.more-etfs[open] > summary::after { content: " ▴"; }
.more-etfs[open] > summary { margin-bottom: 12px; }

/* ---- Signals page (consensus radar cards) ---- */

.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.signal-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.signal-card.buy {
  border-color: rgba(var(--rgb-g), 0.35);
  background:
    linear-gradient(135deg, rgba(var(--rgb-g), 0.10), transparent 70%),
    rgba(255, 255, 255, 0.04);
}
.signal-card.sell {
  border-color: rgba(var(--rgb-r), 0.35);
  background:
    linear-gradient(135deg, rgba(var(--rgb-r), 0.10), transparent 70%),
    rgba(255, 255, 255, 0.04);
}
.signal-card:hover {
  transform: translateY(-2px);
}
.signal-card.buy:hover  { border-color: rgb(var(--rgb-g)); }
.signal-card.sell:hover { border-color: rgb(var(--rgb-r)); }

.signal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.signal-stock { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.signal-code { font-size: 1.05rem; font-weight: 700; }

.signal-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.signal-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.2);
}
.signal-badge.buy  { color: var(--inc); }
.signal-badge.sell { color: var(--dec); }
.signal-badge.days { color: rgb(var(--rgb-v)); border-color: rgba(var(--rgb-v), 0.6); }

.signal-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.signal-shares {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.signal-shares.buy  { color: var(--inc); text-shadow: 0 0 10px rgba(var(--rgb-g), 0.45); }
.signal-shares.sell { color: var(--dec); text-shadow: 0 0 10px rgba(var(--rgb-r), 0.45); }

.signal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.signal-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-soft);
  color: var(--fg);
  text-decoration: none;
}
.signal-chip:hover {
  background: rgba(var(--rgb-b), 0.18);
  border-color: rgba(var(--rgb-b), 0.55);
  text-decoration: none;
}

/* ---- Compare page ---- */

.compare-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}
.compare-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.compare-picker select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass-bg-strong);
  color: var(--fg);
  font: inherit;
  min-width: 280px;
}
.compare-picker option {
  background: #14172e;
  color: var(--fg);
}
.compare-picker .vs {
  color: var(--muted);
  font-style: italic;
  letter-spacing: 1px;
}
.compare-picker button {
  padding: 8px 22px;
  border-radius: 8px;
  border: 1px solid rgba(var(--rgb-b), 0.55);
  background: rgba(var(--rgb-b), 0.18);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.compare-picker button:hover {
  background: rgba(var(--rgb-b), 0.32);
}
.compare-picker button:active { transform: translateY(1px); }

.summary-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.summary-half {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 14px 18px;
}
.summary-vs {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 2px;
  text-align: center;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 900px) {
  .compare-grid { grid-template-columns: 1fr; }
  .summary-pair { grid-template-columns: 1fr; }
}

/* ---- Clickable rows / list items (whole-card click target) ---- */
tr.clickable, li.clickable { cursor: pointer; }
tr.clickable:hover { background: rgba(var(--rgb-b), 0.10); }
li.clickable:hover {
  /* the existing .etf-list li:hover already shifts + tints, this is a no-op
   * placeholder to keep the rule local to clickability if .etf-list ever
   * gets a non-clickable variant. */
}

/* ---- Admin (/admin/etfs) ---- */

.admin-flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin: 10px 0;
  font-weight: 500;
  border: 1px solid;
}
.admin-flash.ok  { color: var(--inc); border-color: rgba(var(--rgb-g), 0.5); background: rgba(var(--rgb-g), 0.10); }
.admin-flash.err { color: var(--dec); border-color: rgba(var(--rgb-r), 0.5); background: rgba(var(--rgb-r), 0.10); }

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  margin-right: 6px;
}
.btn-primary {
  background: rgba(var(--rgb-b), 0.20);
  color: var(--fg);
  border-color: rgba(var(--rgb-b), 0.55);
}
.btn-primary:hover { background: rgba(var(--rgb-b), 0.32); }
.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.10); }

.btn-link {
  background: none;
  border: none;
  color: rgb(var(--rgb-b));
  cursor: pointer;
  font: inherit;
  padding: 2px 6px;
  margin: 0 2px;
  border-radius: 4px;
}
.btn-link:hover:not(:disabled) { background: rgba(var(--rgb-b), 0.10); }
.btn-link:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-link.danger { color: var(--dec); }
.btn-link.danger:hover { background: rgba(var(--rgb-r), 0.10); }

.admin-table { width: 100%; }
.admin-table .actions { white-space: nowrap; }
.admin-table tr.row-disabled { opacity: 0.45; }
.admin-table tr.row-disabled td:first-child { text-decoration: line-through; }

.toggle-btn {
  border: 1px solid currentColor;
  background: rgba(0,0,0,0.2);
  color: var(--inc);
  font-weight: 700;
  width: 32px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}
.toggle-btn.off { color: var(--dec); }

/* Form */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
}
.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 500;
}
.admin-form label.radio,
.admin-form label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
}
.admin-form input[type="text"],
.admin-form select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass-bg-strong);
  color: var(--fg);
  font: inherit;
}
.admin-form input[readonly] { opacity: 0.6; cursor: not-allowed; }
.admin-form select option { background: #14172e; color: var(--fg); }
.admin-form fieldset {
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 8px 14px;
}
.admin-form fieldset legend { padding: 0 8px; color: var(--muted); }
.admin-form .radios { display: flex; gap: 18px; }
.admin-form .hint { font-size: 0.78rem; }
.admin-form .form-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ---- etfinfo dashboard ---- */
.etfinfo-hero {
  margin: 18px 0 28px;
  padding: 18px 22px;
  background: var(--glass-bg, rgba(255,255,255,.04));
  border: 1px solid var(--border-soft, rgba(255,255,255,.08));
  border-radius: 14px;
}
.etfinfo-hero-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
}
.etfinfo-hero-head h1,
.etfinfo-hero-head h2 { margin: 0; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.hero-stat {
  padding: 10px 14px;
  background: var(--glass-bg-strong, rgba(0,0,0,.18));
  border-radius: 10px;
  text-align: center;
}
.hero-stat-num {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.1;
}
.hero-stat-num.inc { color: var(--inc, #ff6b6b); }
.hero-stat-num.dec { color: var(--dec, #4dabf7); }
.hero-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}
