/* =====================================================================
   GridLens — 3 主题 CSS（dark 默认 / minimal 极简白 / tech 霓虹）
   - 所有可视颜色已抽到 CSS 变量；dark 主题保持原像素不变
   - 主题切换：<html data-theme="dark|minimal|tech">，由 Landing/App 写
   ===================================================================== */

:root {
  /* --- Surface ----------------------------------------------------- */
  --bg:            #0b0e14;
  --fg:            #e6e6e6;
  --fg-strong:     #e8edf5;
  --card:          #151a23;
  --card-2:        #0e131c;            /* input / alert row bg */
  --surface:       #0f1318;            /* modal */
  --overlay:       rgba(0, 0, 0, 0.55);

  /* --- Border ----------------------------------------------------- */
  --border:        #1e2530;
  --border-2:      #2a323f;            /* input border (lighter) */
  --border-3:      #141a24;            /* subtle separator */
  --border-4:      #1a2230;            /* quick-stat border */
  --border-5:      #131a23;            /* btn-mini bg variant */

  /* --- Text -------------------------------------------------------- */
  --muted:         #aab2c0;
  --muted-2:       #8a93a3;
  --muted-3:       #6b7383;
  --code:          #7ee0a6;
  --report-text:   #cfd6e2;
  --neutral-pill:  #cfd6e2;            /* neutral pill text on dark */
  --neutral-pill-bg: rgba(255, 255, 255, 0.06);

  /* --- Accent ------------------------------------------------------ */
  --accent:        #4f8cff;
  --accent-on:     #ffffff;
  --accent-rgb:    79, 140, 255;

  /* --- Status ------------------------------------------------------ */
  --positive:      #2ecc71;
  --positive-rgb:  46, 204, 113;
  --positive-on:   #06210f;            /* dark text on positive bg (button) */
  --negative:      #ff5c5c;
  --negative-rgb:  255, 92, 92;
  --negative-text: #ff8b8b;            /* red on dark bg, light enough */
  --warn:          #f5a524;
  --warn-rgb:      245, 165, 36;
  --warn-text:     #ffd479;

  /* --- Special surfaces ------------------------------------------- */
  --nav-bg:        rgba(11, 14, 20, 0.85);
  --bar-bg:        #1a2230;
  --shot-bar-a:    #1f2a3a;
  --shot-bar-b:    #243349;
  --shot-cell-bg:  #141b26;
  --list-item-bg:  #141b26;
  --code-block-bg: rgba(10, 14, 20, 0.55);

  /* --- Shadows ----------------------------------------------------- */
  --shadow-modal:  0 20px 50px rgba(0, 0, 0, 0.45);
  --shadow-toast:  0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 8px 22px rgba(79, 140, 255, 0.25);
  --shadow-feature-hover: 0 0 0 1px rgba(79, 140, 255, 0.45);
}

/* ============== Minimal — 白底极简 ============== */
:root[data-theme="minimal"] {
  --bg:            #ffffff;
  --fg:            #1a1a1a;
  --fg-strong:     #111827;
  --card:          #f9fafb;
  --card-2:        #f3f4f6;
  --surface:       #ffffff;
  --overlay:       rgba(0, 0, 0, 0.32);

  --border:        #e5e7eb;
  --border-2:      #d1d5db;
  --border-3:      #f1f5f9;
  --border-4:      #e5e7eb;
  --border-5:      #e5e7eb;

  --muted:         #4b5563;
  --muted-2:       #6b7280;
  --muted-3:       #9ca3af;
  --code:          #047857;
  --report-text:   #1f2937;
  --neutral-pill:  #1f2937;
  --neutral-pill-bg: rgba(17, 24, 39, 0.06);

  --accent:        #0284c7;            /* sky-600 */
  --accent-on:     #ffffff;
  --accent-rgb:    2, 132, 199;

  --positive:      #059669;
  --positive-rgb:  5, 150, 105;
  --positive-on:   #ffffff;
  --negative:      #dc2626;
  --negative-rgb:  220, 38, 38;
  --negative-text: #b91c1c;
  --warn:          #d97706;
  --warn-rgb:      217, 119, 6;
  --warn-text:     #b45309;

  --nav-bg:        rgba(255, 255, 255, 0.92);
  --bar-bg:        #e5e7eb;
  --shot-bar-a:    #e5e7eb;
  --shot-bar-b:    #d1d5db;
  --shot-cell-bg:  #f3f4f6;
  --list-item-bg:  #f9fafb;
  --code-block-bg: #f3f4f6;

  --shadow-modal:  0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-toast:  0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-accent: 0 8px 22px rgba(2, 132, 199, 0.18);
  --shadow-feature-hover: 0 0 0 1px rgba(2, 132, 199, 0.40);
}

