:root, [data-theme="dark-1"] {
  --bg: #000000;
  --bg-elev: #0a0a0a;
  --card: #111111;
  --card-2: #171717;
  --text: #ffffff;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --line-strong: #3a3a3a;
  --ok: #22c55e;
  --bad: #ef4444;
  --ok-bg: #14532d;
  --bad-bg: #7f1d1d;
  --input: #0d0d0d;
  --shadow: none;
  color-scheme: dark;
}

[data-theme="dark-2"] {
  --bg: #0d0d0d;
  --bg-elev: #141414;
  --card: #1a1a1a;
  --card-2: #222222;
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --line: #2e2e2e;
  --line-strong: #404040;
  --input: #121212;
}

[data-theme="dark-3"] {
  --bg: #101214;
  --bg-elev: #16181c;
  --card: #1c1f24;
  --card-2: #242830;
  --text: #f4f4f5;
  --muted: #9aa0a6;
  --line: #2c3138;
  --line-strong: #3d444d;
  --input: #14161a;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Nunito", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, .brand, .display, button, .pill, .badge, .price, .stat .value {
  font-family: "Fredoka", sans-serif;
}

a { color: inherit; }
.sky-decor { display: none; }

#app {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px 20px;
}

.page-dashboard { padding-bottom: 14px; }

.topbar, .card, .boot-card, .modal {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: none;
  color: var(--text);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 16px; padding: 10px 14px; margin-bottom: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-badge, .emoji-badge {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--card-2); border: 1px solid var(--line); font-size: 18px; color: var(--text);
}
.brand h1 { margin: 0; font-size: 1.15rem; line-height: 1.1; color: var(--text); }
.brand p { margin: 2px 0 0; color: var(--muted); font-weight: 700; font-size: 0.82rem; }

