[hidden] { display: none !important; }
:root {
  --bg: #0b0e13; --surface: #11151c; --surface2: #161b24; --text: #e6e9ef; --muted: #8a93a3; --line: #1f2632;
  --accent: #3b82f6; --good: #16c784; --bad: #ea3943; --warn-bg: #2a2110; --warn: #f0b90b;
  --good-bg: rgba(22, 199, 132, .12); --bad-bg: rgba(234, 57, 67, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; }
.num, td, .value, .ticker, .acct { font-variant-numeric: tabular-nums; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; padding: 0 14px; height: 48px; border-bottom: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 22px; }
.logo { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--good)); color: #fff; font-size: 11px; font-weight: 800; }
.ticker { display: flex; gap: 18px; overflow: hidden; flex: 1; font-size: 13px; }
.ticker span b { margin-right: 6px; }
.right { display: flex; gap: 10px; align-items: center; }
.acct { font-weight: 600; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 6px 14px; font-size: 13px; border-bottom: 1px solid var(--line); }

/* shell */
.shell { flex: 1; display: flex; min-height: 0; }
.side { width: 76px; flex-shrink: 0; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; padding: 8px 6px; gap: 4px; }
.side button { background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; font-size: 11px; border-radius: 8px; }
.side button .ico { font-size: 18px; line-height: 1; }
.side button:hover { background: var(--surface2); color: var(--text); }
.side button.active { background: var(--surface2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.content { flex: 1; min-width: 0; overflow: auto; padding: 12px; }
.subnav { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.subnav button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 12px; white-space: nowrap; }
.subnav button.active { color: var(--text); border-bottom-color: var(--accent); }

/* trading terminal */
.terminal { display: grid; gap: 8px; height: calc(100vh - 48px - 24px - 30px); min-height: 560px;
  grid-template-columns: 240px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr) 240px;
  grid-template-areas: "watch chart ticket" "dock dock ticket"; }
.pane { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.pane-h { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.watch { grid-area: watch; } .chartpane { grid-area: chart; } .ticket { grid-area: ticket; overflow-y: auto; } .dock { grid-area: dock; }
#watchlist { overflow-y: auto; }
.wl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wl:hover { background: var(--surface2); } .wl.sel { background: var(--surface2); box-shadow: inset 3px 0 0 var(--accent); }
.wl .sym { font-weight: 600; } .wl .px { text-align: right; font-weight: 600; } .wl .sub { color: var(--muted); font-size: 12px; } .wl .chg { text-align: right; font-size: 12px; }
#chart-head .title { font-size: 15px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 700; }
#chart-head .px { font-size: 15px; color: var(--text); letter-spacing: 0; }
#chart { flex: 1; min-height: 0; padding: 6px 8px 0; }
#chart svg { width: 100%; height: 100%; display: block; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); border-top: 1px solid var(--line); }
.stats div { padding: 8px 12px; border-right: 1px solid var(--line); font-size: 12px; } .stats div:last-child { border-right: 0; }
.stats span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.ticket .actions { display: grid; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#no-experiment { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.signal { margin: 10px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface2); }
.signal .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.side-buy { color: var(--good); font-weight: 700; } .side-sell { color: var(--bad); font-weight: 700; }
.signal .grid { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; margin-bottom: 8px; }
.signal .grid span:nth-child(odd) { color: var(--muted); }
.dock-tabs { display: flex; border-bottom: 1px solid var(--line); }
.dock-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 14px; font-size: 13px; }
.dock-tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
#dock { overflow: auto; flex: 1; }
#dock table th { position: sticky; top: 0; background: var(--surface); }
.empty { padding: 18px; color: var(--muted); text-align: center; font-size: 13px; }

/* generic */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; }
.signin { flex: 1; display: grid; place-items: center; }
.narrow { width: min(400px, 92vw); text-align: center; padding: 28px; }
.narrow form { margin-top: 16px; display: grid; gap: 10px; text-align: left; }
h2 { font-size: 15px; margin: 0 0 10px; } h3 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.between { justify-content: space-between; align-items: center; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0; }
input:focus, select:focus { outline: 1px solid var(--accent); }
button { font: inherit; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-weight: 500; }
button.ghost, button.secondary { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost:hover { border-color: var(--muted); }
button.danger { background: var(--bad); border-color: var(--bad); font-weight: 700; letter-spacing: .04em; }
button.buy { background: var(--good); border-color: var(--good); color: #04130c; font-weight: 700; }
button.wide { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpi { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 19px; font-weight: 600; margin-top: 4px; }
.pos { color: var(--good); } .neg { color: var(--bad); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: rgba(255, 255, 255, .015); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); }
.pill.good { color: var(--good); border-color: var(--good); background: var(--good-bg); } .pill.bad { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.turn { border-left: 3px solid var(--line); padding: 4px 10px; margin: 4px 0; font-size: 12px; }
.turn.objection { border-color: var(--bad); } .turn.revise, .turn.hold { border-color: var(--accent); } .turn.withdraw { border-color: var(--muted); }
details summary { cursor: pointer; }
.chart { width: 100%; height: 160px; color: var(--accent); }
.toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%); background: var(--surface2); border: 1px solid var(--line); color: var(--text); padding: 10px 16px; border-radius: 8px; max-width: 90vw; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); z-index: 10; }
.scroll { overflow-x: auto; }
.statusbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 4px 14px; height: 30px; overflow: hidden; border-top: 1px solid var(--line); background: var(--surface); font-size: 11px; flex-shrink: 0; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; border: 1px solid currentColor; }
.badge.real { color: var(--good); } .badge.synthetic { color: var(--warn); } .badge.historical { color: var(--accent); } .badge.sim { color: var(--muted); } .badge.stale { color: var(--bad); } .badge.off { color: var(--muted); }
.badge.paper { color: var(--warn); background: rgba(240, 185, 11, .1); }
tr.clickable { cursor: pointer; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.checks label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.problem { color: var(--bad); font-size: 12px; }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; } .meter > span { display: block; height: 100%; background: var(--accent); }
.status-ok { color: var(--good); } .status-limited { color: var(--warn); } .status-blocked { color: var(--bad); } .status-unknown { color: var(--muted); }
.ready-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.ready-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; }
.ready-item .head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 600; }
.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.delib { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
pre.small { white-space: pre-wrap; max-width: 420px; margin: 4px 0; }
code { font-size: 11px; color: var(--muted); }
.paper-zone { border: 1px dashed var(--warn); }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.kv { display: flex; flex-direction: column; gap: 2px; }

/* candles */
.cndl-up { stroke: var(--good); fill: var(--good); } .cndl-dn { stroke: var(--bad); fill: var(--bad); }
.gridline { stroke: var(--line); stroke-width: 1; } .axis { fill: var(--muted); font-size: 10px; }
.ma20 { stroke: var(--warn); fill: none; stroke-width: 1.2; } .ma50 { stroke: var(--accent); fill: none; stroke-width: 1.2; }
.vol-up { fill: rgba(22, 199, 132, .25); } .vol-dn { fill: rgba(234, 57, 67, .25); }

@media (max-width: 1100px) {
  .terminal { grid-template-columns: 200px minmax(0, 1fr); grid-template-rows: 420px auto 260px; grid-template-areas: "watch chart" "ticket ticket" "dock dock"; height: auto; }
}
@media (max-width: 700px) {
  .side { position: fixed; bottom: 0; left: 0; right: 0; width: auto; height: 58px; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); z-index: 5; padding: 4px; }
  .content { padding: 8px 8px 70px; }
  .terminal { grid-template-columns: 1fr; grid-template-rows: auto 340px auto 260px; grid-template-areas: "watch" "chart" "ticket" "dock"; }
  #watchlist { display: flex; overflow-x: auto; } .wl { min-width: 150px; border-right: 1px solid var(--line); }
  .ticker, #clock, .statusbar { display: none; }
}
.leg20 { fill: var(--warn); } .leg50 { fill: var(--accent); }
.signal .row button { flex: 1; padding: 7px 8px; }
@media (max-width: 700px) { #acct-equity, #signout, .top .badge.paper { display: none !important; } .wl .sym { white-space: nowrap; } }
/* portfolio */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.hero .big { font-size: 38px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hero-side { min-width: 260px; flex: 0 1 360px; display: grid; gap: 6px; }
.pane-h.flat { padding: 0 0 10px; border: 0; }
svg.area { width: 100%; height: 220px; display: block; }
svg.area .stroke { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
svg.area.up .stroke { stroke: var(--good); } svg.area.up .fill { fill: rgba(22, 199, 132, .12); }
svg.area.dn .stroke { stroke: var(--bad); } svg.area.dn .fill { fill: rgba(234, 57, 67, .12); }
.kpis { margin-bottom: 12px; }
details.card > summary { list-style: none; } details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸ "; color: var(--muted); } details.card[open] > summary::before { content: "▾ "; }
details.card[open] > summary { margin-bottom: 10px; }
/* research */
svg.hbars { width: 100%; height: auto; display: block; }
.hbar { fill: var(--accent); opacity: .8; }
.kpis.tight { grid-template-columns: repeat(3, 1fr); margin: 0; }
.kpis.tight .value.small { font-size: 13px; }
details.card > summary .pill { margin-left: 6px; }

/* ---------- AI autopilot home ---------- */
.ap-hero { display: grid; gap: 6px; }
.ap-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ap-hero .big { font-size: 40px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ap-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 12px; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); }
.ap-status.on { color: var(--good); border-color: var(--good); background: var(--good-bg); }
.ap-status.stopped { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.ap-status.idle { color: var(--warn); border-color: var(--warn); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ap-status.on .pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .ap-status.on .pulse { animation: none; } }
.ap-chart svg.area { height: 160px; }
.ap-actions { display: grid; grid-template-columns: minmax(0, 360px); gap: 8px; margin-top: 6px; }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { display: grid; gap: 4px; margin-bottom: 0; }
.tile .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tile .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
[data-goto-tile] { cursor: pointer; } [data-goto-tile]:hover { border-color: var(--accent); }
.ap-grid + .card { margin-top: 12px; }
.feed, .gates { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.gates li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.gate .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); margin-top: 3px; flex-shrink: 0; }
.gate.ok .dot { border-color: var(--good); background: var(--good); }
.mob, .mob-l { display: none !important; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  body { padding-top: env(safe-area-inset-top); }
  .top { height: 52px; gap: 8px; padding: 0 10px; }
  .top .brand { font-size: 15px; }
  .right { margin-left: auto; }
  #stop { padding: 8px 12px; }
  .side { height: calc(62px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); }
  .side button { flex: 1; min-height: 52px; font-size: 11px; }
  .side button.active { box-shadow: inset 0 3px 0 var(--accent); }
  .desk, .desk-l { display: none !important; }
  .mob { display: inline-block !important; } .mob-l { display: inline !important; }
  .content { padding: 10px 10px calc(76px + env(safe-area-inset-bottom)); }
  .card { padding: 12px; border-radius: 12px; overflow-x: auto; }
  .ap-hero .big { font-size: 34px; }
  .ap-actions { grid-template-columns: 1fr; }
  .ap-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile .value { font-size: 19px; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
  button { min-height: 40px; }
  input, select { font-size: 16px; min-height: 40px; } /* 16px stops iOS zooming into fields */
  .terminal { grid-template-rows: auto 300px auto auto; gap: 10px; }
  .dock { min-height: 260px; }
  .dock-tabs { overflow-x: auto; } .dock-tabs button { white-space: nowrap; padding: 10px 14px; }
  .wl { min-width: 130px; padding: 10px 12px; }
  .subnav button { padding: 10px 12px; }
  .hero .big { font-size: 32px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  th, td { padding: 8px; white-space: nowrap; }
  td.small { white-space: normal; min-width: 180px; }
}
@media (max-width: 700px) {
  .wl { flex: 0 0 auto; grid-template-columns: auto auto; min-width: 0; gap: 2px 14px; }
  .banner { font-size: 12px; padding: 6px 10px; }
}

/* ================= polish v2: app shell, landing, nav icons ================= */
:root { --surface: #10141b; --surface2: #171c25; --line: #212836; --radius: 14px; }
body { -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
.card, .pane { border-radius: var(--radius); background: linear-gradient(180deg, rgba(255,255,255,.018), rgba(255,255,255,0) 40%), var(--surface); }
.kpi, .tile { border-radius: 12px; }
button { border-radius: 10px; transition: transform .08s ease, filter .15s ease, background .15s ease; }
button:active:not(:disabled) { transform: scale(.98); filter: brightness(.95); }
.content > div[data-panel]:not([hidden]) { animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .content > div[data-panel] { animation: none !important; } }

.logo-img { width: 26px; height: 26px; border-radius: 7px; display: block; }
.brand { gap: 9px; }
svg.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.side button { gap: 4px; }
.side button.active { color: #fff; }
.side button.active svg.ico { stroke: var(--accent); }
.stopbtn { display: inline-flex; align-items: center; gap: 6px; }
.stopbtn svg.ico { width: 14px; height: 14px; fill: currentColor; stroke: none; }

/* landing / sign-in */
.signin { background: radial-gradient(1200px 600px at 50% -10%, rgba(59,130,246,.22), transparent 60%), radial-gradient(800px 500px at 100% 110%, rgba(22,199,132,.14), transparent 60%), var(--bg); min-height: 100vh; min-height: 100dvh; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.landing { width: min(420px, 100%); text-align: center; display: grid; gap: 14px; justify-items: center; }
.landing-logo { width: 84px; height: 84px; border-radius: 22px; box-shadow: 0 12px 40px rgba(59,130,246,.35); }
.landing h1 { margin: 4px 0 0; font-size: 34px; letter-spacing: -.02em; }
.tagline { margin: 0; font-size: 17px; color: var(--muted); }
.selling { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; text-align: left; width: 100%; }
.selling li { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot.good { background: var(--good); } .dot.accent { background: var(--accent); } .dot.warn { background: var(--warn); }
#signin-form { width: 100%; display: grid; gap: 10px; text-align: left; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; font-size: 16px; font-weight: 600; background: #fff; color: #1f1f1f; border-color: #fff; }
.gbtn svg.g { width: 20px; height: 20px; }
.fineprint { font-size: 11.5px; color: var(--muted); max-width: 340px; margin: 0; }
.center { text-align: center; }

/* "More" menu + back bar */
.menu { padding: 4px 0; }
.menu-item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--text); padding: 14px 16px; text-align: left; font-weight: 400; }
.menu-item:last-child { border-bottom: 0; }
.menu-item > span:first-child { display: grid; gap: 2px; }
.menu-item .chev { color: var(--muted); font-size: 22px; line-height: 1; }
.backbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.backbar .back { padding: 6px 12px; min-height: 36px; }
#backtitle { font-weight: 600; font-size: 16px; }

@media (max-width: 700px) {
  .top { background: rgba(16,20,27,.86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); }
  #acct-equity { display: inline !important; font-size: 13px; }
  #acct-equity[hidden] { display: none !important; }
  .stopbtn { padding: 6px 12px; min-height: 34px; font-size: 13px; }
  .banner { margin: 8px 10px 0; border-radius: 10px; border: 1px solid rgba(240,185,11,.3); }
  .side { background: rgba(16,20,27,.92); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); }
  .side button { background: none !important; box-shadow: none !important; font-size: 10.5px; color: var(--muted); }
  .side button.active { color: var(--text); }
  .side button.active svg.ico { stroke: var(--accent); }
  .side button.active::before { content: ""; position: absolute; }
  .menu-item { min-height: 58px; }
}
.sb-form { width: 100%; display: grid; gap: 10px; }
.sb-form input { width: 100%; min-height: 48px; font-size: 16px; padding: 0 14px; border-radius: 12px; }
.big-btn { min-height: 50px; font-size: 16px; font-weight: 600; width: 100%; }
.sb-alt { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sb-alt button { flex: 1; min-height: 42px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.moods { display: flex; flex-wrap: wrap; gap: 8px; }
.mood { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }

/* ================= CompoundX brand v1 =================
   Ink (#0F1B2D) ground, Compound Gold (#E8B44C) for the brand and the one primary action per screen,
   gain/loss kept as separate semantic colours. Fraunces (optical-size serif) carries the brand: wordmark,
   headings and the big money figures. IBM Plex Sans carries the interface, with tabular figures.
   Labels are sentence case. The compounding curve is the brand mark. */
@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("/fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
:root {
  --ink: #0f1b2d; --ink-2: #14233a; --ink-3: #1b2d48; --rule: #263a58; --paper: #eef1f5; --mist: #8d9bb2;
  --gold: #e8b44c; --gold-deep: #c9952f; --gold-wash: rgba(232, 180, 76, .12);
  --gain: #34c38f; --loss: #f06a5f;
  --bg: var(--ink); --surface: var(--ink-2); --surface2: var(--ink-3); --line: var(--rule); --text: var(--paper); --muted: var(--mist);
  --good: var(--gain); --bad: var(--loss); --good-bg: rgba(52, 195, 143, .12); --bad-bg: rgba(240, 106, 95, .12);
  --accent: var(--gold);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  font-family: "Plex", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14.5px; line-height: 1.45;
}
body { font-feature-settings: "tnum" 1; }

/* type: serif for brand moments, never for dense data */
h1, h2, .landing h1, .brand span, #backtitle, .menu-item strong { font-family: var(--serif); font-optical-sizing: auto; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--paper); }
.ap-hero .big, .hero .big, .tile .value, .kpi .value { font-family: var(--serif); font-optical-sizing: auto; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.ap-hero .big { font-size: 48px; }
.brand span { font-size: 19px; font-weight: 600; }

/* sentence-case labels; quiet chrome */
.pane-h, .kpi .label, .tile .label, th { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 500; }
.pane-h { color: var(--paper); font-size: 14px; font-weight: 600; }
.badge { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11.5px; border-radius: 999px; padding: 2px 9px; }
.ap-status { letter-spacing: 0; font-size: 13px; }

/* primary action = gold with ink text; everything else stays quiet */
button { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 600; }
button:hover:not(:disabled) { background: #f0c15f; }
button.ghost, button.secondary { background: transparent; color: var(--paper); border-color: var(--rule); }
button.ghost:hover:not(:disabled), button.secondary:hover:not(:disabled) { background: var(--ink-3); }
button.danger { background: var(--loss); border-color: var(--loss); color: #fff; letter-spacing: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input, select, textarea { background: var(--ink); border: 1px solid var(--rule); color: var(--paper); border-radius: 10px; }
.side button.active svg.ico, .side button.active { color: var(--gold) !important; stroke: var(--gold); }
.side button.active span { color: var(--paper); }
.subnav button.active, .dock-tabs button.active { color: var(--paper); border-bottom-color: var(--gold); }
.gbtn { background: #fff; border-color: #fff; color: #1f1f1f; }
.ap-status.on { color: var(--gain); }

/* surfaces: flat ink panels, hierarchy by tone not by shadow */
.card, .pane { background: var(--ink-2); border-color: var(--rule); }
.tile, .kpi { background: var(--ink); }
.top { background: var(--ink); border-bottom-color: var(--rule); }
a { color: var(--gold); }

/* landing: the compounding curve draws once */
.signin { background: var(--ink); position: relative; overflow: hidden; }
.curve-hero { position: absolute; inset: auto -10% 0 -10%; height: 32vh; pointer-events: none; opacity: .55; }
.curve-hero path.line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s cubic-bezier(.6, 0, .2, 1) .2s forwards; }
.curve-hero path.area { fill: url(#cxfade); opacity: 0; animation: fadein-a 1.2s ease 1.8s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein-a { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .curve-hero path.line { animation: none; stroke-dashoffset: 0; } .curve-hero path.area { animation: none; opacity: 1; } }
.landing { position: relative; z-index: 1; }
.landing h1 { font-size: 44px; font-weight: 600; }
.tagline { font-family: var(--serif); font-style: normal; font-size: 19px; color: var(--paper); opacity: .85; }
.selling li { background: rgba(20, 35, 58, .7); border-color: var(--rule); }
.dot.good { background: var(--gain); } .dot.accent { background: var(--gold); } .dot.warn { background: var(--mist); }
.landing-logo { box-shadow: none; }
/* landing scrolls on short screens; content centred when it fits */
.signin { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; align-items: center; place-items: initial; }
.signin .landing { margin: auto 0; padding-bottom: 12vh; }
/* order ticket */
.ot { display: grid; gap: 10px; padding: 12px; border-bottom: 1px solid var(--rule); }
.ot-side { display: grid; grid-template-columns: 1fr 1fr; background: var(--ink); border: 1px solid var(--rule); border-radius: 10px; padding: 3px; gap: 3px; }
.ot-tab { background: transparent; border: 0; color: var(--mist); min-height: 38px; }
.ot-tab.active[data-side="buy"] { background: var(--gain); color: var(--ink); }
.ot-tab.active[data-side="sell"] { background: var(--loss); color: #fff; }
.ot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ot-head strong { font-family: var(--serif); font-size: 18px; }
.ot label { display: grid; gap: 4px; }
.ot input, .ot select { min-height: 42px; padding: 0 12px; font-size: 16px; width: 100%; }
.ot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ot-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ot-quick button { min-height: 36px; padding: 4px; }
.sell-btn { background: var(--loss) !important; border-color: var(--loss) !important; color: #fff !important; }
.side button.active { background: var(--ink-3) !important; box-shadow: inset 3px 0 0 var(--gold); }
@media (max-width: 700px) { .side button.active { background: none !important; box-shadow: none; } }
.ot-row:has(#ot-limit-wrap[hidden]) { grid-template-columns: 1fr; }