/* ============== Tech — 霓虹赛博 ============== */
:root[data-theme="tech"] {
  --bg:            #0a0118;
  --fg:            #e0d6ff;
  --fg-strong:     #ffffff;
  --card:          #150228;
  --card-2:        #1d0535;
  --surface:       #150228;
  --overlay:       rgba(255, 0, 229, 0.18);

  --border:        rgba(0, 240, 255, 0.22);
  --border-2:      rgba(0, 240, 255, 0.42);
  --border-3:      rgba(255, 0, 229, 0.18);
  --border-4:      rgba(255, 0, 229, 0.22);
  --border-5:      rgba(0, 240, 255, 0.22);

  --muted:         #b9a8e3;
  --muted-2:       #8a7caf;
  --muted-3:       #5a4a7a;
  --code:          #00ffa3;
  --report-text:   #d0c8ff;
  --neutral-pill:  #d0c8ff;
  --neutral-pill-bg: rgba(0, 240, 255, 0.10);

  --accent:        #00f0ff;            /* neon cyan */
  --accent-on:     #0a0118;
  --accent-rgb:    0, 240, 255;
  --accent-2:      #ff00e5;            /* neon magenta (额外备用) */

  --positive:      #00ffa3;
  --positive-rgb:  0, 255, 163;
  --positive-on:   #0a0118;
  --negative:      #ff0066;
  --negative-rgb:  255, 0, 102;
  --negative-text: #ff79a8;
  --warn:          #ffaa00;
  --warn-rgb:      255, 170, 0;
  --warn-text:     #ffd479;

  --nav-bg:        rgba(10, 1, 24, 0.85);
  --bar-bg:        rgba(0, 240, 255, 0.10);
  --shot-bar-a:    rgba(0, 240, 255, 0.22);
  --shot-bar-b:    rgba(255, 0, 229, 0.22);
  --shot-cell-bg:  #1d0535;
  --list-item-bg:  #1d0535;
  --code-block-bg: rgba(10, 1, 24, 0.55);

  --shadow-modal:  0 0 0 1px rgba(0, 240, 255, 0.22), 0 20px 50px rgba(255, 0, 229, 0.18);
  --shadow-toast:  0 0 0 1px rgba(0, 240, 255, 0.32), 0 8px 24px rgba(255, 0, 229, 0.18);
  --shadow-accent: 0 0 22px rgba(0, 240, 255, 0.45);
  --shadow-feature-hover: 0 0 0 1px rgba(0, 240, 255, 0.55);
}

/* ===== Reset / base ===== */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}
.center {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.logo { font-weight: 700; font-size: 20px; color: var(--accent); }
.tag { color: var(--muted-2); font-size: 13px; }
.hero { max-width: 880px; margin: 48px auto; padding: 0 24px; text-align: center; }
.hero h1 { font-size: 36px; margin: 0 0 12px; }
.hero p { color: var(--muted); font-size: 16px; line-height: 1.6; }
.auth {
  margin: 32px auto 0;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
}
.auth input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--fg);
}
.auth button {
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 600;
  cursor: pointer;
}
.auth .link { background: none; color: var(--accent); }
.msg { font-size: 13px; color: var(--warn-text); }
.pricing { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 24px; }
.plan { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: 220px; }
.plan h4 { margin: 0 0 8px; }
.price { font-size: 24px; font-weight: 700; color: var(--accent); margin: 0 0 12px; }
.plan ul { padding-left: 18px; color: var(--muted); min-height: 120px; }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .tagline { color: var(--muted-2); font-size: 13px; margin: 0 0 12px; min-height: 32px; }
.plan .price span { font-size: 14px; color: var(--muted-2); font-weight: 400; }
.plan .subscribe { margin-top: 14px; width: 100%; padding: 10px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-on); font-weight: 600; cursor: pointer; }
.plan .subscribe:disabled { opacity: 0.6; cursor: default; }
.badge { background: rgba(var(--accent-rgb), 0.15); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.4); padding: 2px 8px; border-radius: 999px; font-size: 12px; text-transform: uppercase; }
.dashboard, .connect { min-height: 100vh; }
.right { display: flex; gap: 12px; align-items: center; }
button.link { background: none; color: var(--accent); border: 0; font-weight: 600; cursor: pointer; font-size: 14px; }
button.link.danger { color: var(--negative-text); }
button.link.danger:hover { color: var(--negative); }

/* Anchors with class="link" used in nav/footer — strip the default browser
 * blue + underline on every state (link/visited/hover/active/focus) so the
 * page never flashes blue when a nav item is clicked or right-clicked. The
 * accent-on-hover treatment comes from .right button.link:hover elsewhere. */
