/* SPP Bot — UI system
   Surfaces are layered (bg → panel → raised), colour carries meaning only:
   green = profit / healthy, red = loss / risk, amber = paused / caution,
   violet = signal, blue = position / primary action. */
:root {
  --bg: #0a0c10;
  --panel: #11141a;
  --raised: #171b23;
  --hover: #1b2029;
  --line: #222834;
  --line-soft: #1a1f28;

  --text: #e8ebf1;
  --text-2: #a3abba;
  --text-3: #6c7586;

  --blue: #6e8bff;
  --blue-bg: rgba(110, 139, 255, .12);
  --green: #2dd4a0;
  --green-bg: rgba(45, 212, 160, .12);
  --red: #f4646a;
  --red-bg: rgba(244, 100, 106, .12);
  --amber: #f5b94a;
  --amber-bg: rgba(245, 185, 74, .12);
  --violet: #b394ff;
  --violet-bg: rgba(179, 148, 255, .13);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --sidebar: 292px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
svg { flex: none; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .93em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.r { text-align: right; }

/* ---------- shell ---------- */
/* Three independent scroll areas on desktop: sidebar, main content, chart side
   panel. The window itself never scrolls; overscroll doesn't chain. */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; height: 100vh; height: 100dvh; overflow: hidden; }

.sidebar {
  height: 100%; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line-soft);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 650; font-size: 15px; letter-spacing: -.01em; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6e8bff 0%, #2dd4a0 100%);
}
.logo svg { width: 18px; height: 18px; fill: none; stroke: #0a0c10; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.logo svg circle { fill: #0a0c10; stroke: none; }

.watch a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500;
}
.watch a:hover { background: var(--hover); color: var(--text); }

/* Main navigation: tabs in the top bar, active one underlined. */
.topnav { display: flex; align-items: stretch; align-self: stretch; gap: 4px; }
.topnav a {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; color: var(--text-2); font-weight: 500; font-size: 14px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.topnav a svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.topnav a:hover { color: var(--text); background: var(--hover); }
.topnav a.active { color: var(--text); }
.topnav a.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--blue); }
.topnav a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.watch a { font-size: 13px; padding: 6px 10px; }
/* Four columns: pair (+L/S) · P/L % (open positions only) · price · 24h % */
.watch a { display: grid; grid-template-columns: minmax(0, 1fr) 54px 64px 50px; align-items: center; gap: 6px; min-height: 34px; }
.watch .w24 { text-align: right; font: 500 11.5px var(--mono); font-variant-numeric: tabular-nums; background: none; padding: 0; color: var(--text-3); }
.watch .w24.up { color: var(--green); }
.watch .w24.down { color: var(--red); }
.watch .sym { font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
/* one-letter side tag: L = long (green), S = short (red) */
.side-mini { flex: none; display: inline-flex; align-items: center; justify-content: center; height: 18px; min-width: 18px; padding: 0 5px; border-radius: 5px; font: 700 10.5px/1 var(--font); letter-spacing: .02em; border: 1px solid transparent; }
.side-mini.side-long { background: rgba(45, 212, 160, .16); color: var(--green); border-color: rgba(45, 212, 160, .32); }
.side-mini.side-short { background: rgba(244, 100, 106, .16); color: var(--red); border-color: rgba(244, 100, 106, .32); }
.watch .sig-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 3px var(--violet-bg); }
.watch .wpl { text-align: right; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.watch .px { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }

.side-foot { margin-top: auto; padding-top: 12px; }
.side-foot button { width: 100%; justify-content: flex-start; }

.main { min-width: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: none; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 54px; padding: 0 24px;
  background: rgba(10, 12, 16, .82);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.bot-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); font-size: 13px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(45, 212, 160, .5); animation: pulse 2.4s infinite; }
.live-dot.paused { background: var(--amber); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 160, .45); } 70% { box-shadow: 0 0 0 7px rgba(45, 212, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 212, 160, 0); } }

.content-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.content { padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 14px; max-width: 1560px; width: 100%; }

