/* TTJ Prime Terminal — professional design standard (Roadmap §6).
   Terminal-grade: restrained surfaces, hairline borders, tabular numerals,
   precise motion only. No decorative elements, no emojis, no display type. */
:root {
  --bg: #131722;
  --panel: #1e2530;
  --panel-2: #171c26;
  --border: rgba(255, 255, 255, 0.07);
  --text: #d1d4dc;
  --text-dim: #787b86;
  --accent: #a8d400;
  --long: #089981;
  --short: #f23645;
  --warn: #ff9800;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button { font-family: var(--sans); cursor: pointer; }
.mono { font-family: var(--mono); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2130 0%, var(--bg) 60%);
}
.login-card {
  width: 360px; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 32px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.login-brand .name { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
.login-brand .sub { font-size: 11px; color: var(--text-dim); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }
.login-card h1 { font-size: 13px; font-weight: 500; color: var(--text-dim); margin: 18px 0 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 0.06em; text-transform: uppercase; }
.field input {
  width: 100%; background: #10141d; border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 10px 12px; font-size: 13px; outline: none;
  transition: border-color 150ms ease-out;
}
.field input:focus { border-color: rgba(168, 212, 0, 0.55); }
.btn-primary {
  width: 100%; background: var(--accent); color: #0c0f14; border: none; border-radius: 6px;
  padding: 11px; font-size: 13px; font-weight: 600; margin-top: 6px;
  transition: filter 150ms ease-out;
}
.btn-primary:hover { filter: brightness(1.07); }
.login-error { color: var(--short); font-size: 12px; min-height: 16px; margin-top: 10px; }
.login-note { color: var(--text-dim); font-size: 11px; line-height: 1.55; margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }

/* ---------- terminal layout ---------- */
.term { display: grid; grid-template-rows: 46px 1fr; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.topbar .brand img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.topbar .brand span { color: var(--text-dim); font-weight: 500; }
.sym-switch { display: flex; background: #10141d; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.sym-switch button {
  background: transparent; border: none; color: var(--text-dim); padding: 6px 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; transition: color 150ms ease-out, background 150ms ease-out;
}
.sym-switch button.active { background: #262e3d; color: var(--text); }
.tf-label { color: var(--text-dim); font-size: 12px; }
.tf-group { display: flex; gap: 2px; background: #10141d; border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.tf-group button { background: transparent; border: none; color: var(--text-dim); font: 500 12px 'JetBrains Mono', monospace; padding: 3px 9px; border-radius: 4px; cursor: pointer; }
.tf-group button:hover { color: var(--text); }
.tf-group button.active { background: #262e3d; color: var(--lime); }
.admin-link { color: var(--text-dim); font-size: 12px; text-decoration: none; }
.admin-link:hover { color: var(--lime); }
.wl-cat { color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: 0.14em; margin: 14px 0 2px; padding: 0 10px; }
.wl-cat:first-child { margin-top: 2px; }
.inst-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px; }
.inst-card .inst-name { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.session-pill { display: flex; align-items: center; gap: 7px; font-size: 11px; letter-spacing: 0.1em; font-weight: 600; }
.session-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); }
.session-pill.live { color: var(--long); }
.session-pill.live .dot { background: var(--long); }
.topbar .spacer { flex: 1; }
.member-box { display: flex; align-items: center; gap: 12px; color: var(--text-dim); font-size: 12px; }
.member-box button { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 11px; font-size: 12px; transition: border-color 150ms ease-out; }
.member-box button:hover { border-color: rgba(255,255,255,0.25); }

.main { display: grid; grid-template-columns: 208px 1fr 320px; min-height: 0; }
.watchlist { background: var(--panel-2); border-right: 1px solid var(--border); padding: 10px 0; overflow-y: auto; }
.watchlist h2, .rail h2 { font-size: 10px; letter-spacing: 0.14em; color: var(--text-dim); text-transform: uppercase; padding: 4px 14px 10px; font-weight: 600; }
.wl-row { padding: 9px 14px; cursor: pointer; border-left: 2px solid transparent; transition: background 120ms ease-out; }
.wl-row:hover { background: rgba(255,255,255,0.03); }
.wl-row.active { background: rgba(255,255,255,0.04); border-left-color: var(--accent); }
.wl-row .sym { font-weight: 600; font-size: 12px; display: flex; justify-content: space-between; }
.wl-row .px { font-family: var(--mono); font-size: 12px; margin-top: 3px; display: flex; justify-content: space-between; color: var(--text); }
.wl-row .chg.up { color: var(--long); } .wl-row .chg.down { color: var(--short); }
.wl-row .feed { font-size: 10px; color: var(--text-dim); margin-top: 3px; }

.chart-wrap { position: relative; min-width: 0; background: var(--bg); }
#chart { position: absolute; inset: 0; }
.watermark {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.watermark span {
  display: flex; align-items: center; justify-content: center;
  color: #fff; opacity: 0.04; font-size: 15px; font-weight: 600; letter-spacing: 0.2em;
  transform: rotate(-24deg); user-select: none; white-space: nowrap;
}
.chart-status {
  position: absolute; left: 12px; top: 10px; z-index: 6; color: var(--text-dim);
  font-size: 11px; background: rgba(19,23,34,0.75); padding: 4px 8px; border-radius: 4px;
}

.rail { background: var(--panel-2); border-left: 1px solid var(--border); overflow-y: auto; padding: 12px 0 18px; }
.setup-card { margin: 0 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 14px; }
.setup-card.empty { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.sc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sc-sym { font-weight: 600; font-size: 13px; }
.bias { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 4px; }
.bias.long { color: var(--long); background: rgba(8,153,129,0.13); }
.bias.short { color: var(--short); background: rgba(242,54,69,0.13); }
.sc-status { font-size: 10px; letter-spacing: 0.12em; color: var(--text-dim); font-weight: 600; }
.sc-status b { color: var(--text); }
.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--border); }
.kv .k { color: var(--text-dim); font-size: 11px; }
.kv .v { font-family: var(--mono); font-size: 12.5px; }
.kv .v.t1 { color: var(--long); } .kv .v.t2 { color: var(--long); }
.kv .v.sl { color: var(--short); }
.guardian { margin-top: 10px; font-size: 11px; padding: 7px 9px; border-radius: 5px; background: rgba(255,255,255,0.04); color: var(--text-dim); display: flex; justify-content: space-between; }
.guardian b { letter-spacing: 0.06em; }
.guardian .g-SAFE { color: var(--long); } .guardian .g-CAUTION { color: var(--warn); }
.guardian .g-LOCK_PROFIT { color: var(--warn); } .guardian .g-DANGER { color: var(--short); }
.sc-rationale { margin-top: 10px; font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.sc-wm { margin-top: 10px; font-size: 10px; color: rgba(255,255,255,0.22); letter-spacing: 0.08em; }

.matrix-strip { margin: 0 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px 12px; }
.matrix-strip .kv:first-child { border-top: none; }
.regime-exp { color: var(--long); font-weight: 600; }
.regime-comp { color: var(--warn); font-weight: 600; }
.regime-bal { color: #00b0ff; font-weight: 600; }
.flow-bull { color: var(--long); font-weight: 600; }
.flow-bear { color: var(--short); font-weight: 600; }

.day-list, .hist-list { padding: 0 12px; }
.mini-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 7px; background: var(--panel); font-size: 12px; }
.mini-row .l { display: flex; gap: 8px; align-items: center; }
.mini-row .dir { font-weight: 700; font-size: 10px; letter-spacing: 0.06em; }
.mini-row .dir.long { color: var(--long); } .mini-row .dir.short { color: var(--short); }
.mini-row .st { color: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.outcome { font-family: var(--mono); font-size: 11px; font-weight: 600; }
.outcome.win { color: var(--long); } .outcome.loss { color: var(--short); } .outcome.flat { color: var(--text-dim); }
.rail .empty-note { color: var(--text-dim); font-size: 12px; padding: 0 14px; line-height: 1.6; }
.disclaimer { padding: 14px; color: var(--text-dim); font-size: 10.5px; line-height: 1.6; border-top: 1px solid var(--border); margin-top: 8px; }

.sym-select { display: none; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 12.5px; font-weight: 600; }
@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 52vh auto auto; overflow-y: auto; }
  .watchlist { display: none; }
  .sym-select { display: inline-block; }
  .topbar { flex-wrap: wrap; height: auto; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .topbar .brand span { display: none; }
  .member-box #memberEmail { display: none; }
  .rail { border-left: none; border-top: 1px solid var(--border); overflow: visible; }
  .chart-wrap { min-height: 52vh; }
}
