:root {
  --bg: #0a0d12; --panel: #11161f; --panel-2: #171e2a; --line: #222b3a; --text: #e8edf4; --muted: #8b97a8;
  --dim: #5d6878; --brand: #2fb79b; --up: #16c784; --down: #ea3943; --warn: #f0b90b;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
[data-theme="light"] {
  --bg: #f4f6f9; --panel: #fff; --panel-2: #f0f3f7; --line: #e1e6ee; --text: #121826; --muted: #5b6577; --dim: #98a1b0;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--sans); }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.up { color: var(--up); } .dn { color: var(--down); }
.hidden { display: none !important; }

.btn { border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 8px 14px; cursor: pointer;
  transition: background .18s var(--ease), transform .12s var(--ease); }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-buy { background: var(--up); border-color: var(--up); color: #fff; font-weight: 700; }
.btn-sell { background: var(--down); border-color: var(--down); color: #fff; font-weight: 700; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0; }
.input, .select { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; }
.input:focus, .select:focus { outline: none; border-color: var(--brand); }
.field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); }
.hint { font-size: 11px; color: var(--dim); }
.err { color: var(--down); font-size: 12.5px; min-height: 18px; margin: 4px 0 8px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 20px; }
.auth-switch { margin-top: 14px; text-align: center; color: var(--muted); }

/* layout */
.top { height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 16px; gap: 18px; }
.logo { font-weight: 800; letter-spacing: .5px; color: var(--brand); font-size: 16px; }
.tabs { display: flex; gap: 4px; }
.tab { background: none; border: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.tab.active, .tab:hover { color: var(--text); background: var(--panel-2); }
.top .spacer { flex: 1; }
.page { padding: 12px; }

.trade { display: grid; grid-template-columns: 240px minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-body { padding: 12px; }
.symbols { max-height: 400px; overflow: auto; }
.sym { display: flex; justify-content: space-between; padding: 7px 12px; cursor: pointer; border-left: 2px solid transparent; }
.sym:hover { background: var(--panel-2); }
.sym.active { background: var(--panel-2); border-left-color: var(--brand); }
.sym .off { color: var(--dim); font-size: 11px; }
.ticker { display: flex; gap: 24px; align-items: baseline; padding: 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ticker .name { font-size: 18px; font-weight: 700; }
.ticker .price { font-size: 22px; font-weight: 700; font-family: var(--mono); }
.ticker .meta { color: var(--muted); font-size: 12px; }
.chart-wrap { height: 380px; padding: 8px; }
canvas { width: 100%; height: 100%; display: block; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.seg button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 6px; padding: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { color: var(--text); border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.summary { font-size: 12px; color: var(--muted); display: grid; grid-template-columns: 1fr auto; gap: 4px; margin: 6px 0 12px; }
.summary span:nth-child(even) { text-align: right; color: var(--text); font-family: var(--mono); }

.bottom { margin-top: 12px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-family: var(--mono); font-size: 12.5px; }
td.txt { font-family: var(--sans); }
.empty { padding: 26px; text-align: center; color: var(--dim); }
.badge { padding: 1px 7px; border-radius: 4px; font-size: 11px; font-weight: 700; font-family: var(--sans); }
.badge.long { background: rgba(22, 199, 132, .15); color: var(--up); }
.badge.short { background: rgba(234, 57, 67, .15); color: var(--down); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 700; font-family: var(--mono); margin-top: 4px; }
.notice { border: 1px dashed var(--line); border-radius: 8px; padding: 12px; color: var(--muted); margin-bottom: 12px; }
.narrow { max-width: 460px; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 6px;
  padding: 10px 14px; max-width: 360px; animation: tin .22s var(--ease); }
.toast.err { border-left-color: var(--down); }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1100px) { .trade, .pred-grid { grid-template-columns: 1fr; } .symbols { max-height: 260px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