a.link,
a.link:link,
a.link:visited,
a.link:hover,
a.link:active,
a.link:focus {
  color: var(--fg);
  text-decoration: none;
  background: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 0;
  outline: none;
}
a.link:hover { color: var(--accent); }
.footer a.link { color: var(--muted-2); }
.footer a.link:hover { color: var(--fg-strong); }
.landing-nav a.link { color: var(--muted-2); }
.landing-nav a.link:hover { color: var(--fg-strong); }
/* Pricing CTA in dashboard nav */
.landing-nav .right > button.link:nth-child(2) {
  color: var(--accent);
  font-weight: 600;
}
.landing-nav .right > button.link:nth-child(2):hover {
  color: var(--fg-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.card .big { font-size: 28px; font-weight: 700; margin: 8px 0 4px; }
.card span { color: var(--muted-2); font-size: 13px; }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.hint { padding: 0 24px; color: var(--muted-2); }
button { cursor: pointer; }
.connect-form { max-width: 400px; }
.connect-form label { font-size: 13px; color: var(--muted); text-align: left; }
.connect-form select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
  color: var(--fg);
}
.alerts { display: flex; flex-direction: column; gap: 8px; padding: 0 24px; }
.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.alert.high { background: rgba(var(--negative-rgb), 0.15); color: var(--negative-text); border: 1px solid rgba(var(--negative-rgb), 0.4); }
.alert.warn { background: rgba(var(--warn-rgb), 0.12); color: var(--warn-text); border: 1px solid rgba(var(--warn-rgb), 0.35); }
.positions { padding: 0 24px 24px; }
.positions h3 { font-size: 16px; }
.positions table { width: 100%; border-collapse: collapse; }
.positions th, .positions td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
.positions th { color: var(--muted-2); font-weight: 600; }

/* ===== D9 landing marketing sections ===== */
.landing { min-height: 100vh; overflow-x: hidden; }
.landing-nav { position: sticky; top: 0; background: var(--nav-bg); backdrop-filter: saturate(140%) blur(10px); z-index: 10; border-bottom-color: var(--border-3); }
.nav-left { display: flex; align-items: center; gap: 10px; }
.badge.beta { background: rgba(var(--positive-rgb), 0.15); color: var(--positive); border-color: rgba(var(--positive-rgb), 0.4); }
.hero {
  max-width: 900px;
  margin: 64px auto 48px;
  padding: 56px 24px 48px;
  text-align: center;
  background:
    radial-gradient(1200px 400px at 50% 0%, rgba(var(--accent-rgb), 0.18), transparent 70%),
    radial-gradient(800px 300px at 50% 100%, rgba(var(--positive-rgb), 0.10), transparent 70%);
  border-radius: 24px;
}
.hero h1 { font-size: 44px; line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero p { color: var(--muted); font-size: 17px; line-height: 1.65; max-width: 640px; margin: 0 auto; }
.hero p { color: var(--muted); font-size: 17px; line-height: 1.65; max-width: 640px; margin: 0 auto; }
.hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 12px 22px; border-radius: 10px; font-weight: 600; text-decoration: none; cursor: pointer; border: 0; font-size: 14px; transition: transform .12s ease, opacity .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: var(--accent-on); box-shadow: var(--shadow-accent); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--border-2); }
.trust-strip { max-width: 1040px; margin: 24px auto 0; padding: 0 24px; color: var(--muted-3); font-size: 12px; text-align: center; letter-spacing: 0.06em; text-transform: uppercase; }
.section,
.features,
.how,
.preview,
.waitlist,
.faq,
.pricing { padding: 72px 24px; max-width: 1040px; margin: 0 auto; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; transition: border-color .15s; }
.feature:hover { border-color: rgba(var(--accent-rgb), 0.45); }
.feature-icon { display: inline-flex; width: 36px; height: 36px; border-radius: 10px; background: rgba(var(--accent-rgb), 0.12); color: var(--accent); align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.how h2,
.preview h2,
.waitlist h2,
.faq h2 { text-align: center; font-size: 28px; margin: 0 0 28px; letter-spacing: -0.01em; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.step-no { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-on); align-items: center; justify-content: center; font-weight: 700; margin-bottom: 12px; font-size: 14px; }
.step h4 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.preview h2 { text-align: center; font-size: 28px; margin: 0 0 8px; letter-spacing: -0.01em; }
.preview-sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.preview-foot { text-align: center; margin-top: 14px; font-size: 12px; letter-spacing: 0.02em; }
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.shot { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; min-height: 200px; display: flex; flex-direction: column; gap: 12px; transition: border-color .15s, transform .15s; }
.shot:hover { border-color: rgba(var(--accent-rgb), 0.45); transform: translateY(-2px); }
.shot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.shot-tag { font-size: 12px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.shot-pill { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: rgba(var(--accent-rgb), 0.12); color: var(--accent); font-weight: 600; letter-spacing: 0.04em; }
.shot-pill.live { background: rgba(var(--positive-rgb), 0.14); color: var(--positive); }
.shot-pill.ok { background: rgba(var(--positive-rgb), 0.14); color: var(--positive); }
.shot-pill.warn { background: rgba(var(--warn-rgb), 0.14); color: var(--warn); }
.shot-pill.high { background: rgba(var(--negative-rgb), 0.14); color: var(--negative); }
.shot-pill.count { background: var(--neutral-pill-bg); color: var(--neutral-pill); }
.shot-body { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.shot-bar { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--shot-bar-a), var(--shot-bar-b)); }
.shot-bar.short { width: 60%; }
.shot-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: auto; }
.shot-cell { height: 46px; border-radius: 8px; background: var(--shot-cell-bg); border: 1px solid var(--border); }
.shot-eq-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.shot-stat-label { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.shot-stat-value { font-size: 22px; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.01em; }
.shot-stat-right { text-align: right; display: flex; flex-direction: column; }
.shot-stat-right .pos { font-size: 14px; font-weight: 600; }
.shot-stat-right .muted { font-size: 11px; }
.shot svg { display: block; }
.shot-eq-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: auto; }
.shot-eq-foot > div { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.shot-eq-foot .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.shot-eq-foot strong { font-size: 13px; font-weight: 600; }
.shot-margin-body { display: flex; align-items: center; gap: 14px; }
.shot-margin-stats { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.shot-margin-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; }
.shot-margin-stats .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.shot-margin-stats strong { font-size: 13px; font-weight: 600; }
.shot-alert-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.shot-alert-list li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; background: var(--list-item-bg); border: 1px solid var(--border); border-radius: 8px; }
.shot-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.shot-dot.level-high { background: var(--negative); box-shadow: 0 0 0 3px rgba(var(--negative-rgb), 0.18); }
.shot-dot.level-warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(var(--warn-rgb), 0.18); }
.shot-dot.level-info { background: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.18); }
.shot-alert-text { font-size: 13px; color: var(--fg-strong); line-height: 1.4; }
.shot-alert-at { font-size: 11px; }
@media (max-width: 420px) {
  .shot-stat-value { font-size: 18px; }
  .shot-margin-body { flex-direction: column; align-items: flex-start; }
}
.pricing { text-align: center; }
.pricing h2 { font-size: 28px; margin: 0 0 8px; letter-spacing: -0.01em; }
.pricing-sub { color: var(--muted); margin: 0 0 36px; }
.plans { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.plan { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 240px; text-align: left; transition: transform .15s, border-color .15s; }
.plan:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), 0.45); }
.plan.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 12px 28px rgba(var(--accent-rgb), 0.12); }
.plan h4 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 6px; }
.plan .featured-badge { display: inline-block; background: var(--accent); color: var(--accent-on); font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.plan .price { font-size: 32px; font-weight: 700; color: var(--accent); margin: 8px 0 10px; }
.plan .price span { font-size: 14px; color: var(--muted-2); font-weight: 400; }
.plan .tagline { color: var(--muted-2); font-size: 13px; margin: 0 0 16px; }
.plan ul { padding-left: 18px; color: var(--muted); min-height: 130px; font-size: 14px; line-height: 1.7; }
.plan .subscribe { margin-top: 16px; width: 100%; padding: 11px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-on); font-weight: 600; cursor: pointer; font-size: 14px; }
.plan .subscribe:disabled { opacity: 0.6; cursor: default; }
.pricing-cta { margin: 36px 0 0; text-align: center; }
.pricing-cta .link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 14px; }
.waitlist { background: var(--card); border: 1px solid var(--border); border-radius: 18px; text-align: center; max-width: 720px; }
.waitlist .beta-pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(var(--positive-rgb), 0.12); border: 1px solid rgba(var(--positive-rgb), 0.4); color: var(--positive); font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.waitlist h2 { font-size: 26px; margin: 0 0 8px; }
.waitlist p { color: var(--muted); margin: 0 0 8px; }
.waitlist-form { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.waitlist-form input { padding: 12px 16px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--card-2); color: var(--fg); min-width: 280px; font-size: 14px; }
.waitlist-form button { padding: 12px 22px; border: 0; border-radius: 10px; background: var(--positive); color: var(--positive-on); font-weight: 700; cursor: pointer; font-size: 14px; }
.waitlist-form button:disabled { opacity: 0.6; cursor: default; }
.waitlist .msg { color: var(--positive); margin-top: 12px; font-size: 14px; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; text-align: left; }
.faq-item { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.faq-item h4 { margin: 0 0 8px; font-size: 15px; color: var(--fg); }
.faq-item p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth { max-width: 380px; margin: 0 auto 64px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px; }
.auth h3 { margin: 0 0 16px; text-align: center; font-size: 18px; }
.auth form { display: flex; flex-direction: column; gap: 10px; }
.auth input { padding: 11px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--card-2); color: var(--fg); font-size: 14px; }
.auth button[type="submit"] { padding: 11px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-on); font-weight: 600; cursor: pointer; font-size: 14px; }
.auth .link { background: none; color: var(--accent); border: 0; font-weight: 600; cursor: pointer; font-size: 13px; }
.auth .link.forgot { align-self: flex-end; margin-top: -2px; }
.auth .auth-sub { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 14px; text-align: center; }
.auth .msg { font-size: 13px; color: var(--warn-text); }
.auth .msg.ok-msg { border: 1px solid var(--positive); }
.footer { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 24px; border-top: 1px solid var(--border); }
.footer .row { display: flex; gap: 18px; align-items: center; }
.footer .disclaimer { color: var(--muted-3); font-size: 12px; text-align: center; max-width: 640px; margin: 0; }

