/* Quant Futures · Paper — calm, spacious, premium. Dark with QF gold + green accents. */
:root {
  /* navy-tinted dark + warm amber, matching the Quant Plot sibling app */
  --bg: #0b0e15;
  --bg-2: #0e1219;
  --card: #151a24;
  --card-2: #1a2030;
  --border: #242b39;
  --border-soft: #1b212c;
  --text: #e8eaee;
  --text-dim: #aab0bd;
  --muted: #717784;
  --muted-2: #4a5160;
  --green: #46c08a;
  --green-soft: rgba(70,192,138,.12);
  --red: #e5575b;
  --red-soft: rgba(229,87,91,.12);
  --gold: #f2a93c;
  --gold-bright: #ffc24d;
  --gold-soft: rgba(242,169,60,.10);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(1100px 560px at 50% -8%, #141a28 0%, rgba(20,26,40,0) 58%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Clear the fixed bottom tabbar (nav height + phone safe-area) so the last
     card is never hidden underneath it. */
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px; background: linear-gradient(180deg, var(--bg) 70%, transparent);
}
/* Quant Recce / Quant Platforms lockup: emblem · bold-name + grey-name · divider · subtitle */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-glyph { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--gold-bright);
  stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 5px rgba(255,194,77,.45)); }
.brand-glyph circle { fill: var(--gold-bright); stroke: none; }
.brand-name { font-size: 21px; font-weight: 500; color: #8b909c; white-space: nowrap; }
.brand-name b { font-weight: 800; color: var(--text); }
.brand-sep { width: 1px; height: 22px; background: var(--border); margin: 0 3px; }
.brand-sub { font-size: 14px; color: var(--muted); white-space: nowrap; }

.topbar-right { display: flex; align-items: center; gap: 13px; }
.parent-tag { font-size: 12px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2);
  flex: none; transition: background .2s; }
.conn-dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.conn-dot.bad { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

@media (max-width: 600px) {
  .brand-sep, .brand-sub, .parent-tag { display: none; }
  .brand-name { font-size: 18px; }
}
.iconbtn { background: none; border: none; padding: 4px; cursor: pointer; color: var(--muted); }
.iconbtn svg { width: 21px; height: 21px; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn:hover { color: var(--text-dim); }

/* ---- layout ---- */
.view { padding: 4px 16px 16px; max-width: 760px; margin: 0 auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 6px 2px 2px; }
.muted { color: var(--muted); } .dim { color: var(--text-dim); }
.pos { color: var(--green); } .neg { color: var(--red); } .flat { color: var(--text-dim); }
.mono { font-family: var(--mono); }

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.card.tight { padding: 14px 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* big hero number */
.hero-label { font-size: 11px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); }
.hero-num { font-size: 46px; font-weight: 300; letter-spacing: -.01em;
  margin: 8px 0 6px; font-variant-numeric: tabular-nums; line-height: 1; }
.hero-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mid-label { font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); }
.mid-num { font-size: 28px; font-weight: 300; margin-top: 8px;
  font-variant-numeric: tabular-nums; }

/* status pill row */
.statusbar { display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none;
  box-shadow: 0 0 0 4px var(--green-soft); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.status-main { font-weight: 600; font-size: 14px; color: var(--green); }
.status-main.bad { color: var(--red); }
.status-meta { margin-left: auto; font-family: var(--mono); font-size: 12px;
  color: var(--muted); letter-spacing: .02em; }

/* banner (connection lost etc.) */
.alert { border: 1px solid rgba(229,87,91,.4); background: var(--red-soft);
  color: #ffb9ba; border-radius: var(--radius-sm); padding: 13px 16px; font-size: 13.5px;
  line-height: 1.45; }

/* strategy + position cards */
.s-card { background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; }
.s-card.active { border-color: rgba(70,192,138,.45); box-shadow: 0 0 0 1px rgba(70,192,138,.12); }
.s-card.off { opacity: .58; }
.s-head { display: flex; align-items: center; justify-content: space-between; }
.s-name { font-weight: 700; font-size: 16px; }
.s-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 3px 7px;
  border-radius: 6px; }
.s-tag.on { color: var(--green); background: var(--green-soft); border: 1px solid rgba(70,192,138,.3); }
.s-tag.paused { color: var(--muted); border: 1px solid var(--border); }
.s-num { font-size: 26px; font-weight: 300; margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.s-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.s-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 14px; }
canvas { width: 100%; display: block; }
.feed-foot { text-align: center; font-size: 11.5px; color: var(--muted-2);
  padding: 4px 0 2px; letter-spacing: .02em; }

/* ---- lists / tables (calm) ---- */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-top: 1px solid var(--border-soft); }
.li:first-child { border-top: none; }
.li-main { font-weight: 600; font-size: 14px; }
.li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.li-right { text-align: right; font-variant-numeric: tabular-nums; }

/* A list that scrolls inside its own box instead of the whole page (e.g. the
   live received-candles feed on Diagnostics). Rows fade under a sticky header. */