#live { display: flex; flex-direction: column; gap: 14px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.kpi header { font-size: 11.5px; font-weight: 600; color: var(--text-2); letter-spacing: .01em; }
.kpi-value { font-size: 21px; font-weight: 600; letter-spacing: -.03em; line-height: 1.2; }
.kpi-value .unit { margin-left: 6px; font: 500 12px var(--font); color: var(--text-3); letter-spacing: 0; }
.kpi footer { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-3); }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 2px 0; }
.segments > div { display: flex; flex-direction: column; gap: 2px; }
.segments .mono { font-size: 15px; font-weight: 600; }
.seg-label { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

/* risk strip */
.riskbar {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
}
.riskbar > div { display: flex; flex-direction: column; gap: 2px; padding: 9px 16px; border-left: 1px solid var(--line-soft); }
.riskbar > div:first-child { border-left: 0; }
.rk { font-size: 11.5px; color: var(--text-3); font-weight: 550; }
.rv { font-size: 14px; font-weight: 600; }

/* ---------- panels & tables ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: clip; } /* clip, not hidden: keeps sticky headers working */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; }
.panel-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 6px; }
.panel-head .sub { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.actions { display: flex; align-items: center; gap: 10px; }
.actions form { margin: 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  padding: 7px 10px; text-align: left; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3);
  background: var(--raised); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
table.data th.r { text-align: right; }
table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--hover); }
.meta { margin-top: 2px; font-size: 11.5px; color: var(--text-3); font-family: var(--font); }