/* ===== D11 responsive (mobile) ===== */
@media (max-width: 768px) {
  .landing-nav { flex-direction: column; gap: 10px; align-items: flex-start; }
  .landing-nav .right { flex-wrap: wrap; }
  .hero { margin: 28px auto; padding: 36px 18px; }
  .hero h1 { font-size: 26px; }
  .hero p { font-size: 14px; }
  .features, .how, .preview, .waitlist, .faq { padding: 36px 16px; }
  .steps, .shots, .plans, .faq-list { grid-template-columns: 1fr; }
  .plan { width: 100%; }
  .waitlist-form { flex-direction: column; }
  .waitlist-form input, .waitlist-form button { width: 100%; }
  .auth { margin: 0 16px 36px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .positions { overflow-x: auto; }
  .top-cards { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .quick-stats { grid-template-columns: 1fr 1fr; }
  .dash-hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .nav .right { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .cards { grid-template-columns: 1fr; }
  .top-cards { grid-template-columns: 1fr; }
}

/* ===== Theme switcher pill (in nav) ===== */
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
}
.theme-switch button {
  background: transparent;
  color: var(--muted-2);
  border: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.theme-switch button.active {
  background: var(--accent);
  color: var(--accent-on);
}
.theme-switch button:hover:not(.active) { color: var(--fg); }

/* ===== Nav dropdown menu (Dashboard) ===== */
.nav-dropdown { position: relative; }
.nav-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--card-2);
}
.nav-menu-trigger:hover { border-color: var(--accent); }
.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 184px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  box-shadow: var(--shadow-modal);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}
.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.nav-dropdown-item:hover { background: var(--card-2); color: var(--accent); }
.nav-dropdown-item.active { color: var(--accent); font-weight: 600; }

/* ── Logout button (styled to match theme) ── */
.nav-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted, #8896a6);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.nav-logout:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.3);
  color: #ef4444;
}

/* ===== Exchange switcher (Dashboard) =====
 * Lives as the 5th "top card" so the user can see which exchange is
 * connected, which one errored on the last fetch, and which one is not
 * configured yet — all in one place next to the equity/PnL/margin/grid
 * cards. Each pill carries a 3-state status badge (ok / warn / off).
 */
