/* ═══ App shell ═══════════════════════════════════════════════════ */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(10, 13, 23, 0.55);
  backdrop-filter: blur(14px);
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}
[data-theme="light"] .sidebar { background: rgba(255, 255, 255, 0.62); }

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 24px; }
.brand-badge {
  width: 42px; height: 42px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--brand-dim);
  border: 1px solid rgba(139, 124, 250, 0.3);
  box-shadow: 0 0 22px rgba(139, 124, 250, 0.18);
}
.brand-mark { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-tier {
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.3em; margin-top: 1px;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: 12px;
  color: var(--text-dim); text-decoration: none;
  font-size: 13.5px; font-weight: 550;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.nav-item:hover { color: var(--text); background: rgba(139, 124, 250, 0.06); transform: translateX(2px); }
.nav-item.active {
  color: var(--text); background: var(--brand-dim);
  border-color: rgba(139, 124, 250, 0.28); font-weight: 650;
  box-shadow: inset 0 0 18px rgba(139, 124, 250, 0.08);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--grad-brand);
}
.nav-ico {
  width: 19px; height: 19px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0.9;
}
.nav-item.active .nav-ico { stroke: var(--brand-bright); opacity: 1; }

.sidebar-foot { padding: 14px 6px 0; border-top: 1px solid var(--border); }
.sentinel { display: flex; align-items: center; gap: 10px; }
.sentinel .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.sentinel .dot.live {
  background: var(--green-bright);
  box-shadow: 0 0 0 3px rgba(47, 216, 132, 0.18), 0 0 10px var(--green);
  animation: pulse 2s infinite;
}
.sentinel .dot.stale { background: var(--red-bright); box-shadow: 0 0 8px var(--red); }
.sentinel-text { display: flex; flex-direction: column; line-height: 1.3; flex: 1; min-width: 0; }
.sentinel-text span:first-child { font-size: 9.5px; font-weight: 800; letter-spacing: 0.2em; font-family: var(--display); }
.sentinel-text span:last-child { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version { font-size: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 30px; border-bottom: 1px solid var(--border);
  background: rgba(10, 13, 23, 0.45);
  position: sticky; top: 0; z-index: 40; backdrop-filter: blur(14px);
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.55); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.market-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 750; letter-spacing: 0.1em;
  padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text-dim); font-family: var(--display);
}
.market-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.market-pill.open { color: var(--green-bright); border-color: rgba(47, 216, 132, 0.4); background: var(--green-dim); }
.market-pill.open .dot { background: var(--green-bright); animation: pulse 2s infinite; }
.clock { font-size: 17px; font-weight: 650; }
.clock-tz { font-size: 10px; font-weight: 750; letter-spacing: 0.1em; margin-left: -8px; }

.top-metric {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.35;
  padding: 4px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.top-metric-label {
  font-size: 8.5px; font-weight: 800; letter-spacing: 0.18em;
  color: var(--text-faint); font-family: var(--display);
}
.top-metric .mono { font-size: 13.5px; font-weight: 650; }

.broker-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  font-size: 12.5px; font-weight: 650;
}
.broker-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red-bright); }
.broker-chip .dot.on { background: var(--green-bright); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }

