/* TradeOS dashboard — design tokens mirrored from capitalos.cloudbennett.com */
/* build: v90 */
.sep { color: var(--faint); }
:root {
  color-scheme: light dark;
  --bg:      light-dark(#fafafb, #0a0b0d);
  --panel:   light-dark(#ffffff, #101216);
  --panel-2: light-dark(#f5f6f8, #15181d);
  --line:    light-dark(#e8eaee, #21252c);
  --line-2:  light-dark(#dfe1e6, #2b2f37);
  --text:    light-dark(#14161a, #e6e8ec);
  --muted:   light-dark(#6a7079, #767d88);
  --faint:   light-dark(#a3a8b0, #474d56);
  --btc:     #f7931a;
  --green:   light-dark(#1a7f37, #3fb950);
  --red:     light-dark(#cf222e, #f0726a);
  --amber:   light-dark(#bf8700, #d29922);
  --blue:    light-dark(#2f6fdb, #4493f8);
  --purple:  light-dark(#7c5cff, #a78bfa);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --r: 8px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 80px; }

/* Header */
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 22px; font-weight: 700;
  letter-spacing: -0.02em; }
.ver { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 6px; align-self: center; letter-spacing: 0; }
.word { background: linear-gradient(180deg, var(--text), var(--muted));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.sub { color: var(--muted); font-size: 12.5px; }

/* Minimal header: brand · macro stats · refresh ring — no tiles/borders/background. */
.topbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.macro { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; flex: 1; }
.macro-item { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
.macro-item i { font-style: normal; color: var(--muted); margin-right: 5px;
  font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase; }
.macro-item.closed { opacity: 0.4; }

/* Refresh countdown ring: fills over the cycle, flashes green on new data, resets. */
.refresh { background: none; border: none; padding: 0; display: inline-flex; cursor: default; }
.ring { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 2.5; }
.ring-prog { fill: none; stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round;
  stroke-dasharray: 50.27; stroke-dashoffset: 50.27; animation: ringfill 60s linear forwards; }
@keyframes ringfill { from { stroke-dashoffset: 50.27; } to { stroke-dashoffset: 0; } }
.refresh.flash .ring-prog { stroke: var(--green); animation: none; stroke-dashoffset: 0; }

/* DRY / LIVE ledger — a compact grid (rows: DRY/LIVE · cols: Bankroll/Free/Positions/P&L/Realized/WR). */
.ledger-wrap { overflow-x: auto; margin: 18px 0 4px; padding-top: 14px;
  border-top: 1px solid var(--line); }
.ledger-table { width: 100%; }
.ledger-table th, .ledger-table td { border-bottom: none; }
/* Right-align every data column (incl. Bankroll); higher specificity than the global
   "first two columns left" rule so Bankroll lines up with the rest. */
.ledger-table th:nth-child(n+2), .ledger-table td:nth-child(n+2) { text-align: right; }
.ledger-table th:first-child, .ledger-table td:first-child { text-align: left; padding-left: 0; width: 1%; }
/* Column labels styled identically to the header macro labels (CRYPTO MCAP / BTC DOM). */
.ledger-table thead th { font-family: var(--mono); font-size: 9px; font-weight: 400;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ledger-table td { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
#dry-pnl, #live-pnl { font-weight: 700; }
.ledger-table tbody tr.dim td { color: var(--muted); }
.tag { display: inline-block; min-width: 44px; text-align: center;
  font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.09em;
  padding: 2px 7px; border-radius: 4px; }
.tag-dry { color: var(--muted); background: var(--panel-2); }
.tag-live { color: var(--green); background: color-mix(in srgb, var(--green) 13%, transparent); }

/* Number-change flash: green when a value rises, red when it falls. */
@keyframes flash-up { from { background: color-mix(in srgb, var(--green) 38%, transparent); } to { background: transparent; } }
@keyframes flash-dn { from { background: color-mix(in srgb, var(--red) 38%, transparent); } to { background: transparent; } }
.flash-up { animation: flash-up 0.9s ease-out; border-radius: 4px; }
.flash-dn { animation: flash-dn 0.9s ease-out; border-radius: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin: 18px 0 0; border-bottom: 1px solid var(--line);
  flex-wrap: wrap; }
.tab {
  appearance: none; background: none; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.01em; padding: 7px 12px; border-radius: 7px 7px 0 0; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: none; transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: var(--text); background: var(--panel); border-color: var(--line);
  border-bottom: 1px solid var(--panel); }
.tab-ico { font-size: 12px; margin-right: 2px; color: var(--muted); }
.tab.active .tab-ico { color: inherit; }
/* Open-trade count badge per tab. Hidden when zero; grey = paper trades, white = live. */
.tab-count { display: none; margin-left: 6px; padding: 0 5px; border-radius: 8px;
  font-size: 10px; font-weight: 700; line-height: 16px; min-width: 16px; text-align: center;
  background: var(--panel-2); border: 1px solid var(--line); }
.tab-count.show { display: inline-block; }
.tab-count.paper { color: var(--muted); }                     /* paper: grey */
.tab-count.live { color: var(--text); border-color: var(--line-2); }  /* live: white */
.bias-arr { font-size: 10px; font-weight: 800; margin-left: 1px; vertical-align: 1px; }
.tab-panel[hidden] { display: none; }
.tab-panel { margin-top: 16px; }

/* Index Perps card (AI / China / Defense / Tech … US index perps) — no directional dot,
   and the numeric Price column is right-aligned like the other tables. */
#index-card thead th:nth-child(2), #index-card tbody td:nth-child(2) { text-align: right; }
.chip b { font-family: var(--mono); color: var(--text); font-weight: 600; }
.chip b.pos { color: var(--green); }
.chip b.neg { color: var(--red); }
tbody td.live { font-weight: 700; color: var(--text); }
tbody td.pnl { font-weight: 700; }
/* Trade P&L status dot beside the ticker: green up · red down · white break-even. */
.tdot { font-size: 8px; margin-left: 6px; vertical-align: 1px; }
.tdot.even { color: var(--text); }
.chip.regime b { color: var(--blue); }
.chip.regime b.pos { color: var(--green); }
.chip.regime b.neg { color: var(--red); }

/* Cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px 18px; margin-top: 18px;
}
.card h2 { margin: 0 0 12px; font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

.empty { color: var(--faint); font-size: 12.5px; }

/* Action chips */
.act { display: inline-block; min-width: 52px; text-align: center; font-size: 11px;
  font-weight: 650; letter-spacing: 0.03em; padding: 2px 8px; border-radius: 5px;
  font-family: var(--sans); }
.act.BUY   { color: light-dark(#0c5c25, #b8f5cb); background: light-dark(#e3f6e9, #11321d); }
.act.WATCH { color: light-dark(#8a6200, #ffd98a); background: light-dark(#fdf2da, #322611); }
.act.HOLD  { color: var(--muted); background: var(--panel-2); }
.act.EXIT  { color: light-dark(#a40e19, #ffc4c0); background: light-dark(#fbe6e7, #331616); }
.act.SHORT { color: light-dark(#a40e19, #ffc4c0); background: light-dark(#fbe6e7, #331616); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
thead th {
  text-align: right; font-weight: 600; color: var(--muted); font-size: 9px;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 0 10px 8px;
  border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
  font-family: var(--mono); text-align: right; }
/* Pair is the only text column — it aligns left; all numeric columns align right. */
thead th:first-child, tbody td:first-child { text-align: left; }
/* Grey out the secondary numbers (entry score / entry price). */
tbody td.mut { color: var(--muted); }
/* Consistent Pair/Name column widths so the Name column lines up vertically across the
   stacked Trades and Signals tables. */
tbody td.pair { min-width: 104px; }
tbody td.name { min-width: 86px; }
.paper-h3 { margin: 16px 0 8px; font-family: var(--mono); font-size: 9.5px; color: var(--faint);
  font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
tbody tr:hover { background: var(--panel-2); }
tbody td.pair { font-weight: 600; }
tbody td.pair a { color: inherit; text-decoration: none; }
tbody td.pair a:hover { text-decoration: underline; text-decoration-color: var(--faint);
  text-underline-offset: 2px; }
tbody td.name { font-family: var(--sans); color: var(--muted); }
tbody td.act-cell { font-family: var(--sans); }
.pos { color: var(--green); }
.neg { color: var(--red); }
tbody tr.dim { opacity: 0.42; }
tbody tr.dim:hover { opacity: 0.7; }
/* Side marker before the pair: green L = long, red S = short. */
tbody td.pair::before { content: "L"; color: var(--green); font-family: var(--mono);
  font-weight: 700; font-size: 11px; margin-right: 8px;
  position: relative; top: -1px; vertical-align: middle; }
tbody td.pair.short::before { content: "S"; color: var(--red); }
/* Index & commodity signal rows aren't long/short calls (they use the Bias column) — no marker. */
#index-card td.pair::before, #comm-card td.pair::before { content: none; }
.fpass { color: var(--muted); font-weight: 700; font-size: 11px; margin-left: 5px; }
/* Win/loss marker after a closed-trade ticker: green ✓ = profit, red ✗ = loss. */
.wl { font-weight: 700; font-size: 11px; margin-left: 6px; }
/* Small white arrow after the live price — shows mark above/below entry. */
.parr { color: var(--text); font-size: 8px; vertical-align: 1px; font-weight: 400; }
.sub { color: var(--faint); font-size: 0.85em; }
/* Scoring-formula factor cells: strong / neutral / weak. */
.s-hi { color: var(--green); font-weight: 600; }
.s-mid { color: var(--text); font-weight: 600; }
.s-lo { color: var(--red); font-weight: 600; }
.legend { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* Scoring formula */
.formula { font-size: 13px; color: var(--muted); }
.eq { display: block; font-family: var(--mono); color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; font-size: 12.5px;
  line-height: 1.6; margin-bottom: 16px; overflow-x: auto; white-space: nowrap; }
.factors { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 28px; }
.factors li { padding: 4px 0; break-inside: avoid; }
.factors b { color: var(--text); font-weight: 600; }
.factors .w { font-family: var(--mono); color: var(--blue); margin-left: 4px; }
.thresholds { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; color: var(--faint); }

footer { color: var(--faint); font-size: 11.5px; margin-top: 26px; text-align: center; }
footer a { color: var(--muted); }

@media (max-width: 640px) {
  .factors { columns: 1; }
  .brand { font-size: 18px; }
  .tab-ico { display: none; }   /* save horizontal space — labels only on mobile */
  /* Keep all tabs on a single line: drop the icons, shrink padding/label, no wrapping
     (horizontal-scroll as a fallback if a viewport is truly tiny). */
  .tabs { flex-wrap: nowrap; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 7px 7px; font-size: 11px; white-space: nowrap; }
  .tab-count { margin-left: 4px; padding: 0 4px; }
  /* Header: brand + ring on the first line, macro stats wrap to their own row below. */
  .topbar { gap: 10px 16px; }
  .refresh { order: 2; margin-left: auto; }
  .macro { order: 3; flex: 0 0 100%; gap: 10px 16px; }
  /* Ledger grid: tighter so the 6 columns fit (horizontal-scroll fallback if not). */
  .ledger-table td, .ledger-table th { font-size: 11px; }
  .ledger-table th, .ledger-table td { padding-left: 6px; padding-right: 6px; }
}

/* Full asset name shown to the right of a ticker symbol. */
.sym-name { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--muted);
  margin-left: 6px; white-space: nowrap; letter-spacing: 0; }
