/* tradebot — ink-blue surface, phosphor-amber system accent.
   Color discipline: green/red are reserved for money and live-mode danger;
   amber means "the system is alive". All numerals are mono, tabular. */

:root {
  --ink: #0E1420;
  --panel: #151D2C;
  --panel-2: #1B2436;
  --line: #25304A;
  --text: #E9EEF8;
  --muted: #8A97B4;
  --amber: #FFB454;
  --amber-dim: #6B4F23;
  --profit: #3DD68C;
  --loss: #F4587A;
  --font-ui: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

/* ---- topbar ---- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-mono); font-size: 17px; letter-spacing: .02em; display: flex; align-items: center; gap: 9px; }
.brand b { color: var(--amber); font-weight: 600; }
.brand-tick { width: 9px; height: 9px; background: var(--amber); display: inline-block; border-radius: 2px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a {
  padding: 6px 12px; border-radius: 6px; color: var(--muted);
  font-size: 14px;
}
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--ink); background: var(--amber); font-weight: 600; }
.userchip { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

/* ---- layout ---- */
.view { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }
.view-head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 22px; }
.view-head h1 { font-size: 22px; font-weight: 600; margin: 0; flex: 1; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}

/* ---- cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; display: block;
}
a.card:hover { border-color: var(--amber-dim); background: var(--panel-2); }
.card h3 { margin: 0 0 2px; font-size: 16px; font-weight: 600; }
.card .meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.card .pnl-row { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0; font-size: 13px; }
.card .pnl-row .lbl { color: var(--muted); }

/* signature: the heartbeat — the scheduler's clock, made visible */
.heartbeat {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.heartbeat .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.heartbeat.idle .dot { background: var(--line); }
.heartbeat .t { color: var(--amber); }
@media (prefers-reduced-motion: no-preference) {
  .heartbeat:not(.idle) .dot { animation: pulse 2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .25; } }
}

/* ---- badges / pills ---- */
.badge {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--muted); vertical-align: middle;
}
.badge.active { color: var(--amber); border-color: var(--amber-dim); }
.badge.live { color: var(--loss); border-color: var(--loss); }
.pill { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; }
.pill.buy { background: rgba(61,214,140,.14); color: var(--profit); }
.pill.sell { background: rgba(244,88,122,.14); color: var(--loss); }
.pill.hold { background: var(--panel-2); color: var(--muted); }

.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.profit { color: var(--profit); }
.loss { color: var(--loss); }
.muted { color: var(--muted); }

/* ---- tables ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { font-size: 13px; margin: 0 0 12px; font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 6px 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; }

/* ---- stats row ---- */
.stats { display: flex; gap: 28px; flex-wrap: wrap; margin: 16px 0 20px; }
.stat .eyebrow { margin-bottom: 3px; }
.stat .v { font-family: var(--font-mono); font-size: 19px; font-variant-numeric: tabular-nums; }

/* ---- forms ---- */
label.f { display: block; margin-bottom: 14px; }
label.f .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
label.f .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; opacity: .8; }
input, select {
  width: 100%; background: var(--ink); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  font: inherit; font-family: var(--font-mono); font-size: 14px;
}
input:focus, select:focus { border-color: var(--amber); outline: none; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.form-cols .full { grid-column: 1 / -1; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button {
  background: transparent; color: var(--muted); border: 0; padding: 7px 14px;
  font: inherit; font-family: var(--font-mono); font-size: 13px; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--amber); color: var(--ink); font-weight: 600; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

/* ---- buttons ---- */
.btn {
  display: inline-block; background: var(--amber); color: var(--ink);
  border: 0; border-radius: 7px; padding: 8px 16px; font: inherit;
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn.ghost:hover { border-color: var(--muted); filter: none; }
.btn.danger { background: transparent; color: var(--loss); border: 1px solid var(--loss); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; gap: 10px; }

/* ---- misc ---- */
.empty { text-align: center; color: var(--muted); padding: 56px 0; }
.empty .big { font-size: 17px; color: var(--text); margin-bottom: 6px; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; max-width: 380px;
}
.toast.err { border-left-color: var(--loss); }
.tv-wrap { height: 420px; border-radius: 8px; overflow: hidden; }
.quota { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.quota.full { color: var(--amber); border-color: var(--amber); }
/* ---- clickable trade rows + detail modal ---- */
.trade-row { cursor: pointer; }
.trade-row:hover td { background: var(--panel-2); }
h2 .hint { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; text-transform: none; color: var(--muted); font-weight: 400; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 1000; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 520px; max-height: 85vh; overflow: auto; }
.modal-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 12px; font-family: var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.modal-x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 6px 18px 18px; }
.modal-body h3 { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 0 6px; font-family: var(--font-mono); }
table.kv td { padding: 5px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.kv td:first-child { width: 46%; }
.equity { width: 100%; height: 150px; display: block; margin: 4px 0 2px; }
.pricechart { width: 100%; height: auto; display: block; margin: 4px 0 2px; }
.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tier.card.current { border-color: var(--amber); }
.tier .name { font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px; }
.tier ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.back { font-family: var(--font-mono); font-size: 12px; color: var(--muted); display: inline-block; margin-bottom: 10px; }
.back:hover { color: var(--amber); }
.warnbox { border: 1px solid var(--amber-dim); background: rgba(255,180,84,.07); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }

@media (max-width: 760px) {
  .form-cols { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .stats { gap: 18px; }
}