/* banners */
#banners { padding: 0 30px; }
.banner {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 12px 18px;
  border-radius: var(--r-md); font-size: 13px; font-weight: 500;
  animation: fadeUp 0.3s ease;
}
.banner-amber { background: var(--amber-dim); border: 1px solid rgba(245, 165, 36, 0.35); color: #ffd685; }
[data-theme="light"] .banner-amber { color: #8a4b04; }
.banner-red { background: var(--red-dim); border: 1px solid rgba(239, 70, 85, 0.4); color: var(--red-bright); }
.banner-blue { background: var(--blue-dim); border: 1px solid rgba(76, 194, 255, 0.35); color: var(--blue); }
.banner .spacer { flex: 1; }

/* ─── View shell ─────────────────────────────────────────────────── */
.view { padding: 26px 30px 56px; max-width: 1280px; width: 100%; margin: 0 auto; }
/* Entrance animation ONLY while .view-anim is present (added on navigation,
   removed right after). Live ticks re-render content in place — animating
   those would make the whole page blink every second. */
.view.view-anim > * { animation: fadeUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }
.view.view-anim > *:nth-child(2) { animation-delay: 0.05s; }
.view.view-anim > *:nth-child(3) { animation-delay: 0.1s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.view-head h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.view-head p { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-main { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .sidebar { display: none; } .view, .topbar, #banners { padding-left: 16px; padding-right: 16px; } }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ─── Dashboard ──────────────────────────────────────────────────── */
.hero-card { overflow: hidden; }
.hero-card::after {
  content: ""; position: absolute; inset: -40% -20% auto;  height: 130%;
  background: radial-gradient(560px 240px at 78% 0%, var(--hero-glow, rgba(139,124,250,0.12)), transparent 70%);
  pointer-events: none;
}
.hero-card.hero-pos { --hero-glow: rgba(47, 216, 132, 0.13); }
.hero-card.hero-neg { --hero-glow: rgba(239, 70, 85, 0.13); }

.pnl-hero { position: relative; display: flex; flex-direction: column; gap: 6px; }
.pnl-hero .pnl-big {
  font-size: 46px; font-weight: 700; letter-spacing: -0.035em;
  font-family: var(--mono); line-height: 1.1;
}
.pnl-breakdown { display: flex; gap: 20px; font-size: 12px; color: var(--text-dim); flex-wrap: wrap; margin-top: 4px; }
.pnl-breakdown b { color: var(--text); font-family: var(--mono); font-weight: 600; }

.stat-val { font-size: 22px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; }
.stat-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

.guard { margin-bottom: 16px; }
.guard:last-child { margin-bottom: 0; }
.guard-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; gap: 8px; }
.guard-head .name { color: var(--text-dim); font-weight: 650; }
.guard-head .val { font-family: var(--mono); color: var(--text); }
.guard-pct {
  font-size: 10px; font-weight: 800; font-family: var(--mono);
  padding: 1px 8px; border-radius: 999px; margin-left: auto;
  background: var(--surface-3); color: var(--text-faint);
}
.guard-pct.warn { background: var(--amber-dim); color: var(--amber); }
.guard-pct.hot { background: var(--red-dim); color: var(--red-bright); }

/* shield status side card */
.shield-card { text-align: center; }
.shield-ring-wrap { display: flex; justify-content: center; margin: 6px 0 10px; }
.shield-caption { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.shield-caption b { color: var(--text); }

.trade-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.trade-row:last-child { border-bottom: none; }
.trade-side {
  font-size: 10px; font-weight: 800; padding: 4px 9px; border-radius: 7px; letter-spacing: 0.08em;
  font-family: var(--display);
}
.trade-side.buy { background: var(--green-dim); color: var(--green-bright); }
.trade-side.sell { background: var(--red-dim); color: var(--red-bright); }
.trade-info { flex: 1; min-width: 0; }
.trade-sym { font-weight: 650; font-size: 13px; }
.trade-meta { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }
.trade-pnl { font-family: var(--mono); font-weight: 700; font-size: 13.5px; }
.flag {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 6px;
  background: var(--red-dim); color: var(--red-bright);
  border: 1px solid rgba(239, 70, 85, 0.35);
}
.flag.amber { background: var(--amber-dim); color: var(--amber); border-color: rgba(245, 165, 36, 0.4); }

.empty { text-align: center; color: var(--text-faint); padding: 30px 10px; font-size: 13px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 8px; opacity: 0.7; }

.test-line { display: flex; justify-content: space-between; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.test-line:last-child { border-bottom: none; }
.ok { color: var(--green-bright); font-weight: 700; }
.bad { color: var(--red-bright); font-weight: 700; }

/* ─── Rules ──────────────────────────────────────────────────────── */
.rule-card { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.rule-text { flex: 1; min-width: 0; }
.rule-label { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-desc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.rule-value { width: 116px; }
.rule-value input { text-align: right; font-family: var(--mono); font-weight: 650; }
.rule-kind {
  font-size: 9px; font-weight: 800; letter-spacing: 0.12em; padding: 2.5px 8px;
  border-radius: 6px; font-family: var(--display);
}
.rule-kind.kill { background: var(--red-dim); color: var(--red-bright); }
.rule-kind.guard { background: var(--blue-dim); color: var(--blue); }
.rules-sealed {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  border-radius: var(--r-md); background: var(--brand-dim);
  border: 1px solid rgba(139, 124, 250, 0.35); color: var(--brand-bright);
  font-weight: 650; font-size: 13px;
}

/* ─── Journal ────────────────────────────────────────────────────── */
.j-entry { padding: 16px 20px; }
.j-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.j-time { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.j-type {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; padding: 3px 9px;
  border-radius: 6px; background: var(--surface-3); color: var(--text-dim);
  font-family: var(--display);
}
.j-type.reflection { background: var(--red-dim); color: var(--red-bright); }
.j-type.eod { background: var(--blue-dim); color: var(--blue); }
.j-notes { font-size: 13.5px; color: var(--text); white-space: pre-wrap; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; align-items: center; }
.j-composer textarea { margin-bottom: 10px; }
.conf-dots { display: flex; gap: 4px; }
.conf-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; cursor: pointer; padding: 0; }
.conf-dot.on { background: var(--brand); border-color: var(--brand-bright); }

/* ─── Analytics ──────────────────────────────────────────────────── */
/* edge stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-box {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px;
}
.stat-box .stat-num { font-size: 20px; font-weight: 750; font-family: var(--mono); letter-spacing: -0.02em; line-height: 1.2; }
.stat-box .stat-lab {
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); font-family: var(--display); margin-top: 3px;
}
.stat-box.hero { grid-column: span 3; background: var(--brand-dim); border-color: rgba(139,124,250,0.25); }
@media (max-width: 900px) { .stat-box.hero { grid-column: span 2; } }
.stat-box.hero .stat-num { font-size: 30px; }
.stat-foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-faint); margin-top: 12px; }
.stat-foot b { font-family: var(--mono); }

/* coach notes */
.insight { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; line-height: 1.6; color: var(--text-dim); }
.insight:last-child { border-bottom: none; }
.insight .ico { flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 800; }
.insight.warn .ico { background: var(--red-dim); color: var(--red-bright); }
.insight.good .ico { background: var(--green-dim); color: var(--green-bright); }
.insight.info .ico { background: var(--blue-dim); color: var(--blue); }

/* habit x-ray rows */
.xray-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.xray-row:last-child { border-bottom: none; }
.xray-lab { font-size: 11px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); font-family: var(--display); margin-bottom: 6px; }
.xray-line { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12.5px; color: var(--text-dim); padding: 2px 0; }
.xray-line b { font-family: var(--mono); color: var(--text); }
.holdbar { display: flex; align-items: center; gap: 8px; font-size: 11.5px; margin: 3px 0; }
.holdbar .hb-lab { width: 56px; color: var(--text-faint); flex-shrink: 0; }
.holdbar .hb-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.holdbar .hb-track > div { height: 100%; border-radius: 999px; }
.holdbar .hb-val { width: 48px; text-align: right; font-family: var(--mono); }

/* weekday / horizontal bars */
.hbar { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 12px; }
.hbar .hb-day { width: 34px; color: var(--text-faint); font-weight: 650; flex-shrink: 0; }
.hbar .hb-wrap { flex: 1; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.hbar .hb-wrap > div { height: 100%; border-radius: 999px; }
.hbar .hb-num { width: 72px; text-align: right; font-family: var(--mono); font-size: 11.5px; }

/* emotion rows */
.emo-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.emo-row:last-child { border-bottom: none; }
.emo-row .chip { cursor: default; }
.emo-row .spacer { flex: 1; }
.emo-row .mono { font-weight: 700; }

.score-wrap { display: flex; align-items: center; gap: 22px; }
.score-meta .score-num { font-size: 34px; font-weight: 800; font-family: var(--mono); letter-spacing: -0.03em; }
.score-meta .score-cap { font-size: 12.5px; color: var(--text-dim); max-width: 300px; line-height: 1.6; }
.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, 16px); gap: 4px; }
.heat-cell { width: 16px; height: 16px; border-radius: 5px; background: var(--surface-3); position: relative; transition: transform 0.12s ease; }
.heat-cell:hover { transform: scale(1.25); z-index: 5; }
.heat-cell:hover::after {
  content: attr(data-tip); position: absolute; bottom: 140%; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  font-size: 10.5px; padding: 4px 9px; border-radius: 8px; white-space: nowrap; z-index: 30;
  font-family: var(--mono); box-shadow: var(--shadow-soft);
}
.pattern-stat { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.pattern-stat:last-child { border-bottom: none; }
.pattern-num { font-size: 21px; font-weight: 800; font-family: var(--mono); min-width: 38px; }

/* ─── Report card ────────────────────────────────────────────────── */
.rc-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; border: 1px solid var(--border); }
.rc-tab {
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  font-size: 12.5px; font-weight: 650; padding: 7px 14px; border-radius: 9px;
  font-family: var(--font); transition: all 0.14s ease;
}
.rc-tab:hover { color: var(--text); }
.rc-tab.on { background: var(--grad-brand); color: #fff; box-shadow: 0 3px 12px rgba(139, 124, 250, 0.35); }
.rc-nav { display: flex; align-items: center; gap: 8px; }
.rc-label { font-size: 13px; font-weight: 650; font-family: var(--display); min-width: 150px; text-align: center; }

.rc-head-card { overflow: hidden; }
.rc-seal-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; margin-bottom: 18px; }
.rc-seal {
  width: 128px; height: 128px; flex-shrink: 0; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 3px solid var(--seal, var(--brand));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--seal) 14%, transparent),
              0 0 34px color-mix(in srgb, var(--seal) 30%, transparent);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--seal) 12%, transparent), transparent 70%);
}
.rc-grade { font-family: var(--display); font-size: 44px; font-weight: 700; line-height: 1; color: var(--seal); }
.rc-score { font-size: 11px; color: var(--text-faint); margin-top: 4px; }
.rc-headstats { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); gap: 12px 22px; flex: 1; min-width: 240px; }
.rc-stat { display: flex; flex-direction: column; line-height: 1.3; }
.rc-stat-num { font-size: 17px; font-weight: 700; }
.rc-stat-lab { font-size: 10px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); font-family: var(--display); margin-top: 2px; }