.scrollbox { max-height: 62vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; }
.scrollbox .li:first-child { border-top: none; }
.pill { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 7px;
  border-radius: 6px; border: 1px solid var(--border); color: var(--muted); }
.pill.long { color: var(--green); background: var(--green-soft); border-color: rgba(70,192,138,.3); }
.pill.short { color: var(--red); background: var(--red-soft); border-color: rgba(229,87,91,.3); }
.pill.warn { color: var(--gold); border-color: rgba(232,192,96,.35); background: var(--gold-soft); }

/* ---- forms (menu / settings / backtest) ---- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; }
.field .help { font-size: 12px; color: var(--muted-2); }
input, select { background: var(--card-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; width: 100%; }
input:focus, select:focus { outline: none; border-color: rgba(232,192,96,.4); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
button.primary { background: var(--gold); color: #1a1402; border: none; border-radius: 11px;
  padding: 13px 18px; font-weight: 700; font-size: 15px; cursor: pointer; width: 100%; }
button.ghost { background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 11px; padding: 13px 16px; font-weight: 600; font-size: 14px; cursor: pointer;
  width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; }
button.ghost:hover { border-color: rgba(232,192,96,.35); }
button:disabled { opacity: .55; cursor: progress; }
.chev { color: var(--muted); }

/* result strip for the concept backtest */
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; }
.metric { background: var(--card); padding: 13px 14px; }
.metric .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.metric .v { font-size: 18px; font-weight: 400; margin-top: 5px; font-variant-numeric: tabular-nums; }
code.snap { display: block; white-space: pre-wrap; word-break: break-word; background: var(--card-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 11px;
  color: var(--muted); font-family: var(--mono); max-height: 320px; overflow: auto; }
details > summary { cursor: pointer; }
.spinner { color: var(--muted); padding: 18px 0; text-align: center; }

/* ---- bottom nav ---- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; justify-content: space-around; background: rgba(10,11,13,.94);
  border-top: 1px solid var(--border); backdrop-filter: blur(10px);
  padding: 9px 0 calc(8px + env(safe-area-inset-bottom));
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--muted-2); text-decoration: none; cursor: pointer; padding: 4px 22px; }
.tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab span { font-size: 11px; font-weight: 500; }
.tab:hover { color: var(--muted); }
.tab.active { color: var(--green); }

@media (min-width: 820px) {
  .view { max-width: 720px; }
}

/* ---- landing (Quant Platforms front door) ---- */
body.landing { padding-bottom: 0; }
body.landing .topbar, body.landing .tabbar { display: none; }
body.landing .view { max-width: none; padding: 0; margin: 0; }

.lp { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.lp-main { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; gap: 6px;
  padding: 0 22px calc(60px + env(safe-area-inset-bottom)); }

.lp-title { margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: clamp(26px, 5.5vw, 40px); font-weight: 400;
  letter-spacing: -.022em; color: #8b909c; line-height: 1;
  display: flex; align-items: center; justify-content: center; gap: .34em; }
.lp-title b { font-weight: 700; color: var(--text); }
.lp-mark { display: inline-flex; flex: none; }
.lp-mark .brand-glyph { width: .82em; height: .82em;
  filter: drop-shadow(0 0 14px rgba(255,194,77,.55)); }
.lp-sub { margin: 14px 0 30px; font-size: 14px; letter-spacing: .02em;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--muted); }

.lp-card { width: 100%; max-width: 420px; display: flex; flex-direction: column;
  gap: 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; }
.lp-card .primary { font-size: 16px; padding: 15px 18px; }

.lp-status { display: flex; align-items: center; gap: 9px; padding: 2px 2px;
  font-size: 12.5px; color: var(--text-dim); }
.lp-status .dot { width: 8px; height: 8px; box-shadow: 0 0 0 3px var(--green-soft); }
.lp-status .dot.idle { background: var(--muted-2); box-shadow: none; }
.lp-status-txt { font-variant-numeric: tabular-nums; }
.lp-acct { margin-left: auto; font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; }

.lp-links { display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--border-soft); padding-top: 14px; }
.lp-links .ghost { font-size: 13.5px; padding: 12px 14px; }

.lp-foot { margin-top: 26px; font-size: 11.5px; color: var(--muted-2);
  letter-spacing: .03em; }

/* ---- trade chart modal ---- */
.li.tappable { cursor: pointer; transition: background .12s; }
.li.tappable:hover { background: var(--card-2); }
.li.tappable .chev { color: var(--muted-2); margin-left: 8px; }
.ghost.danger { color: var(--red); }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; padding: 16px;
  background: rgba(6,9,14,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; }
.modal { width: 100%; max-width: 580px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; }
.modal-title { font-weight: 700; font-size: 15px; }
.modal-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px;
  font-variant-numeric: tabular-nums; }
.trade-canvas { width: 100%; height: 320px; display: block;
  background: var(--bg-2); border-radius: var(--radius-sm); }
.modal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px;
  font-size: 11.5px; color: var(--muted); }
.modal-legend i { display: inline-block; width: 11px; height: 2px;
  vertical-align: middle; margin-right: 5px; border-radius: 2px; }
