:root {
  --navy: #0B1F4B;
  --navy-deep: #061233;
  --navy-card: #0c1c45;
  --navy-elev: #102556;
  --red: #E0263A;
  --red-hover: #c71f32;
  --blue: #3B82F6;
  --white: #ffffff;
  --text: #f4f7fb;
  --muted: #9aa8c2;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 80px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }
body {
  overflow-x: hidden;
  background: var(--navy-deep);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(800px 480px at 10% 100%, rgba(224, 38, 58, 0.06), transparent 50%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 48px;
  background: linear-gradient(180deg, rgba(6, 18, 51, 0.92), rgba(11, 31, 75, 0.78));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
.brand img {
  height: 42px;
  width: auto;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: 1;
  justify-content: flex-end;
}
.nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}
.nav a:hover { color: #fff; }
.nav a.is-active { color: #fff; font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn-primary {
  background: var(--red);
  color: var(--white);
}
.btn-primary:hover { background: var(--red-hover); }
.btn-outline {
  background: transparent;
  color: var(--white);
  border-color: var(--line-strong);
}
.btn-outline:hover { border-color: #fff; }
.header-cta { height: 42px; padding: 0 20px; }

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background: #fff;
  border-radius: 1px;
}

main {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 28px 0 8px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 48px;
  align-items: center;
  min-height: 430px;
  padding: 12px 0 36px;
}
.hero-copy h1 {
  font-size: clamp(42px, 5.2vw, 68px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.98;
  color: #fff;
}
.lede {
  margin-top: 22px;
  max-width: 420px;
  font-size: 17px;
  line-height: 1.55;
  color: var(--muted);
  font-weight: 400;
}
.hero-actions {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.hero-actions .btn { height: 48px; padding: 0 24px; min-width: 132px; }
.hero-actions .btn-primary { min-width: 128px; }

.chart-card {
  background: linear-gradient(180deg, rgba(16, 32, 74, 0.9), rgba(8, 20, 52, 0.92));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 22px 16px;
  min-height: 360px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.chart-label {
  font-size: 18px;
  font-weight: 600;
  color: #d5deee;
}
.chart-price {
  margin-top: 6px;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--blue);
  line-height: 1;
  min-height: 64px;
}
.chart-price.is-down { color: var(--red); }
.chart-price.is-muted { color: var(--muted); font-size: 28px; font-weight: 600; }
.chart-canvas {
  flex: 1;
  width: 100%;
  min-height: 220px;
  margin-top: 8px;
  position: relative;
}
/* Keep the chart card clean; source is credited in the live-status line. */
.chart-canvas a { display: none !important; }
.chart-fallback {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.tickers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 8px 0 10px;
}
.ticker {
  background: rgba(10, 24, 64, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 22px 16px;
  min-height: 108px;
}
.ticker-sym {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ticker-row {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.ticker-price {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
}
.ticker-chg {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
}
.ticker-chg.is-up { color: var(--blue); }
.ticker-chg.is-down { color: var(--red); }
.ticker-chg.is-flat { color: var(--muted); }

.live-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
  margin: 0 2px 18px;
}
.live-status.is-live { color: #7aa2e8; }
.live-status.is-error { color: #f0a0a8; }

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
}
.feature {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 12px;
  position: relative;
}
.feature + .feature::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 1px;
  background: var(--line);
}
.feature-icon {
  width: 44px;
  height: 44px;
  color: #fff;
  flex: 0 0 auto;
}
.feature-icon svg { width: 100%; height: 100%; }
.feature h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(6, 18, 51, 0.7);
  margin-top: 8px;
}
.footer-inner {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 36px 0 28px;
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 32px;
  align-items: end;
}
.footer-brand img { height: 32px; width: auto; margin-bottom: 10px; }
.footer-brand p, .footer-cta p, .footer-meta p, .footer-meta a {
  color: var(--muted);
  font-size: 14px;
}
.footer-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.footer-meta nav { display: flex; gap: 16px; margin-top: 8px; }
.footer-meta a:hover { color: #fff; }

@media (max-width: 1024px) {
  .site-header { padding: 0 24px; }
  main, .footer-inner { width: min(1240px, calc(100% - 40px)); }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-copy h1 { font-size: 48px; }
  .tickers { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  :root { --header-h: 68px; }
  .header-tools { display: none; }
  .menu-toggle { display: flex; }
  .site-header.is-open .header-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--navy-deep);
    padding: 16px 24px 24px;
    gap: 16px;
    border-bottom: 1px solid var(--line);
  }
  .site-header.is-open .nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .site-header.is-open .header-cta { display: inline-flex; }
  .hero { padding-top: 8px; }
  .hero-copy h1 { font-size: 38px; }
  .tickers { grid-template-columns: 1fr; }
  .ticker-price { font-size: 24px; }
  .features { grid-template-columns: 1fr; }
  .feature + .feature::before { display: none; }
  .feature { justify-content: flex-start; }
  .footer-inner { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}


/* ---------- Portfolio ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}
.portfolio-main {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 36px 0 48px;
}
.portfolio-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 22px;
}
.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7aa2e8;
  margin-bottom: 8px;
}
.portfolio-head h1 {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.05;
}
.portfolio-head .lede { margin-top: 12px; max-width: 560px; }
.portfolio-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover { color: #fff; }
.file-btn { cursor: pointer; }

.demo-banner {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: #d5deee;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 8px 0 20px;
}
.summary-card {
  background: rgba(10, 24, 64, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px 16px;
}
.summary-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.summary-value {
  margin-top: 10px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.1;
}
.summary-value.is-up, .summary-sub.is-up { color: var(--blue); }
.summary-value.is-down, .summary-sub.is-down { color: var(--red); }
.summary-sub { margin-top: 6px; font-size: 14px; font-weight: 700; }

.portfolio-charts {
  display: grid;
  grid-template-columns: 0.9fr 1.2fr;
  gap: 16px;
  margin-bottom: 24px;
}
.pf-chart-card {
  min-height: 320px;
  box-shadow: none;
}
.pf-chart-card .chart-canvas { min-height: 240px; max-width: 100%; overflow: hidden; }
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 12px;
  min-height: 240px;
}
.donut-wrap svg { width: 200px; height: 200px; flex: 0 0 auto; }
.donut-legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.donut-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #d5deee;
}
.swatch { width: 10px; height: 10px; border-radius: 50%; }
.leg-pct { color: var(--muted); font-weight: 600; }

.holdings-panel { margin-top: 8px; }
.holdings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.holdings-head h2 { font-size: 18px; font-weight: 700; color: #fff; }
.muted { color: var(--muted); font-size: 13px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 24, 64, 0.45);
}
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.holdings-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.holdings-table td {
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
  white-space: nowrap;
}
.holdings-table tr:last-child td { border-bottom: 0; }
.holdings-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.holdings-table .is-up { color: var(--blue); font-weight: 700; }
.holdings-table .is-down { color: var(--red); font-weight: 700; }
.asset-cell { display: flex; flex-direction: column; gap: 2px; min-width: 140px; }
.asset-sym { font-weight: 700; color: #fff; letter-spacing: 0.03em; }
.asset-name { font-size: 12px; color: var(--muted); }
.asset-name small { display: block; font-size: 11px; opacity: 0.85; margin-top: 2px; }
.actions-col { text-align: right; white-space: nowrap; }
.link-btn {
  background: none;
  border: 0;
  color: #7aa2e8;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
}
.link-btn:hover { color: #fff; }
.link-btn.danger { color: #f0a0a8; }
.link-btn.danger:hover { color: var(--red); }

.empty-state { padding: 12px 0 20px; }
.empty-card {
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  padding: 48px 32px;
  text-align: center;
  background: rgba(10, 24, 64, 0.35);
  max-width: 640px;
  margin: 12px auto 0;
}
.empty-card h2 { font-size: 24px; font-weight: 800; color: #fff; letter-spacing: -0.02em; }
.empty-card p { margin-top: 10px; color: var(--muted); }
.empty-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.empty-note { margin-top: 18px; font-size: 13px; }

.holding-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0a1638;
  color: var(--text);
  padding: 28px 28px 24px;
  width: min(560px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.holding-dialog::backdrop { background: rgba(3, 8, 24, 0.72); }
.holding-dialog h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field span { font-size: 13px; font-weight: 600; color: #d5deee; }
.field em { font-style: normal; font-weight: 500; color: var(--muted); }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"] {
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: #fff;
  padding: 0 12px;
  font: inherit;
}
.field input:focus { outline: 2px solid rgba(59,130,246,0.45); border-color: transparent; }
.field-row { display: flex; gap: 12px; }
.combo { position: relative; }
.combo-list {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: #0d1b42;
  border: 1px solid var(--line);
  border-radius: 10px;
  max-height: 260px;
  overflow: auto;
  list-style: none;
  padding: 6px;
  box-shadow: var(--shadow);
}
.combo-list li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.combo-list li:hover, .combo-list li[aria-selected="true"] { background: rgba(59,130,246,0.16); }
.opt-sym { font-weight: 700; color: #fff; }
.opt-name { color: #d5deee; }
.opt-px { color: var(--muted); font-variant-numeric: tabular-nums; }
.combo-empty { padding: 12px; color: var(--muted); cursor: default; }
.selected-coin { font-size: 12px; color: #7aa2e8; margin-top: -8px; margin-bottom: 10px; }
.form-error { color: #f0a0a8; font-size: 13px; margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

@media (max-width: 1024px) {
  .portfolio-main { width: min(1240px, calc(100% - 40px)); }
  .summary-cards, .portfolio-charts { grid-template-columns: 1fr 1fr; }
  .portfolio-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 720px) {
  .portfolio-main { width: min(1240px, calc(100% - 32px)); padding-top: 24px; }
  .summary-cards, .portfolio-charts, .field-row { grid-template-columns: 1fr; display: grid; }
  .donut-wrap { flex-direction: column; align-items: center; }
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .holdings-table thead { display: none; }
  .holdings-table, .holdings-table tbody { display: block; width: 100%; }
  .holdings-table tr {
    display: block;
    background: rgba(10, 24, 64, 0.55);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px 10px;
    margin-bottom: 12px;
  }
  .holdings-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: right;
    white-space: normal;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .holdings-table td:last-child { border-bottom: 0; }
  .holdings-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
  }
  .holdings-table td.asset-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding-bottom: 10px;
    margin-bottom: 4px;
  }
  .holdings-table td.asset-cell::before { display: none; }
  .holdings-table td.actions-col { justify-content: flex-end; padding-top: 10px; }
}


/* ---------- Theme tokens & light theme ---------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #061233;
  --bg-mid: #0B1F4B;
  --card: rgba(10, 24, 64, 0.55);
  --card-solid: #0c1c45;
  --text-strong: #ffffff;
  --heading: #ffffff;
  --header-bg: linear-gradient(180deg, rgba(6, 18, 51, 0.92), rgba(11, 31, 75, 0.78));
  --chart-card-bg: linear-gradient(180deg, rgba(16, 32, 74, 0.9), rgba(8, 20, 52, 0.92));
  --footer-bg: rgba(6, 18, 51, 0.7);
  --status-live: #7aa2e8;
  --status-error: #f0a0a8;
  --demo-bg: rgba(59, 130, 246, 0.1);
  --demo-border: rgba(59, 130, 246, 0.28);
  --demo-text: #d5deee;
  --dialog-bg: #0a1638;
  --input-bg: rgba(255, 255, 255, 0.04);
  --combo-bg: #0d1b42;
  --tabbar-bg: rgba(6, 18, 51, 0.96);
}

[data-theme="light"] {
  color-scheme: light;
  --navy: #0B1F4B;
  --navy-deep: #F7F9FC;
  --navy-card: #ffffff;
  --navy-elev: #ffffff;
  --text: #0B1F4B;
  --muted: #5b6b86;
  --line: rgba(11, 31, 75, 0.12);
  --line-strong: rgba(11, 31, 75, 0.22);
  --shadow: 0 18px 50px rgba(11, 31, 75, 0.08);
  --bg: #F7F9FC;
  --bg-mid: #ffffff;
  --card: #ffffff;
  --card-solid: #ffffff;
  --text-strong: #0B1F4B;
  --heading: #0B1F4B;
  --header-bg: rgba(247, 249, 252, 0.92);
  --chart-card-bg: #ffffff;
  --footer-bg: rgba(255, 255, 255, 0.9);
  --status-live: #1D4ED8;
  --status-error: #b42318;
  --demo-bg: rgba(59, 130, 246, 0.08);
  --demo-border: rgba(59, 130, 246, 0.28);
  --demo-text: #0B1F4B;
  --dialog-bg: #ffffff;
  --input-bg: #ffffff;
  --combo-bg: #ffffff;
  --tabbar-bg: rgba(247, 249, 252, 0.97);
}

body { background: var(--navy-deep); color: var(--text); }
.site-header { background: var(--header-bg); border-bottom-color: var(--line); }
.page-bg {
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(800px 480px at 10% 100%, rgba(224, 38, 58, 0.06), transparent 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--navy-deep) 100%);
}
[data-theme="light"] .page-bg {
  background:
    radial-gradient(900px 500px at 80% 0%, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(800px 480px at 10% 100%, rgba(224, 38, 58, 0.05), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #F7F9FC 100%);
}

.logo-light { display: none; }
[data-theme="light"] .logo-dark { display: none; }
[data-theme="light"] .logo-light { display: block; }

.hero-copy h1,
.feature h2,
.portfolio-head h1,
.holdings-head h2,
.empty-card h2,
.summary-value,
.ticker-price,
.asset-sym { color: var(--heading); }
.chart-label { color: var(--text); }
.ticker { background: var(--card); }
.summary-card { background: var(--card); }
.chart-card {
  background: var(--chart-card-bg);
  box-shadow: var(--shadow);
}
[data-theme="light"] .chart-card,
[data-theme="light"] .ticker,
[data-theme="light"] .summary-card,
[data-theme="light"] .empty-card,
[data-theme="light"] .table-wrap {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.btn-outline { color: var(--text); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--text); }
.nav a:hover, .nav a.is-active { color: var(--heading); }
.menu-toggle span { background: var(--heading); }
.feature-icon { color: var(--heading); }
.site-footer { background: var(--footer-bg); }
.footer-meta a:hover { color: var(--heading); }
.live-status.is-live { color: var(--status-live); }
.live-status.is-error { color: var(--status-error); }
.demo-banner { background: var(--demo-bg); border-color: var(--demo-border); color: var(--demo-text); }
.table-wrap { background: var(--card); }
.holdings-table td { border-bottom-color: var(--line); }
.holding-dialog { background: var(--dialog-bg); color: var(--text); }
.holding-dialog::backdrop { background: rgba(3, 8, 24, 0.72); }
[data-theme="light"] .holding-dialog::backdrop { background: rgba(11, 31, 75, 0.35); }
.field span { color: var(--text); }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--line);
}
.field select {
  height: 44px;
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
}
.combo-list { background: var(--combo-bg); }
.opt-sym { color: var(--heading); }
.opt-name, .donut-legend li { color: var(--text); }
.btn-ghost:hover, .link-btn:hover { color: var(--heading); }
.ticker-search input {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
  min-width: 260px;
  width: min(320px, 100%);
}

/* Theme toggle */
.theme-toggle {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Asset-class tabs */
.markets-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
}
.asset-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}
.asset-tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
}
.asset-tabs button.is-active,
.asset-tabs button[aria-selected="true"] {
  background: var(--blue);
  color: #fff;
}
.ticker-search { position: relative; }
.delayed-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.stock-search-results {
  min-width: 100%;
}
.tickers.is-wide { grid-template-columns: repeat(4, 1fr); }
.ticker-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ticker-name, .ticker-unit {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.delay-badge,
.type-pill {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.delay-badge {
  background: rgba(224, 38, 58, 0.12);
  color: var(--red);
  border: 1px solid rgba(224, 38, 58, 0.25);
}
.type-pill {
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
  border: 1px solid rgba(59, 130, 246, 0.25);
  margin-left: 8px;
}
.ticker-price.is-muted { color: var(--muted); font-size: 18px; font-weight: 600; }

.class-alloc { margin-top: 8px; }
.class-alloc-label { font-size: 13px; margin-bottom: 8px; }
.class-bar {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
}
.class-seg { display: block; height: 100%; }
.class-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text);
}
.class-legend li { display: inline-flex; align-items: center; gap: 6px; }

.field-hint { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.holding-type-tabs { margin-bottom: 16px; }

/* Offline + install */
.offline-banner {
  text-align: center;
  background: rgba(224, 38, 58, 0.16);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.install-copy { color: var(--muted); font-size: 14px; line-height: 1.55; margin-bottom: 18px; }

/* Mobile app tab bar — small screens or standalone only */
.app-tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px env(safe-area-inset-bottom, 0px);
  background: var(--tabbar-bg);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  align-items: stretch;
  justify-content: space-around;
}
.app-tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.app-tabbar a.is-active { color: var(--blue); }
.app-tabbar svg { width: 22px; height: 22px; }

@media (max-width: 720px) {
  .app-tabbar { display: flex; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .tickers.is-wide { grid-template-columns: 1fr 1fr; }
  .ticker-search input { min-width: 0; width: 100%; }
  .markets-toolbar { flex-direction: column; align-items: stretch; }
  .site-header.is-open .header-tools { background: var(--navy-deep); }
  .holdings-table tr { background: var(--card); }
}

@media (display-mode: standalone) {
  .app-tabbar { display: flex; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .site-header { padding-top: env(safe-area-inset-top, 0px); height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); }
}

@media (min-width: 721px) and (display-mode: browser) {
  /* Keep desktop browser chrome unchanged besides the in-nav toggle/tabs. */
}

.header-theme { display: none; }
@media (max-width: 720px) {
  .header-theme { display: inline-flex; margin-left: auto; }
  .ticker-search input { max-width: 100%; }
}


/* ---------- Monetization: pricing, affiliates, newsletter, disclaimer ---------- */
.pricing-main,
.affiliates-main,
.growth-main {
  width: min(1100px, calc(100% - 64px));
  margin: 0 auto;
  padding: 36px 0 48px;
}
.pricing-hero { margin-bottom: 32px; max-width: 680px; }
.pricing-hero h1,
.affiliates-main h2,
.pricing-faq h2,
.newsletter h2 {
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--heading);
  line-height: 1.05;
}
.affiliates-main h2,
.pricing-faq h2,
.newsletter h2 { font-size: 24px; margin-bottom: 16px; }
.pricing-hero .lede { max-width: 640px; }

.plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 48px;
}
.plan-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.plan-card.is-pro {
  border-color: rgba(224, 38, 58, 0.45);
  position: relative;
}
.plan-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
}
.plan-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-price {
  margin-top: 8px;
  font-size: clamp(40px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--heading);
  line-height: 1;
}
.plan-unit { font-size: 22px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.plan-cadence { margin-top: 10px; color: var(--muted); font-size: 15px; }
.plan-cadence strong { color: var(--heading); font-weight: 700; }
.plan-save {
  display: inline-block;
  margin-left: 6px;
  color: var(--blue);
  font-weight: 600;
  font-size: 13px;
}
.plan-edit-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.plan-edit-hint code,
.pricing-faq code,
.affiliates-main code {
  font-size: 0.92em;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  white-space: nowrap;
}
.plan-features {
  list-style: none;
  margin: 22px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.plan-features li {
  position: relative;
  padding-left: 22px;
  font-size: 15px;
  color: var(--text);
}
.plan-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}
.plan-cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.plan-cta { min-width: 140px; }

.pricing-faq { margin-bottom: 48px; }
.pricing-faq dl { display: grid; gap: 16px; }
.pricing-faq dt {
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 6px;
  font-size: 16px;
}
.pricing-faq dd { color: var(--muted); font-size: 15px; line-height: 1.55; max-width: 720px; }

.newsletter {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 32px 0;
  margin: 8px 0 0;
}
.page-pricing .newsletter,
.page-affiliates .newsletter {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  margin: 8px 0 28px;
  background: var(--card);
}
.newsletter-inner {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px 32px;
  align-items: center;
}
.page-pricing .newsletter-inner,
.page-affiliates .newsletter-inner { width: 100%; }
.newsletter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}
.newsletter-status, .config-soon {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.newsletter-status.is-ok { color: var(--blue); }
.newsletter-status.is-soon,
.config-soon.is-soon { color: var(--muted); }
.newsletter-status.is-error,
.config-soon.is-error { color: var(--status-error); }
.shop-soon-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(480px, calc(100% - 32px));
  background: var(--card-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 12px 16px;
}

.affiliate-disclosure {
  background: var(--demo-bg);
  border: 1px solid var(--demo-border);
  color: var(--demo-text);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 32px;
  font-size: 14px;
  line-height: 1.55;
}
.partner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
}
.partner-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.partner-card h3 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin-bottom: 8px;
}
.partner-card p { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.partner-note { font-size: 12px; color: var(--muted); margin-top: 10px; margin-bottom: 0 !important; }

.site-disclaimer {
  width: min(1240px, calc(100% - 64px));
  margin: 0 auto;
  padding: 0 0 28px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
}
.site-disclaimer.in-main {
  width: auto;
  padding: 8px 0 0;
}

@media (max-width: 1024px) {
  .pricing-main, .affiliates-main, .growth-main { width: min(1100px, calc(100% - 40px)); }
  .plan-grid, .partner-grid, .newsletter-inner { grid-template-columns: 1fr; }
  .newsletter-inner { width: min(1240px, calc(100% - 40px)); }
}
@media (max-width: 720px) {
  .pricing-main, .affiliates-main, .growth-main { width: min(1100px, calc(100% - 32px)); padding-top: 24px; }
  .newsletter-inner { width: min(1240px, calc(100% - 32px)); }
  .site-disclaimer { width: min(1240px, calc(100% - 32px)); }
  .plan-cta-row .btn { width: 100%; }
  .nav { gap: 18px; }
}

@media (max-width: 1100px) and (min-width: 721px) {
  .nav { gap: 16px; }
  .nav a { font-size: 14px; }
}


/* --- Growth: waitlist, briefing, alerts, tracker --- */
.waitlist-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: rgba(59, 130, 246, 0.12);
  border-bottom: 1px solid var(--line);
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.waitlist-banner a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}
.waitlist-banner a:hover { text-decoration: underline; }
.hero-offer {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.waitlist-card,
.briefing-summary-card,
.briefing-block,
.share-card-block {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.waitlist-card h2,
.briefing-summary-card h2,
.briefing-block h2,
.share-card-block h2,
.tracker-main h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}
.waitlist-form,
.share-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.waitlist-form input[type="email"],
.share-row input[type="text"],
.alert-form input,
.alert-form select {
  flex: 1 1 240px;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--heading);
  padding: 0 14px;
  font: inherit;
}
.share-row input[type="text"] { font-size: 13px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }
.muted code, .waitlist-card code { font-size: 0.92em; }
.waitlist-referred { margin-top: 10px; color: var(--blue); font-size: 14px; }

.session-note { color: var(--muted); font-size: 14px; margin-top: 8px; }
.briefing-copy {
  white-space: pre-wrap;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  margin: 0 0 16px;
}
.briefing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0 24px;
}
.briefing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.briefing-table th,
.briefing-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.briefing-table .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.briefing-table .is-up { color: var(--blue); }
.briefing-table .is-down { color: var(--red); }
.briefing-table .is-flat { color: var(--muted); }
.asset-sym { display: block; font-weight: 700; color: var(--heading); }
.asset-name { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.briefing-share-img {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin: 12px 0;
}

.alerts-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.alert-form { display: grid; gap: 10px; }
.alert-form label { font-size: 13px; font-weight: 600; color: var(--muted); }
.alert-when { display: flex; gap: 8px; flex-wrap: wrap; }
.alert-when select, .alert-when input { flex: 1 1 120px; }
.alerts-list { list-style: none; padding: 0; margin: 0; }
.alerts-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.alert-rule { margin: 0; font-weight: 650; color: var(--heading); }
.alert-meta { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.alert-pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: var(--blue);
  white-space: nowrap;
}
.alert-pill.is-hot {
  background: rgba(224, 38, 58, 0.14);
  color: var(--red);
}
.link-btn {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 0;
}
.link-btn.danger:hover { color: var(--red); }
.pro-gate { font-size: 14px; color: var(--muted); margin-top: 10px; }
.notify-box { margin-top: 16px; display: grid; gap: 8px; }
.alert-live { margin-top: 12px; color: var(--blue); font-weight: 600; }

.table-wrap { overflow-x: auto; }
.tracker-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tracker-table th, .tracker-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tracker-table th { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.status-pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(154, 168, 194, 0.16);
  color: var(--muted);
  white-space: nowrap;
}
tr[data-status="done"] .status-pill { background: rgba(59, 130, 246, 0.16); color: var(--blue); }
tr[data-status="in"] .status-pill { background: rgba(224, 38, 58, 0.12); color: var(--red); }
tr[data-status="code"] .status-pill,
tr[data-status="assets"] .status-pill { background: rgba(59, 130, 246, 0.1); color: var(--status-live); }
.shipped-list { margin: 0 0 28px; padding-left: 20px; color: var(--text); line-height: 1.7; }

@media (max-width: 800px) {
  .briefing-grid, .alerts-layout { grid-template-columns: 1fr; }
  .alerts-list li { grid-template-columns: 1fr auto; }
  .waitlist-form .btn, .share-row .btn { width: 100%; }
}


/* --- Growth 2: asset pages, calculators, widgets, referrals, tracker columns --- */
.nav { flex-wrap: wrap; row-gap: 6px; }
.asset-quote-card, .asset-chart-card {
  background: var(--card-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.asset-quote-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.asset-name-line { margin: 0; color: var(--muted); font-size: 14px; font-weight: 600; }
.asset-price { margin: 6px 0 0; font-size: clamp(36px, 5vw, 56px); font-weight: 800; letter-spacing: -0.04em; color: var(--heading); }
.asset-chg { margin: 4px 0 0; font-size: 20px; font-weight: 700; }
.asset-chg.is-up { color: var(--blue); }
.asset-chg.is-down { color: var(--red); }
.asset-chart { height: 320px; width: 100%; }
.asset-tools { margin: 8px 0 24px; }
.price-index-list { list-style: none; padding: 0; margin: 0; }
.price-index-list li { border-bottom: 1px solid var(--line); }
.price-index-list a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 0; text-decoration: none; color: inherit;
}
.price-index-list a:hover .asset-name { color: var(--blue); }
.calc-tabs {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  margin: 0 0 20px; font-weight: 650;
}
.calc-tabs a { color: var(--blue); text-decoration: none; }
.calc-tabs a:hover { text-decoration: underline; }
.calc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin: 16px 0;
}
.calc-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.calc-form input, .calc-form select {
  min-height: 44px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--input-bg);
  color: var(--heading); padding: 0 12px; font: inherit;
}
.calc-form button { grid-column: 1 / -1; justify-self: start; }
.calc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.calc-table th, .calc-table td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.calc-table th { color: var(--muted); font-weight: 600; width: 46%; }
.calc-table .is-up { color: var(--blue); font-weight: 700; }
.calc-table .is-down { color: var(--red); font-weight: 700; }
.referral-board {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin: 16px 0;
}
.referral-board article {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.referral-stat { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--heading); margin: 4px 0 8px; }
.referral-code-line { font-size: 16px; }
.widget-preview-wrap { display: flex; flex-wrap: wrap; gap: 16px; margin: 12px 0; }
.embed-snippet {
  width: 100%; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.45; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--input-bg); color: var(--heading);
  resize: vertical;
}
.tracker-table { font-size: 13px; }
.tracker-table th:first-child, .tracker-table td:first-child { width: 2.5em; }
tr[data-status="blocked"] .status-pill { background: rgba(224, 38, 58, 0.14); color: var(--red); }
tr[data-status="parked"] .status-pill { background: rgba(107, 122, 153, 0.2); color: var(--muted); }
tr[data-status="todo"] .status-pill { background: rgba(154, 168, 194, 0.16); color: var(--muted); }
.growth-plan-section { margin-top: 36px; }
@media (max-width: 800px) {
  .calc-form, .referral-board { grid-template-columns: 1fr; }
  .asset-chart { height: 240px; }
  .nav a { font-size: 14px; }
}