.rc-subjects { border-top: 1px solid var(--border); padding-top: 6px; }
.rc-subject { display: grid; grid-template-columns: 92px 1fr 34px minmax(140px, 1.1fr); align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rc-subject:last-child { border-bottom: none; }
.rc-sub-name { font-size: 12.5px; font-weight: 700; font-family: var(--display); }
.rc-sub-grade { font-size: 14px; font-weight: 800; font-family: var(--display); text-align: center; }
.rc-sub-note { font-size: 11px; line-height: 1.4; }
@media (max-width: 900px) {
  .rc-subject { grid-template-columns: 84px 1fr 30px; }
  .rc-sub-note { grid-column: 1 / -1; padding-left: 0; }
}

.mistake { padding: 13px 0; border-bottom: 1px solid var(--border); }
.mistake:last-child { border-bottom: none; }
.mk-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 4px; }
.mk-sev {
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em; padding: 2.5px 8px;
  border-radius: 6px; font-family: var(--display); flex-shrink: 0;
}
.mistake.high .mk-sev { background: var(--red-dim); color: var(--red-bright); }
.mistake.medium .mk-sev { background: var(--amber-dim); color: var(--amber); }
.mistake.low .mk-sev { background: var(--blue-dim); color: var(--blue); }
.mk-evidence { font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px; }
.mk-fix {
  font-size: 12.5px; color: var(--text); line-height: 1.6;
  border-left: 3px solid var(--green); border-radius: 0 9px 9px 0;
  background: var(--green-dim); padding: 8px 12px;
}
.mk-fix-tag { font-size: 9px; font-weight: 800; letter-spacing: 0.1em; color: var(--green-bright); margin-right: 8px; font-family: var(--display); }