.nav-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.theme-switch { display: flex; gap: 6px; align-items: center; margin-right: 4px; }
.theme-dot {
  width: 16px; height: 16px; border-radius: 50%; padding: 0; border: 1px solid var(--line-strong);
  box-shadow: none; background: #000; min-width: 16px;
}
.theme-dot[data-theme-set="dark-1"] { background: #000; }
.theme-dot[data-theme-set="dark-2"] { background: #1a1a1a; }
.theme-dot[data-theme-set="dark-3"] { background: #1c1f24; }
.theme-dot.active { outline: 2px solid #fff; outline-offset: 2px; }

button, .btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--card-2);
  color: var(--text); font-weight: 700; border-radius: 12px; padding: 8px 12px;
  box-shadow: none; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.92rem; line-height: 1;
}
button:hover, .btn:hover { background: var(--line); }
button:active, .btn:active { transform: none; }
button.secondary, .btn.secondary,
button.grape, .btn.grape,
button.mint, .btn.mint,
button.coral, .btn.coral,
button.sky, .btn.sky { background: var(--card-2); color: var(--text); }
button:disabled { opacity: .55; cursor: not-allowed; }

.hero { margin: 0 0 10px; }
.hero h2 { font-size: 1.35rem; margin: 0 0 2px; color: var(--text); }
.hero p { margin: 0; font-size: 0.9rem; color: var(--muted); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat {
  border-radius: 14px; padding: 10px 12px; min-height: 0;
  background: var(--card);
}
.stat h3 { margin: 0 0 6px; font-size: 0.78rem; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.stat .value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.stat .sub { margin-top: 4px; font-weight: 700; color: var(--muted); font-size: 0.82rem; }
.stat.sun, .stat.mint, .stat.sky, .stat.grape { background: var(--card); }

.change-pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 9px; font-size: 0.78rem; font-weight: 800; line-height: 1.2;
  color: #fff; border: 0;
}
.change-pill.up { background: var(--ok); color: #fff; }
.change-pill.down { background: var(--bad); color: #fff; }
.change-pill.flat { background: var(--line-strong); color: var(--text); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 4px 0 8px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head p { margin: 2px 0 0; font-weight: 700; color: var(--muted); font-size: 0.82rem; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid .card { margin-bottom: 0; }

.stock-card {
  border-radius: 16px; padding: 14px 14px 12px; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
  background: var(--card); transition: border-color .15s ease;
}
.stock-card:hover { transform: none; border-color: var(--line-strong); }
.stock-card .row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.stock-card h3 { margin: 0; font-size: 1.05rem; color: var(--text); }
.stock-card .sym { font-weight: 700; color: var(--muted); font-size: 0.78rem; }
.price { font-family: "Fredoka", sans-serif; font-size: 1.45rem; font-weight: 700; margin: 0; color: var(--text); }
.spark-wrap { height: 46px; margin-top: auto; }
.spark-wrap svg, .spark { width: 100%; height: 46px; display: block; }

.prompt {
  margin-top: 0; background: transparent; border: 0;
  border-radius: 0; padding: 0; font-weight: 700; color: var(--muted); font-size: 0.78rem;
}
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.metric { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.metric span { display: block; font-size: .72rem; font-weight: 800; color: var(--muted); }
.metric strong { font-size: 0.92rem; color: var(--text); }

.tint-0, .tint-1, .tint-2, .tint-3 { background: var(--card); }

.card { border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.page-head h2 { margin: 6px 0 0; font-size: clamp(1.5rem, 3vw, 2.2rem); }
.muted { color: var(--muted); font-weight: 700; }

.compare { padding: 10px 14px 8px; margin-bottom: 12px; }
.compare-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.compare-head h3 { margin: 0; font-size: 0.92rem; }
.compare-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.compare-legend i { display: inline-block; width: 16px; height: 2px; background: #fff; margin-right: 6px; vertical-align: middle; }
.compare-legend i.l2 { opacity: .65; }
.compare-legend i.l3 { opacity: .4; }
.compare-chart { height: 108px; }
.compare-chart svg { width: 100%; height: 108px; display: block; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.pill {
  border: 1px solid var(--line-strong); background: var(--card-2); border-radius: 999px; padding: 7px 12px;
  box-shadow: none; cursor: pointer; font-weight: 700; color: var(--text);
}
.pill.active { background: #fff; color: #000; }

.chart-wrap { height: 280px; margin-top: 8px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }
.stat .placeholder { margin-top: 0; font-size: 0.8rem; }
.chart-empty, .placeholder, .banner {
  background: var(--card-2); border: 1px dashed var(--line-strong); border-radius: 12px;
  padding: 10px 12px; font-weight: 700; margin-top: 8px; color: var(--muted);
}
.banner.ok { background: var(--ok-bg); color: #fff; border-color: var(--ok); }
.banner.bad { background: var(--bad-bg); color: #fff; border-color: var(--bad); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: block; font-weight: 800; margin-bottom: 12px; }
label span { display: block; margin-bottom: 6px; }
input, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px;
  font: inherit; background: var(--input); color: var(--text);
}
.suggest { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; margin-top: 6px; background: var(--card-2); }
.suggest button {
  width: 100%; justify-content: flex-start; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; background: var(--card-2); padding: 10px 12px; color: var(--text);
}
.suggest button:last-child { border-bottom: 0; }
.suggest small { display: block; color: var(--muted); }

.lots { display: grid; gap: 10px; }
.lot {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.news-item {
  display: block; text-decoration: none; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.news-item:last-child { border-bottom: 0; }
.news-item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #000; color: #fff; border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px;
  text-align: center; font-weight: 700; letter-spacing: .04em;
}

.boot-card { max-width: 420px; margin: 18vh auto; text-align: center; border-radius: 20px; padding: 28px; }
.narrow { max-width: 560px; margin: 0 auto; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.holdings-mini { color: var(--muted); font-size: 0.78rem; font-weight: 700; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
  .form-grid, .codes, .lot { grid-template-columns: 1fr; }
  .compare-chart { height: 140px; }
}

.pin-card { margin-top: 18px; }
.pin-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.pin-bar label { margin: 0; min-width: 200px; flex: 1; }
.pin-bar button { height: 42px; }
#pin-msg { margin: 0; min-width: 160px; }