.pair { display: inline-flex; align-items: baseline; gap: 3px; }
.pair .sym, .sym { font-weight: 650; color: var(--text); }
.pair .quote, .quote { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.pair:hover .sym { color: var(--blue); }

/* ---------- pills & buttons ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap;
  background: var(--raised); color: var(--text-2);
}
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-violet { background: var(--violet-bg); color: var(--violet); }
.pill-gray { background: var(--raised); color: var(--text-2); }

button, .btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: var(--r-sm);
  font: 550 13px var(--font); color: var(--text);
  background: var(--raised); border: 1px solid var(--line); cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button:hover { background: var(--hover); border-color: #2d3442; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a.btn { text-decoration: none; }
.btn-sm { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; justify-content: center; }
.btn-primary:hover { background: #8098ff; border-color: #8098ff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-bg); border-color: rgba(244, 100, 106, .4); }
.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--raised); border: 1px solid var(--line-soft); border-radius: 8px; }
.segmented a { padding: 4px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.segmented a.on { background: var(--hover); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .03), 0 1px 2px rgba(0, 0, 0, .4); }

/* ---------- position visuals ---------- */
.progress-cell { min-width: 150px; }
.progress { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.progress.below span { background: var(--amber); }

.ladder { display: flex; gap: 3px; }
.ladder i { width: 8px; height: 14px; border-radius: 2px; background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.ladder i.on { background: var(--blue); box-shadow: none; }

.zone-col { min-width: 170px; }
.zonebar { position: relative; height: 18px; }
.zonebar::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 1px; background: var(--raised); }
.zonebar .zone { position: absolute; top: 5px; height: 8px; border-radius: 3px; background: rgba(45, 212, 160, .35); box-shadow: inset 0 0 0 1px rgba(45, 212, 160, .55); }
.zonebar .tp { position: absolute; top: 3px; width: 2px; height: 12px; margin-left: -1px; border-radius: 1px; background: var(--red); }
.zonebar .bid { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 2px var(--panel); }
.zonebar .bid.in { background: var(--violet); box-shadow: 0 0 0 2px var(--panel), 0 0 0 5px var(--violet-bg); }
.status { min-width: 110px; }

/* ---------- empty states ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 20px 30px; text-align: center; border-top: 1px solid var(--line-soft); }
.empty svg { width: 34px; height: 34px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 6px; }
.empty p { font-weight: 600; }
.empty span { color: var(--text-3); font-size: 13px; max-width: 420px; }

/* ---------- trades analytics ---------- */
.curve { display: block; width: 100%; height: 180px; padding: 0 18px 18px; }
.curve .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.curve.up .line { stroke: var(--green); }
.curve.down .line { stroke: var(--red); }
.curve.up .area { fill: rgba(45, 212, 160, .1); }
.curve.down .area { fill: rgba(244, 100, 106, .1); }

.bars { list-style: none; margin: 0; padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.bars li { display: grid; grid-template-columns: minmax(120px, auto) 1fr 32px 80px; align-items: center; gap: 12px; font-size: 13px; }
.bars li > .mono:last-child { text-align: right; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; } /* block: in table cells too */
.bar span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }

/* ---------- activity ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 16px 12px; border-bottom: 1px solid var(--line-soft); }
.panel > .filters:first-child { padding-top: 14px; } /* no header above it (Trades) */
.search { flex: 1 1 140px; min-width: 140px; max-width: 220px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: 13px var(--font); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer; user-select: none; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { border-color: #2d3442; color: var(--text); }
.chip:has(input:checked) { background: var(--raised); border-color: var(--text-3); color: var(--text); }
.chip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.chip-entry .chip-dot { background: var(--blue); }
.chip-dca .chip-dot { background: var(--violet); }
.chip-exit .chip-dot { background: var(--green); }
.chip-funding .chip-dot { background: var(--amber); }
.chip-n { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.filters select, .date input {
  height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); font: 13px var(--font);
}
.date { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.filters select:focus, .date input:focus { outline: none; border-color: var(--blue); }

.ev-summary { display: flex; align-items: center; gap: 12px; padding: 10px 16px 0; font-size: 12.5px; color: var(--text-2); }
.link-sm { color: var(--blue); font-size: 12.5px; }
.ev-new { padding: 8px 16px 0; }
.ev-new:empty { display: none; }
.ev-list { padding: 4px 16px 14px; }
.ev-day { position: sticky; top: 0; z-index: 1; margin: 10px -16px 0; padding: 8px 16px; font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); background: var(--panel); border-bottom: 1px solid var(--line-soft); }
.timeline { list-style: none; margin: 0; padding: 0; }
.ev { position: relative; display: grid; grid-template-columns: 14px 64px 76px 150px 1fr; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.ev:last-child { border-bottom: 0; }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); align-self: center; }
.ev-entry .ev-dot { background: var(--blue); }
.ev-dca .ev-dot { background: var(--violet); }
.ev-exit .ev-dot { background: var(--green); }
.ev-funding .ev-dot { background: var(--amber); }
.ev-time { font-size: 12px; color: var(--text-3); }
.ev-kind { font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.ev-msg { color: var(--text-2); font-size: 12.5px; white-space: normal; word-break: break-word; }
.ev-msg mark { background: var(--amber-bg); color: var(--amber); border-radius: 3px; padding: 0 2px; }
.ev:hover { background: var(--hover); }
.ev-end { text-align: center; padding: 12px 0 2px; font-size: 12px; color: var(--text-3); }
@media (max-width: 820px) {
  .ev { grid-template-columns: 12px 58px 1fr; }
  .ev .pair, .ev > span:nth-of-type(4) { grid-column: 3; }
  .ev-kind { grid-column: 3; }
  .ev-msg { grid-column: 2 / -1; }
}

/* ---------- chart page ---------- */
.chart-layout { display: block; }
.chart-panel .panel-head { align-items: center; }
.chart-panel h2 .sym { font-size: 18px; }
/* Tall enough to read, short enough that the positions table below shows. */
#chart { height: clamp(360px, calc(100dvh - 380px), 600px); margin: 0 6px 6px; }
.chart-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lg { display: inline-block; width: 14px; height: 2px; border-radius: 1px; }
.lg-ph { background: var(--red); }
.lg-dca { background: repeating-linear-gradient(90deg, var(--violet) 0 4px, transparent 4px 7px); }
.lg-pl { background: var(--green); }
.lg-sig { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.lg-buy { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--blue); border-radius: 0; }


/* ---------- auth ---------- */
body.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(800px 400px at 15% 0%, rgba(110, 139, 255, .14), transparent 60%),
    radial-gradient(700px 380px at 100% 100%, rgba(45, 212, 160, .10), transparent 60%),
    var(--bg);
}
.auth-card { width: 100%; max-width: 380px; padding: 30px 30px 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-brand .logo { width: 42px; height: 42px; border-radius: 11px; }
.auth-brand .logo svg { width: 24px; height: 24px; }
.auth-brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.auth-brand p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.auth-form input {
  height: 40px; padding: 0 12px; border-radius: 8px;
  font: 14px var(--font); color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  transition: border-color .12s, box-shadow .12s;
}
.auth-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg); }
.auth-form .btn-primary { height: 40px; margin-top: 6px; font-size: 14px; }
.form-error { padding: 9px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: 13px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .riskbar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .riskbar > div:nth-child(4) { border-left: 0; }
  .riskbar > div:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-layout, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .main { height: auto; overflow: visible; }
  .content-scroll { overflow: visible; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand { padding: 0 8px 0 0; }
  .watch, .watch-head { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; }
  .side-foot button { width: auto; }
  .topbar { position: static; padding: 0 8px 0 4px; }
  .topnav a { padding: 0 9px; }
  .topnav a svg { display: none; }
  .bot-chip .muted { display: none; }
  .content { padding: 16px; }
  .kpis { grid-template-columns: 1fr; }
  .riskbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .riskbar > div:nth-child(odd) { border-left: 0; }
  .riskbar > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .panel-head { flex-direction: column; align-items: flex-start; }
}

/* live price ticks */
[data-q] { transition: color .6s ease; border-radius: 3px; }
[data-q].tick-up { color: var(--green); }
[data-q].tick-down { color: var(--red); }

/* 24h change badge */
.chg {
  display: inline-block; min-width: 54px; padding: 1px 7px; border-radius: 5px; text-align: center;
  font: 600 11.5px/18px var(--mono); font-variant-numeric: tabular-nums;
  background: var(--raised); color: var(--text-2);
}
.chg.up { background: var(--green-bg); color: var(--green); }
.chg.down { background: var(--red-bg); color: var(--red); }
.chart-panel h2 .chg { margin-left: 6px; }
.live-tag { margin-left: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--green); }

/* slim scrollbars for the scroll areas */
.sidebar, .content-scroll { scrollbar-width: thin; scrollbar-color: #2a303c transparent; }
.sidebar::-webkit-scrollbar, .content-scroll::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb, .content-scroll::-webkit-scrollbar-thumb { background: #2a303c; border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }

/* collapsible sections (side panel) */
.c-chev { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }

/* chart header: title row + layer toggles (also the legend) */
.chart-head { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 10px; }
.ch-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.ch-title h2 { display: flex; align-items: baseline; gap: 2px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.ch-title h2 .quote { font-size: 13px; font-weight: 550; }
.ch-px { font-size: 17px; font-weight: 600; }
.tag { padding: 1px 6px; border-radius: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); background: var(--raised); white-space: nowrap; }
.tag-ghost { margin-left: auto; background: transparent; border: 1px solid var(--line); color: var(--text-3); font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.live-tag { margin-left: 0; }
.layers { display: flex; flex-wrap: wrap; gap: 6px; }
.layer {
  height: 26px; padding: 0 10px; gap: 7px; border-radius: 999px;
  font-size: 12px; font-weight: 550; color: var(--text-2);
  background: transparent; border: 1px solid var(--line);
}
.layer[aria-pressed="true"] { background: var(--raised); color: var(--text); border-color: #2d3442; }
.layer[aria-pressed="false"] { opacity: .55; }
.layer[aria-pressed="false"] .lg { filter: grayscale(1); }
.layer[aria-pressed="false"] { text-decoration: line-through; text-decoration-color: var(--text-3); }

/* trades page */
.count { margin-left: 6px; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text-3); }
.empty.slim { padding: 18px 20px 20px; }
.notice { display: flex; align-items: center; gap: 10px; margin: 14px 16px 0; padding: 11px 14px; border: 1px dashed var(--line); border-radius: var(--r-sm); color: var(--text-2); font-size: 13px; }
.notice svg { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; }
.stats-block { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 0; }
.stats-block:has(.notice) { padding: 0; }
.panel.inset { background: var(--bg); }
.history { padding-top: 6px; }
.push-right { margin-left: auto; }
.history .ev-summary { padding-bottom: 8px; }
.history-table th.x, .history-table td.x { width: 28px; padding-right: 0; }
tr.expandable { cursor: pointer; }
tr.expandable .c-chev { transition: transform .15s; }
tr.expandable[aria-expanded="true"] .c-chev { transform: rotate(90deg); }
tr.expandable[aria-expanded="true"] td { background: var(--raised); }
tr.detail td { padding: 0; background: var(--bg); }
.fills { padding: 10px 16px 14px 44px; }
.fills-title { margin-bottom: 6px; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.fills-table { border-collapse: collapse; font-size: 12.5px; }
.fills-table th { padding: 4px 14px 4px 0; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); }
.fills-table th.r, .fills-table td.r { text-align: right; }
.fills-table td { padding: 5px 14px 5px 0; white-space: nowrap; }
tr.more-row td { text-align: center; padding: 12px; }
.curve .zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.bar-col { width: 22%; }
.bar .neg-bar { background: var(--red); }
.segmented .seg { position: relative; }
.segmented .seg input { position: absolute; opacity: 0; pointer-events: none; }
.segmented .seg span { display: block; padding: 4px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 550; color: var(--text-2); cursor: pointer; }
.segmented .seg input:checked + span { background: var(--hover); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.03), 0 1px 2px rgba(0,0,0,.4); }
.segmented .seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }

/* console drawer: bottom of the main column, own scroll */
.top-actions { display: flex; align-items: center; gap: 10px; }
.console-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.console-toggle[aria-expanded="true"] { border-color: var(--blue); color: var(--blue); }
.console { flex: none; display: flex; flex-direction: column; height: 240px; border-top: 1px solid var(--line); background: #07090c; }
.console.tall { height: 55vh; }
.console[hidden] { display: none; }
.console-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.console-title { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.console-filter { height: 28px; width: 220px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font: 12.5px var(--font); }
.console-filter:focus { outline: none; border-color: var(--blue); }
.console-count { font-size: 11.5px; }
.console-actions { margin-left: auto; display: flex; gap: 6px; }
.console-actions [aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.console-lines { flex: 1; min-height: 0; margin: 0; padding: 4px 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; font-size: 12px; line-height: 1.55; scrollbar-width: thin; scrollbar-color: #2a303c transparent; }
.console-lines li { display: grid; grid-template-columns: 64px 46px 1fr; gap: 10px; padding: 1px 12px; white-space: pre-wrap; word-break: break-word; }
.console-lines li:hover { background: var(--hover); }
.console-lines .t { color: var(--text-3); }
.console-lines .lv { font-weight: 700; font-size: 10.5px; letter-spacing: .04em; }
.console-lines .lv-INFO { color: var(--blue); }
.console-lines .lv-WARN { color: var(--amber); }
.console-lines .lv-ERROR { color: var(--red); }
.console-lines .m { color: var(--text); }
.console-lines .a { color: var(--text-3); }
.console-lines li.lvl-ERROR .m { color: var(--red); }
.console-lines .empty-line { display: block; color: var(--text-3); padding: 8px 12px; }
@media (max-width: 820px) {
  .console { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 45vh; }
  .console-filter { width: 120px; }
}

/* position side tag (Long / Short) */
.side { display: inline-block; padding: 0 5px; border-radius: 4px; font: 700 10px/16px var(--font); letter-spacing: .05em; text-transform: uppercase; vertical-align: 1px; }
.side-long { background: var(--green-bg); color: var(--green); }
.side-short { background: var(--red-bg); color: var(--red); }
/* compact DCA count */
.dca-count { display: flex; flex-direction: column; gap: 4px; min-width: 64px; }
.dca-count strong { font-weight: 700; color: var(--text); }
.mini-bar { display: block; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--violet); }

/* watchlist: in-position and signal rows */
.watch a { position: relative; }
/* One look per meaning: the selected pair alone gets the blue bar and a raised
   background; an open position is shown only by its LONG tag and live P/L; a
   signal only by its tag. */
.watch { display: flex; flex-direction: column; gap: 0; }
.watch a { border-radius: 0; }
.watch a + a { border-top: 1px solid rgba(255, 255, 255, .045); } /* very light row divider */
.watch a.active { border-radius: 6px; border-top-color: transparent; }
.watch a.active + a { border-top-color: transparent; }
.watch-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 54px 64px 50px; gap: 6px;
  margin-top: 0; padding: 10px 10px 6px; border-top: 1px solid var(--line-soft);
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
}
.watch-head span:not(:first-child) { text-align: right; }
.watch a.active { background: var(--raised); color: var(--text); box-shadow: inset 2px 0 0 var(--blue), inset 0 0 0 1px var(--line); }

/* activity: structured fields */
.ev-pair { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ev-body-cell { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ev-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 12.5px; color: var(--text); }
.ev-fields .f { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ev-fields .k { font-family: var(--font); font-size: 11px; color: var(--text-3); }
.ev-fields .trade-link { margin-left: auto; color: var(--text-3); font-size: 12px; }
.ev-fields .trade-link:hover { color: var(--blue); }
.ev-action .ev-dot { background: var(--text-2); box-shadow: 0 0 0 3px var(--raised); }
.ev-skip .ev-dot { background: var(--text-3); }
.chip-action .chip-dot { background: var(--text-2); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
/* Page-level tabs: pull the labels up to the 20px line every page starts on. */
.content > .tabs:first-child { margin-top: -9px; }
.tabs [role="tab"] {
  height: 38px; padding: 0 14px; margin-bottom: -1px; gap: 8px;
  background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.tabs [role="tab"]:hover { color: var(--text); background: transparent; }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.tab-count { padding: 0 7px; border-radius: 999px; background: var(--raised); font: 600 11.5px/18px var(--mono); color: var(--text-2); }
.tabs [aria-selected="true"] .tab-count { background: var(--blue-bg); color: var(--blue); }

.date-range { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.date-sep { color: var(--text-3); }
.date input { width: 122px; }
.chip { padding: 0 9px; }

/* Numbered pagination (Activity) */
.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; padding: 14px 16px 18px; border-top: 1px solid var(--line-soft); }
.pg {
  min-width: 34px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text-2);
  font: 500 13px/1 var(--mono); font-variant-numeric: tabular-nums;
}
a.pg:hover { color: var(--text); border-color: var(--text-3); background: var(--hover); }
.pg-cur { color: var(--blue); border-color: var(--blue); background: var(--blue-bg); font-weight: 650; }
.pg-step { font-family: var(--font); padding: 0 12px; }
.pg[aria-disabled="true"] { opacity: .4; }
.pg-gap { padding: 0 4px; color: var(--text-3); }


/* chart page: open positions under the chart */
.pos-mini { padding: 0 0 4px; }
.pos-mini-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; }
.pos-mini-head h2 { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.pos-mini-empty { padding: 4px 16px 14px; color: var(--text-3); font-size: 13px; }
table.data.compact th, table.data.compact td { padding-top: 7px; padding-bottom: 7px; }
table.data.compact .pair .sym { font-size: 13px; }
table.data tr.is-current td { background: var(--raised); }
table.data tr.is-current td:first-child { box-shadow: inset 2px 0 0 var(--blue); }

/* chart header: status + spread + funding + ATR, before "Live" */
.ch-market { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; margin: 0 4px 0 8px; padding-left: 14px; border-left: 1px solid var(--line-soft); }
.ch-market .hm { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.ch-market .k { color: var(--text-3); }
.ch-market .pill { line-height: 18px; }
/* P/L cells in every table: USDT amount on top, % compact below, both coloured */
.pl-cell { line-height: 1.25; white-space: nowrap; }
.pl-abs { font-size: inherit; font-weight: 550; font-variant-numeric: tabular-nums; } /* same size as the other numbers */
.pl-pct { font-size: 11.5px; font-weight: 550; margin-top: 2px; font-variant-numeric: tabular-nums; opacity: .9; }

/* Performance › Profit by period */
.periods .panel-head { align-items: center; }
/* Fixed columns: identical layout for Day / Week / Month / Year. */
.period-table { table-layout: fixed; }
.period-table col.c-period { width: 26%; }
.period-table col.c-num { width: 12%; }
.period-table col.c-profit { width: 14%; }
.period-table col.c-bar { width: 24%; }
.period-table td:first-child { overflow: hidden; text-overflow: ellipsis; }
table.data tr.muted-row td { color: var(--text-3); }
table.data tfoot td { padding: 9px 10px; border-top: 1px solid var(--line); font-weight: 600; color: var(--text-2); }