/* ─── Settings / wizard ──────────────────────────────────────────── */
.broker-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .broker-cards { grid-template-columns: 1fr; } }
.broker-card {
  padding: 18px 16px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  text-align: center; transition: all 0.16s ease;
}
.broker-card:hover { border-color: var(--text-faint); transform: translateY(-2px); }
.broker-card.on {
  border-color: var(--brand); background: var(--brand-dim);
  box-shadow: 0 0 24px rgba(139, 124, 250, 0.14);
}
.broker-card .b-name { font-weight: 700; font-size: 14.5px; font-family: var(--display); }
.broker-card .b-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.wizard-steps { counter-reset: step; }
.wizard-step { display: flex; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.wizard-step:last-child { border-bottom: none; }
.wizard-step::before {
  counter-increment: step; content: counter(step);
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 9px;
  background: var(--brand-dim); color: var(--brand-bright);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; border: 1px solid rgba(139, 124, 250, 0.3);
  font-family: var(--display);
}
.wizard-step .w-body { font-size: 13px; color: var(--text-dim); line-height: 1.6; }
.wizard-step .w-body b { color: var(--text); }
.wizard-step code {
  font-family: var(--mono); font-size: 11.5px; background: var(--surface-3);
  padding: 2px 7px; border-radius: 6px; color: var(--brand-bright); user-select: all;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

/* ─── Connection status + redirect helper ────────────────────────── */
.conn-status {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; margin: 4px 0 12px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.conn-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); flex: none; }
.conn-status .dot.live { background: var(--green-bright); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.conn-status .dot.stale { background: var(--red-bright); box-shadow: 0 0 8px var(--red); }
.conn-status.ok { color: var(--green-bright); font-weight: 600; }
.conn-status.warn { color: var(--amber); font-weight: 600; }
.conn-status.muted { color: var(--text-faint); }
.redirect-row { margin-top: 14px; }
.redirect-row label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.redirect-row input[readonly] { color: var(--text-dim); background: var(--surface-2); font-family: var(--mono); font-size: 12px; }

/* ─── Lockout overlay ────────────────────────────────────────────── */
.lockout {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(900px 520px at 50% 0%, rgba(239, 70, 85, 0.15), transparent 60%), rgba(4, 5, 10, 0.97);
  display: flex; align-items: center; justify-content: center;
  animation: lockoutIn 0.4s ease;
  overflow-y: auto; padding: 30px;
}
[data-theme="light"] .lockout {
  background: radial-gradient(900px 520px at 50% 0%, rgba(220, 47, 63, 0.10), transparent 60%), rgba(240, 242, 249, 0.97);
}
@keyframes lockoutIn { from { opacity: 0; } }
.lockout-inner { max-width: 580px; width: 100%; text-align: center; }
.lockout-shield { display: flex; justify-content: center; color: var(--red-bright); animation: shieldPulse 1.8s infinite; }
.lockout-shield svg { width: 64px; height: 64px; }
@keyframes shieldPulse { 50% { opacity: 0.55; transform: scale(0.96); } }
.lockout h1 {
  font-size: 30px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--red-bright); margin: 12px 0 6px; font-family: var(--display);
}
.lockout-reason { color: var(--text-dim); font-size: 14px; }
.lockout-reason strong { color: var(--text); }
.lockout-message {
  color: var(--text); font-size: 16.5px; line-height: 1.65; font-weight: 500;
  max-width: 470px; margin: 20px auto 24px; text-align: center;
  padding: 0 6px; font-family: var(--display);
}

/* Breach status block — what actually happened, no fake countdown. */
.lockout-status {
  text-align: left; border-radius: var(--r-md); padding: 15px 17px;
  margin: 18px 0 6px; border: 1px solid var(--border-strong); background: var(--surface);
}
.lockout-status .ls-line { font-size: 13.5px; line-height: 1.6; }
.lockout-status .ls-line + .ls-line { margin-top: 6px; }
.lockout-status .ls-ico { margin-right: 4px; }
.lockout-status.locked { border-color: rgba(239, 70, 85, 0.45); background: rgba(239, 70, 85, 0.07); }
.lockout-status.warn { border-color: rgba(245, 165, 36, 0.45); background: rgba(245, 165, 36, 0.07); }
#lockout-when { font-size: 12.5px; margin-left: 4px; }
.lockout-journal {
  text-align: left; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); padding: 20px;
}
.lockout-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 12px; }
.lockout-note { font-size: 11.5px; margin-top: 10px; }