.exchange-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.exchange-card .exch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.exchange-card .exch-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exchange-card .exch-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
}
.exchange-card .exch-summary .es-dot {
  width: 6px; height: 6px; border-radius: 999px; flex-shrink: 0;
}
.exchange-card .exch-summary .es-dot.ok   { background: var(--positive, #2ecc71); box-shadow: 0 0 6px var(--positive, #2ecc71); }
.exchange-card .exch-summary .es-dot.warn { background: #f5a524; box-shadow: 0 0 6px #f5a524; }
.exchange-card .exch-summary .es-dot.off  { background: var(--muted-2, #5d6675); }
.exchange-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.exchange-switch .exch-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-2, #2a3140);
  background: var(--card, #141a25);
  color: var(--muted-2, #9aa3b2);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
  position: relative;
}
.exchange-switch .exch-pill .pill-dot {
  width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0;
}
.exchange-switch .exch-pill.status-ok   .pill-dot { background: var(--positive, #2ecc71); box-shadow: 0 0 6px var(--positive, #2ecc71); }
.exchange-switch .exch-pill.status-warn .pill-dot { background: #f5a524; box-shadow: 0 0 6px #f5a524; }
.exchange-switch .exch-pill.status-off  .pill-dot { background: var(--muted-2, #5d6675); }
.exchange-switch .exch-pill.status-warn { border-color: rgba(245, 165, 36, 0.45); }
.exchange-switch .exch-pill.status-warn .pill-name { color: #f5a524; }
.exchange-switch .exch-pill.status-off  { border-style: dashed; opacity: 0.78; }
.exchange-switch .exch-pill:hover { color: var(--fg); border-color: var(--accent, #4f8cff); }
.exchange-switch .exch-pill.active {
  background: var(--accent, #4f8cff);
  border-color: var(--accent, #4f8cff);
  color: var(--accent-on, #fff);
  opacity: 1;
}
.exchange-switch .exch-pill.active .pill-dot {
  background: var(--accent-on, #fff);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}
.exchange-switch .exch-pill.active.status-warn { border-color: #f5a524; }
.exchange-switch .exch-pill .pill-err-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-2, #1a2030);
  color: var(--fg);
  border: 1px solid var(--border-3, #2a3140);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 10;
}
.exchange-switch .exch-pill.status-warn:hover .pill-err-tip { opacity: 1; }
.exchange-switch .exch-pill .pill-cta {
  font-size: 10px;
  color: var(--accent, #4f8cff);
  font-weight: 700;
  margin-left: 2px;
}
.exchange-switch .exch-pill.active .pill-cta { color: var(--accent-on, #fff); opacity: 0.85; }

@media (max-width: 720px) {
  .exchange-card { width: 100%; }
  .exchange-switch .exch-pill { flex: 1 1 auto; justify-content: center; }
}

/* ===== Dashboard enrichment ===== */
.dashboard { padding-bottom: 40px; }
.dashboard .nav { padding: 14px 24px; gap: 12px; }
/* When dashboard uses landing-nav class, inherit landing page nav styling */
.dashboard .landing-nav {
  position: sticky;
  top: 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  z-index: 10;
  border-bottom: 1px solid var(--border-3);
}
.dashboard .right { gap: 14px; }
.btn-mini { display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--border-5); color: var(--fg); font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; }
a.btn-mini,
a.btn-mini:link,
a.btn-mini:visited,
a.btn-mini:hover,
a.btn-mini:active,
a.btn-mini:focus { text-decoration: none; color: var(--fg); outline: none; }
a.btn-mini:hover { border-color: var(--accent); }
.btn-mini:hover { border-color: var(--accent); }
.btn-mini.primary { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.btn-mini.ghost { background: transparent; }
/* Minimal theme: cards/panels sit on white, so give them a touch more
   contrast than the near-white --card default (which looks flat on #fff).
   Fixes "Dashboard looks washed out in 极简/white theme". */
:root[data-theme="minimal"] .card,
:root[data-theme="minimal"] .panel,
:root[data-theme="minimal"] .exchange-card,
:root[data-theme="minimal"] .top-cards .card,
:root[data-theme="minimal"] .auth {
  background: #eef1f6;
  border-color: #d9dee6;
}
:root[data-theme="minimal"] .quick-stats > div { border-color: #d9dee6; background: #f3f5f9; }
:root[data-theme="minimal"] .watch-list li { border-bottom-color: #e6e9ef; }
:root[data-theme="minimal"] .grid-table td { border-bottom-color: #e6e9ef; }
:root[data-theme="minimal"] .exchange-switch .exch-pill { background: #f3f5f9; }
:root[data-theme="minimal"] .nav-menu-trigger { background: #f3f5f9; }

.dash-hero { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 8px; gap: 16px;
  background:
    radial-gradient(1000px 300px at 50% 0%, rgba(var(--accent-rgb), 0.10), transparent 70%),
    radial-gradient(600px 200px at 80% 100%, rgba(var(--positive-rgb), 0.06), transparent 70%);
  border-radius: 0 0 16px 16px;
}
.dash-hero h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; letter-spacing: -0.01em; }
.dash-hero .muted { color: var(--muted-2); font-size: 13px; margin: 0; }
.dash-hero .dash-actions { display: flex; gap: 10px; align-items: center; }
.demo-badge { background: rgba(var(--warn-rgb), 0.12); color: var(--warn-text); border-color: rgba(var(--warn-rgb), 0.4); }
.muted { color: var(--muted-2); }
.muted.small { font-size: 12px; }
.top-cards .card { position: relative; }
.top-cards .bar { width: 100%; height: 6px; background: var(--bar-bg); border-radius: 999px; margin: 6px 0 8px; overflow: hidden; }
.top-cards .bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--positive)); border-radius: 999px; }
.top-cards .bar-fill.warn { background: linear-gradient(90deg, var(--warn-text), #ff9a3c); }
.top-cards .bar-fill.high { background: linear-gradient(90deg, var(--negative), #c63232); }

/* Panel frame: consistent surface */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 0 24px 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-head h3 { margin: 0 0 2px; font-size: 16px; font-weight: 700; }
.panel-head .muted { margin: 0; font-size: 12px; }

/* Equity panel */
.eq-panel { padding: 22px 24px; }
.eq-panel .panel-head { align-items: flex-start; }
.quick-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; min-width: 360px; }
.quick-stats > div { display: flex; flex-direction: column; align-items: flex-end; padding: 6px 10px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border-4); }
.quick-stats .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.quick-stats strong { font-size: 14px; }
.equity-curve { position: relative; padding: 8px 0 0; }
.equity-curve svg { width: 100%; height: 180px; display: block; }
.equity-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted-3); padding-top: 6px; }
.equity-meta { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.equity-meta .delta { font-size: 14px; font-weight: 700; }
.equity-meta .delta.pos { color: var(--positive); }
.equity-meta .delta.neg { color: var(--negative); }

/* Two-column grid */
.two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; padding: 0 24px; margin-bottom: 16px; }
.two-col .panel { margin: 0; }
.grid-table { width: 100%; border-collapse: collapse; }
.grid-table th { text-align: left; font-size: 11px; color: var(--muted-3); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.grid-table td { padding: 12px 4px; border-bottom: 1px solid var(--border-3); font-size: 13px; vertical-align: middle; }
.grid-table tr:last-child td { border-bottom: 0; }
.grid-cell { display: flex; flex-direction: column; }
.grid-cell strong { font-weight: 600; }
.grid-cell .muted { font-size: 11px; }
.grid-status { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.grid-status.active { background: rgba(var(--positive-rgb), 0.12); color: var(--positive); border: 1px solid rgba(var(--positive-rgb), 0.35); }
.grid-status.idle { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.35); }
.grid-status.stale { background: rgba(var(--negative-rgb), 0.12); color: var(--negative); border: 1px solid rgba(var(--negative-rgb), 0.35); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }

/* Watchlist */
.watch-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.watch-list li { display: grid; grid-template-columns: 1.2fr 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-3); }
.watch-list li:last-child { border-bottom: 0; }
.watch-pair { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.watch-pair strong { font-size: 13px; font-weight: 600; }
.watch-pair .muted { font-size: 11px; }

/* Exchange pill (watchlist + strategy rows) — works in light & dark themes. */
.exchange-badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  white-space: nowrap;
  vertical-align: middle;
}
.watch-mid { display: flex; flex-direction: column; align-items: flex-end; }
.watch-price { font-size: 14px; font-weight: 600; }

/* Alerts and activity lists */
.alert-list, .activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
/* Thin custom scrollbar for scrollable lists */
.alert-list::-webkit-scrollbar, .activity-list::-webkit-scrollbar { width: 5px; }
.alert-list::-webkit-scrollbar-thumb, .activity-list::-webkit-scrollbar-thumb { background: var(--border-4); border-radius: 3px; }
.alert-list::-webkit-scrollbar-thumb:hover, .activity-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.alert-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border-4); }
.alert-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.alert-row.high { border-color: rgba(var(--negative-rgb), 0.4); background: rgba(var(--negative-rgb), 0.05); }
.alert-row.high .dot { background: var(--negative); }
.alert-row.warn { border-color: rgba(var(--warn-rgb), 0.4); background: rgba(var(--warn-rgb), 0.04); }
.alert-row.warn .dot { background: var(--warn-text); }
.alert-row p { margin: 0 0 2px; font-size: 13px; }
.activity-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border-4); }
.activity-list li:last-child { border-bottom: 0; }
.act-icon { display: inline-flex; width: 28px; height: 28px; border-radius: 8px; background: rgba(var(--accent-rgb), 0.12); color: var(--accent); align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.activity-list p { margin: 0 0 2px; font-size: 13px; }

/* AI Weekly report card */
.report-panel { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; border-color: rgba(var(--positive-rgb), 0.4); background: linear-gradient(135deg, rgba(var(--positive-rgb), 0.06), rgba(var(--accent-rgb), 0.06)); }
.report-icon { font-size: 36px; line-height: 1; margin-top: 2px; }
.report-body { flex: 1; min-width: 0; }
.report-body h3 { margin: 0 0 4px; font-size: 16px; }
.report-body .muted { margin: 0 0 4px; font-size: 13px; }
.report-body .small { font-size: 12px; }
.report-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted-2);
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 6px 0 10px;
}
.report-meta-item { display: inline-flex; align-items: center; gap: 6px; }
.report-meta-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--positive, #2ecc71);
  box-shadow: 0 0 6px var(--positive, #2ecc71);
  display: inline-block;
}
.report-meta-sep { color: var(--muted-3); }
.report-cta { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.report-text {
  margin: 10px 0 0;
  padding: 12px 14px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--report-text);
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.report-text.sample { border-color: rgba(var(--accent-rgb), 0.35); }
.gen-msg { color: var(--positive) !important; margin-top: 6px !important; }
.gen-msg.is-err { color: var(--negative-text) !important; }

/* Footer / sync status */
.dash-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 24px 0; border-top: 1px solid var(--border); margin-top: 8px; font-size: 12px; }

/* ============================== Performance strip ============================== */
.perf-panel { margin-top: 16px; }
.metrics-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.metric { display: flex; flex-direction: column; gap: 4px; padding: 12px; background: var(--code-block-bg); border: 1px solid var(--border); border-radius: 8px; }
.metric strong { font-size: 18px; color: var(--fg-strong); }
.metric .pos { color: var(--positive); }
.metric .neg { color: var(--negative); }
@media (max-width: 1100px) { .metrics-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .metrics-strip { grid-template-columns: repeat(2, 1fr); } }

/* ============================== Strategy table actions ============================== */
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-actions .link { padding: 0; background: transparent; }
.row-actions .link.danger { color: var(--negative-text); }
.row-actions .link.danger:hover { color: var(--negative); }
.row-actions .link:hover { text-decoration: underline; }
.grid-table tbody tr:hover { background: rgba(var(--accent-rgb), 0.05); }

/* ============================== Watchlist ============================== */
.watch-list li { position: relative; padding-right: 36px; }
/* Empty state when the pair's exchange has no API key connected: collapse
   the price/sparkline columns and show a prompt + jump button instead. */
.watch-empty { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.watch-empty p { margin: 0; text-align: right; max-width: 220px; line-height: 1.4; }
.watch-empty .btn-mini { white-space: nowrap; }

/* Strategy row chip shown when the strategy's exchange API is not connected */
.need-api-chip {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--warn-text);
  background: rgba(var(--warn-rgb), 0.12);
  border: 1px solid rgba(var(--warn-rgb), 0.3);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.need-api-chip:hover { background: rgba(var(--warn-rgb), 0.22); }
.watch-remove {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--muted-2); cursor: pointer; font-size: 18px; line-height: 1;
  width: 24px; height: 24px; border-radius: 12px;
}
.watch-remove:hover { background: rgba(255, 91, 91, 0.15); color: var(--negative-text); }

/* ============================== Alert settings ============================== */
.alert-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 12px; }
.alert-settings label { display: flex; flex-direction: column; gap: 4px; }
.alert-settings label span { color: var(--muted-2); font-size: 12px; }
.alert-settings input {
  background: var(--code-block-bg); color: var(--fg-strong);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 14px;
  width: 100%;
}
.alert-settings input:disabled { opacity: 0.6; }
.num-row { display: flex; align-items: center; gap: 8px; }
.num-row input { flex: 0 0 80px; }
@media (max-width: 600px) { .alert-settings { grid-template-columns: 1fr; } }

/* ============================== Modal ============================== */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow: auto;
  box-shadow: var(--shadow-modal);
}
.modal.modal-sm { max-width: 380px; }
.modal.modal-lg { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; color: var(--fg-strong); }
.modal-close {
  background: transparent; border: 0; color: var(--muted-2); cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 4px;
}
.modal-close:hover { color: var(--fg-strong); }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { display: flex; flex-direction: column; gap: 4px; }
.modal-body label span { color: var(--muted-2); font-size: 12px; }
.modal-body input,
.modal-body select {
  background: var(--code-block-bg); color: var(--fg-strong);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 14px;
  font-family: inherit;
}
.modal-body input:focus,
.modal-body select:focus { outline: none; border-color: var(--accent); }
.modal-body .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-body .form-err {
  background: rgba(var(--negative-rgb), 0.12); color: var(--negative-text);
  border: 1px solid rgba(var(--negative-rgb), 0.35); border-radius: 6px; padding: 6px 10px; font-size: 12px; margin: 0;
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.modal-sub { font-size: 14px; color: var(--muted-2); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  background: var(--code-block-bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 2px; }
.detail-grid strong { color: var(--fg-strong); }
@media (max-width: 600px) {
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-body .form-row { grid-template-columns: 1fr; }
}

/* ============================== Toast ============================== */
.toast-stack {
  position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  color: var(--fg-strong); font-size: 13px; min-width: 200px; max-width: 360px;
  box-shadow: var(--shadow-toast);
  animation: toast-in 0.18s ease-out;
}
.toast-ok { border-color: rgba(var(--positive-rgb), 0.55); }
.toast-err { border-color: rgba(var(--negative-rgb), 0.55); }
.toast-info { border-color: rgba(var(--accent-rgb), 0.55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* API export panel */
.api-export-panel { padding: 22px 24px; border-color: rgba(var(--accent-rgb), 0.4); background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.06), rgba(var(--positive-rgb), 0.06)); }
.api-export-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.api-key-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.api-key-box code {
  display: block;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--code);
  word-break: break-all;
}
.api-docs-box {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--code-block-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.api-docs-box .link { color: var(--accent); }

/* P1: tier-gated feature panels show an upgrade overlay when the user's plan
   is below the required tier (Growth for the AI report, Scale for API export). */
.panel.locked {
  position: relative;
  overflow: hidden;
}
.upgrade-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 20px;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border-radius: 14px;
  z-index: 5;
}
.upgrade-lock p {
  margin: 0;
  font-size: 14px;
  color: var(--fg);
  max-width: 320px;
}
.upgrade-lock .btn-mini.primary {
  margin-top: 4px;
}

/* ===== Admin: Waitlist table (new for Phase 1.5) ===== */
.waitlist-table { font-size: 13px; }
.waitlist-table .col-email { font-family: ui-monospace, monospace; }
.waitlist-table .empty { padding: 14px; text-align: center; color: var(--muted-2); }

/* ===== Phase 2: Portfolio net-worth (全组合净值追踪) ===== */
.portfolio { max-width: 980px; margin: 0 auto; padding: 0 20px 60px; }
.pf-cards { display: grid; gap: 16px; }
.pf-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.pf-hero-card .pf-nav-total { font-size: 34px; font-weight: 800; margin-top: 4px; }
.pf-nav-sub { display: flex; gap: 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.pf-risk .pf-risk-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.pf-risk-badge { font-size: 30px; font-weight: 800; line-height: 1; }
.pf-risk-label { font-weight: 700; }
.risk-LOW { color: #3fb950; }
.risk-MEDIUM { color: #d29922; }
.risk-HIGH { color: #f85149; }
.pf-factors { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.pf-factors li { margin: 3px 0; }
.pf-alloc-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--border); }
.pf-alloc-seg { height: 100%; }
.pf-alloc-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.pf-alloc-item { display: inline-flex; align-items: center; gap: 6px; }
.pf-alloc-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pf-ex-list { display: flex; flex-direction: column; gap: 10px; }
.pf-ex-row { display: grid; grid-template-columns: 150px 1fr 56px 120px 36px; align-items: center; gap: 12px; }
.pf-ex-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.pf-ex-name i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pf-ex-stat { display: flex; flex-direction: column; font-size: 13px; }
.pf-ex-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.pf-ex-bar-fill { height: 100%; }
.pf-ex-pos { text-align: right; font-size: 13px; color: var(--muted); }
.pf-empty { text-align: center; padding: 40px 20px; }
.pf-empty p { color: var(--muted); margin-bottom: 16px; }
.neg { color: #f85149; }
.pos { color: #3fb950; }
.muted.small, .small { font-size: 12px; }
.waitlist-table .badge-src { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.30); padding: 1px 8px; border-radius: 999px; font-size: 11px; text-transform: lowercase; font-weight: 600; letter-spacing: 0.02em; }

/* ===== Phase 3 · ⑤ Grid Backtest Lab ===== */
.backtest { min-height: 100vh; background: var(--bg, #0d1117); color: var(--txt, #e6edf3); }
.bt-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--border, #30363d); }
.bt-brand { font-weight: 800; font-size: 18px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.bt-logo { color: var(--accent, #58a6ff); }
.bt-header-right { display: flex; align-items: center; gap: 14px; }
.bt-main { max-width: 920px; margin: 0 auto; padding: 28px 20px 80px; }
.bt-sub { color: var(--muted, #8b949e); margin: 6px 0 22px; }
.backtest h1 { font-size: 26px; margin: 0; }
.backtest h2 { font-size: 19px; margin: 28px 0 14px; }
.bt-form .bt-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.bt-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted, #8b949e); flex: 1 1 140px; }
.bt-form label.bt-grow { flex: 2 1 200px; }
.bt-form input, .bt-form select { background: var(--panel2, #1c2230); border: 1px solid var(--border, #30363d); color: var(--txt, #e6edf3); border-radius: 8px; padding: 9px 10px; font-size: 14px; }
.bt-presets { display: flex; gap: 8px; align-items: flex-end; }
.chip { background: var(--panel2, #1c2230); border: 1px solid var(--border, #30363d); color: var(--txt, #e6edf3); border-radius: 999px; padding: 7px 12px; font-size: 12px; cursor: pointer; }
.chip:hover { border-color: var(--accent, #58a6ff); }
.bt-actions { margin-top: 6px; }
.btn-primary { background: var(--accent, #58a6ff); color: #0d1117; border: none; border-radius: 8px; padding: 9px 18px; font-weight: 700; cursor: pointer; font-size: 14px; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.card { background: var(--panel, #161b22); border: 1px solid var(--border, #30363d); border-radius: 12px; padding: 16px 18px; }
.bt-error { border-left: 4px solid #f85149; margin-top: 18px; }
.bt-error p { margin: 6px 0 0; color: var(--muted, #8b949e); }
.bt-warn { background: rgba(210, 153, 34, 0.12); border: 1px solid #d29922; color: #d29922; border-radius: 8px; padding: 10px 14px; margin: 14px 0; font-size: 13.5px; }
.bt-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.bt-metric { display: flex; flex-direction: column; gap: 8px; }
.bt-m-label { font-size: 12.5px; color: var(--muted, #8b949e); }
.bt-m-value { font-size: 22px; font-weight: 800; }
.bt-pos { color: #f85149; }  /* 涨 / 盈利 = 红 (CN convention) */
.bt-neg { color: #3fb950; }  /* 跌 / 亏损 = 绿 (CN convention) */
.bt-risk { color: #d29922; }
.bt-chart-wrap { margin-top: 8px; }
.bt-chart-legend { display: flex; gap: 18px; font-size: 12.5px; color: var(--muted, #8b949e); margin-bottom: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-eq { background: #58a6ff; }
.dot-px { background: #8b949e; }
.bt-chart { display: block; background: var(--panel2, #1c2230); border-radius: 8px; }
.bt-inventory { margin-top: 14px; font-size: 14px; color: var(--muted, #8b949e); }
.bt-inventory b { color: var(--txt, #e6edf3); }
.bt-disclaimer { margin-top: 16px; font-size: 12.5px; color: var(--muted, #8b949e); border-top: 1px dashed var(--border, #30363d); padding-top: 12px; }

/* ---- On-chain asset tracker (Phase 4 · ④) ---- */
.oc-bad { border-color: #f85149 !important; }
.oc-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; }
.oc-summary .bt-m-value { font-size: 26px; }
.oc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.oc-addr { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-table-wrap { padding: 6px 4px; }
.oc-table { width: 100%; border-collapse: collapse; }
.oc-table th, .oc-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border, #30363d); font-size: 14px; }
.oc-table th { color: var(--muted, #8b949e); font-weight: 600; font-size: 12.5px; }
.oc-table tr:last-child td { border-bottom: none; }
.oc-num { text-align: right; font-variant-numeric: tabular-nums; }
.oc-sym { display: flex; flex-direction: column; line-height: 1.3; }
.oc-sym .muted { font-size: 11.5px; }
.link { background: none; border: none; color: var(--accent, #58a6ff); cursor: pointer; font-size: 14px; }