/* ─── Toasts ─────────────────────────────────────────────────────── */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 240px; max-width: 380px; padding: 13px 17px;
  border-radius: var(--r-md); font-size: 13px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); animation: toastIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(10px);
}
.toast.ok { border-color: rgba(47, 216, 132, 0.5); }
.toast.err { border-color: rgba(239, 70, 85, 0.55); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } }

/* ─── Hosted auth screen ─────────────────────────────────────────── */
#auth-screen {
  position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(139, 124, 250, 0.10), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(76, 194, 255, 0.06), transparent 55%),
    var(--bg);
}
.auth-card {
  width: min(410px, calc(100vw - 40px)); padding: 32px 30px 24px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-brand .brand-mark { width: 44px; height: 44px; color: var(--brand-bright); }
.auth-brand .brand-name { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.01em; }
.auth-brand .brand-tier {
  font-weight: 800; font-size: 11px; letter-spacing: 0.22em;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-tag { color: var(--text-faint); font-size: 12.5px; margin-top: 6px; }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--surface-2); padding: 4px; border-radius: 12px; }
.auth-tab {
  flex: 1; padding: 9px 0; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--text-dim); font-weight: 650; font-size: 13px;
}
.auth-tab.on { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-soft); }
#auth-form { display: flex; flex-direction: column; gap: 6px; }
#auth-form label { font-size: 11px; color: var(--text-faint); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 8px; font-family: var(--display); font-weight: 700; }
#auth-form input { font-size: 14px; }
.auth-err { color: var(--red-bright); font-size: 12.5px; margin-top: 8px; }
.auth-submit { margin-top: 16px; padding: 12px 0; font-size: 14px; }
.auth-note { color: var(--text-faint); font-size: 11.5px; text-align: center; margin-top: 14px; }

/* ─── Account chip (sidebar, hosted mode) ────────────────────────── */
.account-box {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px; margin-bottom: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.account-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-email { font-size: 12px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-sub { font-size: 10.5px; }

/* ─── Subscription plans ─────────────────────────────────────────── */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.plan-card { position: relative; display: flex; flex-direction: column; padding-top: 24px; }
.plan-popular { border-color: var(--brand); box-shadow: 0 0 32px rgba(139, 124, 250, 0.15); }
.plan-flag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--grad-brand); color: #fff; font-size: 10px; font-weight: 800;
  letter-spacing: 0.12em; padding: 4px 12px; border-radius: 999px;
  font-family: var(--display); box-shadow: 0 4px 14px rgba(139, 124, 250, 0.4);
}
.plan-name { font-size: 13px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); font-family: var(--display); }
.plan-price { font-size: 34px; font-weight: 700; margin-top: 4px; font-family: var(--display); }
.plan-per { font-size: 12px; margin-bottom: 12px; }
.plan-feats { margin: 0 0 12px; padding: 0 0 0 2px; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.plan-feats li { font-size: 12.5px; color: var(--text-dim); }
.plan-feats li::before { content: "✓ "; color: var(--green-bright); font-weight: 700; }
.plan-tag { font-size: 11.5px; margin-bottom: 14px; }
.plan-buy { margin-top: auto; width: 100%; }
.ok-text { color: var(--green-bright); }

/* ─── Auth terms + legal links ───────────────────────────────────── */
#auth-form label.auth-terms {
  display: flex; gap: 9px; align-items: flex-start; margin-top: 12px;
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
  text-transform: none; letter-spacing: normal; font-family: var(--font); font-weight: 500;
}
.auth-terms input { margin-top: 2px; accent-color: var(--brand); flex-shrink: 0; }
.auth-terms a { color: var(--brand-bright); }
.auth-legal { text-align: center; margin-top: 10px; font-size: 11px; }
.auth-legal a { color: var(--text-faint); text-decoration: none; }
.auth-legal a:hover { color: var(--brand-bright); }

/* ─── Settings: how-it-works strip ───────────────────────────────── */
.howit { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.howit-step { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; transition: all 0.15s ease; }
.howit-step:hover { border-color: rgba(139, 124, 250, 0.3); transform: translateY(-2px); }
.howit-num {
  font-weight: 800; font-size: 12px; font-family: var(--display);
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.howit-step b { display: block; font-size: 12.5px; margin: 4px 0 3px; }
.howit-step span { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; display: block; }
