:root {
  --bg: #04060c;
  --bg-2: #070a13;
  --panel: rgba(17, 22, 36, 0.66);
  --panel-solid: #0d111c;
  --panel-hi: #121826;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eaeefb;
  --muted: #98a3bd;
  --faint: #626e89;
  --accent: #6d5efc;
  --accent-2: #22d3ee;
  --accent-3: #4f8bff;
  --danger: #ff5d72;
  --warn: #ffb020;
  --good: #2ee0a6;
  --gold: #f5c451;
  --grad: linear-gradient(135deg, #7b5cff 0%, #4f7cff 100%);
  --grad-2: linear-gradient(135deg, #2ee0a6 0%, #12b98e 100%);
  --grad-warm: linear-gradient(135deg, #ffb020 0%, #ff7a45 100%);
  --radius: 18px;
  --radius-sm: 11px;
  --ring: 0 0 0 3px rgba(109, 94, 252, 0.22);
  --shadow: 0 24px 70px -28px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 20px 60px -24px rgba(109, 94, 252, 0.55);
  --font: "Inter", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 780px at 12% -12%, rgba(123, 92, 255, 0.20), transparent 58%),
    radial-gradient(1000px 680px at 102% -6%, rgba(34, 211, 238, 0.14), transparent 56%),
    radial-gradient(900px 900px at 50% 120%, rgba(46, 224, 166, 0.08), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -30% -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(123, 92, 255, 0.16), transparent) 18% 22% / 46% 46% no-repeat,
    radial-gradient(closest-side, rgba(34, 211, 238, 0.13), transparent) 82% 12% / 42% 42% no-repeat,
    radial-gradient(closest-side, rgba(46, 224, 166, 0.10), transparent) 70% 78% / 40% 40% no-repeat;
  filter: blur(20px);
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(0, -4%, 0) scale(1.08); }
}

::selection { background: rgba(109, 94, 252, 0.35); color: #fff; }

a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: padding-box; }

.container { width: min(1200px, 92vw); margin: 0 auto; }

h1, h2, h3 { letter-spacing: -0.025em; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: blur(18px) saturate(140%);
  background: rgba(6, 8, 14, 0.66);
  border-bottom: 1px solid var(--border);
}
.nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(109, 94, 252, 0.6), rgba(34, 211, 238, 0.5), transparent);
  opacity: 0.7;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 750; font-size: 1.06rem; letter-spacing: -0.02em; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 0.82rem; letter-spacing: 0.02em;
  box-shadow: 0 8px 22px -8px rgba(109, 94, 252, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-links a { color: var(--muted); font-size: 0.92rem; font-weight: 550; padding: 8px 12px; border-radius: 9px; transition: color 0.16s, background 0.16s; }
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-links a.active { color: var(--text); }
.nav-links a.btn { padding: 9px 15px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font-size: 0.9rem; font-weight: 650;
  cursor: pointer; transition: transform 0.16s ease, background 0.16s, box-shadow 0.16s, border-color 0.16s; font-family: inherit;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); transform: translateY(-1px); border-color: var(--border-strong); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--shadow-glow); }
.btn-primary:hover { box-shadow: 0 24px 50px -18px rgba(109, 94, 252, 0.95); filter: brightness(1.06); }
.btn-good { background: var(--grad-2); border-color: transparent; color: #04201a; }
.btn-good:hover { box-shadow: 0 20px 44px -18px rgba(46, 224, 166, 0.9); }
.btn-danger { background: linear-gradient(135deg, #ff5d72, #e0384f); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.06); }
.btn-sm { padding: 8px 13px; font-size: 0.82rem; }
.btn-lg { padding: 14px 24px; font-size: 0.96rem; }
.btn-block { width: 100%; }
.btn-outline-danger { border-color: rgba(255, 93, 114, 0.42); color: #ff9aa8; background: rgba(255, 93, 114, 0.07); }
.btn-outline-danger:hover { background: rgba(255, 93, 114, 0.15); border-color: rgba(255, 93, 114, 0.6); }

/* ---------- cards / layout ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(22, 28, 44, 0.72), rgba(10, 14, 22, 0.72));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 42%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat-label { color: var(--muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 650; }
.stat-value { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--faint); font-size: 0.82rem; margin-top: 4px; }
.pos { color: var(--good); } .neg { color: var(--danger); } .muted { color: var(--muted); } .faint { color: var(--faint); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  font-size: 0.73rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--border-strong); color: var(--muted); background: rgba(255, 255, 255, 0.03);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.badge-good { color: var(--good); border-color: rgba(46, 224, 166, 0.4); background: rgba(46, 224, 166, 0.09); }
.badge-warn { color: var(--warn); border-color: rgba(255, 176, 32, 0.4); background: rgba(255, 176, 32, 0.09); }
.badge-danger { color: var(--danger); border-color: rgba(255, 93, 114, 0.4); background: rgba(255, 93, 114, 0.09); }
.badge-live { color: #fff; background: linear-gradient(135deg, #ff5d72, #e0384f); border-color: transparent; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; color: var(--muted); font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.08em; padding: 10px 12px; border-bottom: 1px solid var(--border); font-weight: 650; }
td { padding: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.045); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.sym { font-weight: 700; letter-spacing: 0.02em; }
.side-buy { color: var(--good); font-weight: 700; }
.side-sell { color: var(--danger); font-weight: 700; }

/* ---------- forms ---------- */
label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, 0.32); color: var(--text); font-family: inherit; font-size: 0.92rem;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: rgba(0, 0, 0, 0.4); }
input::placeholder { color: var(--faint); }
.field { margin-bottom: 16px; }
.hint { font-size: 0.76rem; color: var(--faint); margin-top: 6px; }

/* ---------- toggle ---------- */
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: rgba(255, 255, 255, 0.12); border-radius: 999px; cursor: pointer; transition: 0.22s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: 0.22s; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.switch input:checked + span { background: var(--grad-2); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ================= hero / landing ================= */
.hero { padding: 108px 0 40px; text-align: center; position: relative; }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.1rem); line-height: 1.02; margin: 20px 0 18px; letter-spacing: -0.04em; font-weight: 800; }
.hero h1 span { background: linear-gradient(110deg, #7b5cff 0%, #4f7cff 40%, #22d3ee 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); font-size: 1.14rem; max-width: 660px; margin: 0 auto 32px; line-height: 1.6; }
.hero-actions { display: flex; gap: 13px; justify-content: center; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 8px; padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.03); color: var(--muted); font-size: 0.78rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); animation: pulse 2s infinite; }

.hero-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin: 46px auto 0; }
.hero-stat { min-width: 168px; padding: 16px 20px; border-radius: 14px; border: 1px solid var(--border); background: rgba(12, 16, 26, 0.6); backdrop-filter: blur(8px); text-align: left; }
.hero-stat .v { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; background: linear-gradient(120deg, #fff, #9fb3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stat .k { color: var(--faint); font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase; margin-top: 4px; font-weight: 650; }

.hero-preview { margin: 54px auto 0; max-width: 900px; }
.mock {
  border: 1px solid var(--border-strong); border-radius: 20px; overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 21, 34, 0.92), rgba(8, 11, 18, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.mock-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.mock-bar .dot3 { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.mock-bar .dot3.r { background: #ff5d72; } .mock-bar .dot3.y { background: #ffb020; } .mock-bar .dot3.g { background: #2ee0a6; }
.mock-bar .title { margin-left: 10px; font-family: var(--mono); font-size: 0.8rem; color: var(--muted); letter-spacing: 0.06em; }
.mock-tape { display: flex; gap: 0; overflow: hidden; border-bottom: 1px solid var(--border); background: rgba(0, 0, 0, 0.3); }
.mock-tape .t { display: inline-flex; gap: 8px; align-items: baseline; padding: 10px 20px; border-right: 1px solid var(--border); font-family: var(--mono); font-size: 0.78rem; white-space: nowrap; }
.mock-tape .t b { font-weight: 700; letter-spacing: 0.04em; }
.mock-body { padding: 16px; display: grid; grid-template-columns: 1fr 210px; gap: 16px; }
@media (max-width: 720px) { .mock-body { grid-template-columns: 1fr; } }
.mock-chart { height: 240px; display: flex; align-items: flex-end; gap: 6px; padding: 8px 4px; }
.mock-chart .bar { flex: 1; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, rgba(109, 94, 252, 0.95), rgba(79, 124, 255, 0.25)); animation: grow 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.mock-chart .bar.g { background: linear-gradient(180deg, rgba(46, 224, 166, 0.95), rgba(46, 224, 166, 0.2)); }
@keyframes grow { from { transform: scaleY(0.04); opacity: 0.2; } to { transform: scaleY(1); opacity: 1; } }
.mock-side { display: flex; flex-direction: column; gap: 10px; }
.mock-kpi { padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); }
.mock-kpi .k { color: var(--faint); font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700; }
.mock-kpi .v { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; margin-top: 4px; }

.feature-grid { padding: 30px 0; }
.section-block-land { padding: 56px 0; }
.section-kicker { color: var(--accent-2); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.section-title-lg { font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 8px 0 10px; font-weight: 800; }
.section-sub { color: var(--muted); max-width: 620px; font-size: 1rem; }

.feature { transition: transform 0.2s ease, border-color 0.2s, box-shadow 0.2s; }
.feature:hover { transform: translateY(-4px); border-color: rgba(109, 94, 252, 0.5); box-shadow: 0 30px 70px -30px rgba(109, 94, 252, 0.6); }
.feature h3 { margin: 16px 0 7px; font-size: 1.1rem; }
.feature p { color: var(--muted); font-size: 0.92rem; margin: 0; line-height: 1.6; }
.feature .ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(109, 94, 252, 0.22), rgba(34, 211, 238, 0.12));
  border: 1px solid var(--border-strong); color: #c6d0ff;
}
.feature .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 980px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .steps { grid-template-columns: 1fr; } }
.step { position: relative; padding: 22px; }
.step .n { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; color: var(--accent-2); letter-spacing: 0.1em; }
.step h3 { margin: 10px 0 6px; font-size: 1.05rem; }
.step p { color: var(--muted); font-size: 0.9rem; margin: 0; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; color: var(--muted); font-size: 0.93rem; }
.checklist li::before { content: ""; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; background: rgba(46, 224, 166, 0.14); border: 1px solid rgba(46, 224, 166, 0.4); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%232ee0a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E"); background-size: 12px; background-repeat: no-repeat; background-position: center; margin-top: 2px; }

.cta-band { position: relative; overflow: hidden; text-align: center; padding: 56px 24px; border-radius: 24px; border: 1px solid var(--border-strong); background: linear-gradient(135deg, rgba(109, 94, 252, 0.18), rgba(34, 211, 238, 0.1)); box-shadow: var(--shadow); }
.cta-band::before { content: ""; position: absolute; inset: 0; background: radial-gradient(closest-side, rgba(123, 92, 255, 0.4), transparent) 30% 20% / 40% 80% no-repeat, radial-gradient(closest-side, rgba(34, 211, 238, 0.3), transparent) 80% 80% / 40% 80% no-repeat; opacity: 0.6; }
.cta-band > * { position: relative; }
.cta-band h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); margin: 0 0 12px; font-weight: 800; }
.cta-band p { color: var(--muted); max-width: 560px; margin: 0 auto 26px; }

.disclaimer { border-top: 1px solid var(--border); padding: 30px 0 46px; color: var(--faint); font-size: 0.8rem; text-align: center; max-width: 760px; margin: 40px auto 0; line-height: 1.7; }

/* ---------- auth ---------- */
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 48px 0; }
.auth-card { width: min(430px, 92vw); }
.auth-split { width: min(940px, 92vw); display: grid; grid-template-columns: 1.05fr 1fr; border-radius: 22px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--panel-solid); }
@media (max-width: 760px) { .auth-split { grid-template-columns: 1fr; } .auth-aside { display: none; } }
.auth-aside { position: relative; padding: 40px 34px; background: linear-gradient(150deg, rgba(109, 94, 252, 0.28), rgba(34, 211, 238, 0.12)); border-right: 1px solid var(--border); overflow: hidden; }
.auth-aside::after { content: ""; position: absolute; inset: 0; background: radial-gradient(closest-side, rgba(123, 92, 255, 0.5), transparent) 20% 10% / 70% 60% no-repeat; opacity: 0.55; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { font-size: 1.5rem; margin: 18px 0 12px; font-weight: 800; }
.auth-aside p { color: rgba(255, 255, 255, 0.82); font-size: 0.94rem; line-height: 1.6; }
.auth-aside .badges { display: flex; flex-direction: column; gap: 12px; margin-top: 26px; }
.auth-aside .badges div { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, 0.9); font-size: 0.88rem; font-weight: 550; }
.auth-aside .badges div::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E"); background-size: 11px; background-repeat: no-repeat; background-position: center; }
.auth-main { padding: 40px 36px; }

/* ---------- app shell ---------- */
.app-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 30px 0 22px; }
.app-head h1 { font-size: 1.5rem; margin: 0; }
.app-head .sub { color: var(--muted); font-size: 0.86rem; margin-top: 3px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }

.section-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; margin: 0 0 14px; }

.chart-wrap { height: 260px; width: 100%; }
svg.spark { width: 100%; height: 100%; display: block; }
.log-list { max-height: 320px; overflow-y: auto; font-family: var(--mono); font-size: 0.8rem; }
.log-row { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.045); }
.log-row .t { color: var(--faint); flex: 0 0 auto; }
.log-row.warn .m { color: var(--warn); } .log-row.error .m { color: var(--danger); }

.toast { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 9px; }
.toast .item { padding: 13px 17px; border-radius: 12px; background: rgba(16, 21, 34, 0.96); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 0.88rem; animation: slidein 0.22s ease; backdrop-filter: blur(10px); }
.toast .item.good { border-left: 3px solid var(--good); }
.toast .item.bad { border-left: 3px solid var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.empty { color: var(--faint); font-size: 0.88rem; padding: 20px 0; text-align: center; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ================= settings redesign ================= */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 30px 0 24px; }
.page-head h1 { font-size: 1.7rem; margin: 0; font-weight: 800; }
.page-head .sub { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.back { color: var(--muted); font-size: 0.85rem; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 10px; transition: color 0.15s; }
.back:hover { color: var(--text); }

.section-block { margin-bottom: 24px; }
.section-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.section-head .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.05rem; background: linear-gradient(140deg, rgba(109, 94, 252, 0.24), rgba(34, 211, 238, 0.12)); border: 1px solid var(--border-strong); }
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.82rem; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid.one { grid-template-columns: 1fr; }
@media (max-width: 620px) { .field-grid { grid-template-columns: 1fr; } }

.seg { display: inline-flex; gap: 5px; padding: 5px; border-radius: 13px; background: rgba(0, 0, 0, 0.32); border: 1px solid var(--border); width: 100%; }
.seg button { flex: 1; padding: 12px 14px; border: none; border-radius: 9px; background: transparent; color: var(--muted); font-family: inherit; font-size: 0.88rem; font-weight: 650; cursor: pointer; transition: all 0.16s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.seg button.active.paper { background: linear-gradient(135deg, #64748b, #475569); }
.seg small { display: block; font-weight: 500; opacity: 0.82; font-size: 0.72rem; margin-top: 2px; }

.conn-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.26); margin-bottom: 18px; }
.conn-banner .led { width: 11px; height: 11px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px rgba(98, 110, 137, 0.15); flex: 0 0 auto; }
.conn-banner.ok .led { background: var(--good); box-shadow: 0 0 0 4px rgba(46, 224, 166, 0.16); }
.conn-banner.bad .led { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 93, 114, 0.16); }
.conn-banner .txt { flex: 1; min-width: 0; }
.conn-banner .t1 { font-weight: 700; font-size: 0.95rem; }
.conn-banner .t2 { color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-banner .val { text-align: right; font-variant-numeric: tabular-nums; }
.conn-banner .val b { font-size: 1.15rem; font-family: var(--mono); }
.conn-banner .val span { display: block; color: var(--faint); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }

.range { display: grid; grid-template-columns: 1fr 104px; gap: 14px; align-items: center; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); padding: 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--accent); cursor: pointer; }
.range .val input { text-align: center; font-variant-numeric: tabular-nums; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; min-height: 4px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em; background: rgba(109, 94, 252, 0.15); border: 1px solid rgba(109, 94, 252, 0.34); color: #cdd3ff; }
.chip span { cursor: pointer; opacity: 0.6; font-weight: 800; }
.chip span:hover { opacity: 1; }

details.adv { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 14px; }
details.adv > summary { cursor: pointer; color: var(--muted); font-size: 0.84rem; font-weight: 600; list-style: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "▸ "; }
details.adv[open] > summary::before { content: "▾ "; }

.savebar { position: sticky; bottom: 18px; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; padding: 15px 20px; border-radius: 15px; border: 1px solid var(--border-strong); background: rgba(12, 16, 26, 0.86); backdrop-filter: blur(16px); box-shadow: var(--shadow); }
.savebar .msg { color: var(--muted); font-size: 0.84rem; }

.toolbar-end { display: flex; gap: 10px; flex-wrap: wrap; }
.mt { margin-top: 14px; }

/* ================= institutional terminal ================= */
.terminal { padding-bottom: 60px; }
.terminal .page-head { margin-top: 18px; }

.ticker-strip { display: flex; gap: 0; overflow-x: auto; margin: 16px 0 4px; padding: 10px 0; border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, 0.4); scrollbar-width: none; }
.ticker-strip::-webkit-scrollbar { display: none; }
.ticker-strip .tk { display: inline-flex; align-items: baseline; gap: 8px; padding: 0 18px; border-right: 1px solid var(--border); font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; cursor: pointer; transition: background 0.15s; }
.ticker-strip .tk:hover { background: rgba(255, 255, 255, 0.03); }
.ticker-strip .tk:last-child { border-right: none; }
.ticker-strip .tk .sym { font-weight: 700; letter-spacing: 0.05em; }
.ticker-strip .tk .px { color: var(--muted); font-variant-numeric: tabular-nums; }
.ticker-strip .tk .ch { font-variant-numeric: tabular-nums; font-weight: 600; }
.ticker-strip .tk .ch.up { color: var(--good); }
.ticker-strip .tk .ch.dn { color: var(--danger); }
.ticker-strip .tk-idle { padding: 0 18px; color: var(--faint); font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; }

.status-bar { position: relative; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; padding: 18px 22px; border: 1px solid var(--border-strong); border-radius: 16px; background: linear-gradient(180deg, rgba(22, 28, 44, 0.85), rgba(9, 12, 19, 0.9)); overflow: hidden; }
.status-bar::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); opacity: 0.85; }
.sb-led { width: 13px; height: 13px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px rgba(98, 110, 137, 0.14); flex: 0 0 auto; }
.sb-led.run { background: var(--good); box-shadow: 0 0 0 4px rgba(46, 224, 166, 0.18), 0 0 16px rgba(46, 224, 166, 0.7); animation: pulse 1.8s ease-in-out infinite; }
.sb-led.wait { background: var(--warn); box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.16); }
.sb-led.halt { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 93, 114, 0.18); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.sb-main { flex: 1; min-width: 180px; }
.sb-state { font-size: 1.04rem; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.sb-state.run { color: var(--good); } .sb-state.wait { color: var(--warn); } .sb-state.halt { color: var(--danger); }
.sb-msg { color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
.sb-meta { display: flex; gap: 24px; }
.sb-meta > div { display: flex; flex-direction: column; }
.sb-meta .k { color: var(--faint); font-size: 0.64rem; letter-spacing: 0.12em; font-weight: 700; }
.sb-meta .v { font-family: var(--mono); font-size: 0.86rem; font-variant-numeric: tabular-nums; margin-top: 2px; }
.action-group { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle-btn { padding: 11px 22px; border-radius: 10px; border: 1px solid transparent; font-family: inherit; font-weight: 700; font-size: 0.88rem; cursor: pointer; transition: all 0.16s; }
.toggle-btn.start { background: var(--grad-2); color: #04201a; }
.toggle-btn.start:hover { box-shadow: 0 12px 30px -12px rgba(46, 224, 166, 0.9); transform: translateY(-1px); }
.toggle-btn.stop { background: var(--grad-warm); color: #221600; }
.toggle-btn.stop:hover { box-shadow: 0 12px 30px -12px rgba(255, 176, 32, 0.9); transform: translateY(-1px); }
.toggle-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.account-note { margin: -6px 0 16px; padding: 14px 18px; border-radius: 12px; border: 1px solid rgba(255, 176, 32, 0.34); background: rgba(255, 176, 32, 0.09); color: #ffd48a; font-size: 0.86rem; }
.account-note.danger { border-color: rgba(255, 93, 114, 0.34); background: rgba(255, 93, 114, 0.09); color: #ffb3bd; }
.account-note b { color: #fff; }
.account-note a { color: var(--accent-2); text-decoration: underline; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { position: relative; padding: 18px 20px; border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(180deg, rgba(22, 28, 44, 0.82), rgba(10, 14, 22, 0.82)); overflow: hidden; transition: border-color 0.2s, transform 0.2s; }
.kpi:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(closest-side, rgba(109, 94, 252, 0.22), transparent); }
.kpi-label { color: var(--faint); font-size: 0.66rem; letter-spacing: 0.13em; font-weight: 700; position: relative; }
.kpi-value { font-family: var(--mono); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 9px; font-variant-numeric: tabular-nums; position: relative; }
.kpi-value.pos { color: var(--good); } .kpi-value.neg { color: var(--danger); }
.kpi-sub { color: var(--muted); font-size: 0.78rem; margin-top: 5px; font-family: var(--mono); position: relative; }

.chart-panel { position: relative; margin-bottom: 16px; border: 1px solid var(--border-strong); border-radius: 16px; background: rgba(6, 9, 15, 0.78); overflow: hidden; box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px 16px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(20, 26, 40, 0.5), transparent); }
.chart-toolbar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: rgba(0, 0, 0, 0.18); }
.chart-toolbar button { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: rgba(255, 255, 255, 0.02); color: var(--muted); cursor: pointer; padding: 0; transition: all 0.14s; }
.chart-toolbar button:hover { color: #fff; border-color: var(--accent); }
.chart-toolbar button.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: var(--shadow-glow); }
.chart-toolbar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-toolbar .tb-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 5px; }
.chart-toolbar button[data-tool] { position: relative; }
.chart-toolbar button[data-tool]::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 3px; height: 2px; border-radius: 2px; background: transparent; }
.chart-toolbar button[data-tool].active::after { background: var(--tool-c, transparent); }
.ax-color-menu { position: fixed; z-index: 130; display: grid; grid-template-columns: repeat(5, 22px); gap: 6px; padding: 8px; border-radius: 11px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.ax-color-menu button { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.22); padding: 0; cursor: pointer; }
.ax-color-menu button:hover { transform: translateY(-1px); border-color: #fff; }
.ax-color-menu button.active { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 3px #fff; }
.chart-toolbar .tb-info { margin-left: auto; font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.ax-text-edit { position: absolute; z-index: 8; min-width: 96px; max-width: 240px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--accent); background: rgba(6, 9, 15, 0.97); color: #fff; font-family: var(--mono); font-size: 13px; outline: none; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55); }
.ax-confirm { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 0.86rem; max-width: 92vw; animation: axpulse 0.35s ease; }
.ax-confirm button { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, 0.04); color: var(--text); cursor: pointer; font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.ax-confirm button:hover { border-color: var(--accent); color: #fff; }
.ax-confirm button.ok { background: linear-gradient(135deg, #ff5d72, #e0384f); border-color: transparent; color: #fff; }
@keyframes axpulse { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.sym-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sym-tabs button { padding: 7px 13px; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-family: var(--mono); font-weight: 700; font-size: 0.8rem; cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; }
.sym-tabs button:hover { color: var(--text); border-color: var(--border-strong); }
.sym-tabs button.active { background: rgba(109, 94, 252, 0.18); border-color: rgba(109, 94, 252, 0.55); color: #cdd3ff; box-shadow: 0 0 22px -8px rgba(109, 94, 252, 0.9); }
.chart-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sym-search { width: 96px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--border-strong); background: rgba(0, 0, 0, 0.4); color: var(--text); font-family: var(--mono); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.82rem; }
.sym-search:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.interval-seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); }
.interval-seg button { padding: 6px 12px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-family: var(--mono); font-weight: 700; font-size: 0.76rem; cursor: pointer; transition: all 0.15s; }
.interval-seg button:hover { color: var(--text); }
.interval-seg button.active { background: var(--grad); color: #fff; box-shadow: var(--shadow-glow); }
.chart-canvas { height: 440px; width: 100%; }
.chart-plot { position: relative; }
.ax-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.chart-msg { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; color: var(--muted); font-size: 0.88rem; font-family: var(--mono); background: rgba(6, 9, 15, 0.6); pointer-events: none; }
@media (max-width: 700px) { .chart-canvas { height: 320px; } }
.ohlc-tip { position: absolute; top: 10px; left: 12px; z-index: 5; display: flex; gap: 13px; padding: 7px 12px; border-radius: 8px; background: rgba(6, 9, 15, 0.9); border: 1px solid var(--border-strong); font-family: var(--mono); font-size: 0.76rem; font-variant-numeric: tabular-nums; pointer-events: none; }
.ohlc-tip span b { color: var(--faint); font-weight: 600; margin-right: 4px; }
.pos-badge { position: absolute; top: 10px; right: 12px; z-index: 5; padding: 9px 13px; border-radius: 9px; background: rgba(6, 9, 15, 0.9); border: 1px solid var(--border-strong); font-family: var(--mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; pointer-events: none; }
.pos-badge .row { display: flex; gap: 14px; }
.pos-badge .lab { color: var(--faint); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--border); border-radius: 15px; background: linear-gradient(180deg, rgba(20, 26, 40, 0.82), rgba(10, 14, 22, 0.82)); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.two-col .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 0.74rem; letter-spacing: 0.14em; color: var(--muted); font-weight: 700; }
.panel-head .faint { font-size: 0.7rem; letter-spacing: 0.08em; font-family: var(--mono); }

table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.82rem; }
thead th { text-align: right; color: var(--faint); font-size: 0.66rem; letter-spacing: 0.1em; font-weight: 700; padding: 0 0 9px; border-bottom: 1px solid var(--border); text-transform: uppercase; }
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td { text-align: right; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.045); font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }
td.sym, .sym { font-weight: 700; letter-spacing: 0.04em; }

.spark-wrap { height: 130px; width: 100%; }

/* strategy backtester */
.bt-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.bt-field { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.bt-field select, .bt-field input { background: rgba(8, 12, 20, 0.7); border: 1px solid var(--border); border-radius: 9px; color: var(--text); font-family: var(--mono); font-size: 0.85rem; padding: 8px 10px; }
.bt-field input { width: 110px; }
.bt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.bt-stat { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: rgba(255, 255, 255, 0.02); }
.bt-stat .bt-k { font-size: 0.62rem; letter-spacing: 0.12em; color: var(--faint); font-weight: 700; margin-bottom: 6px; }
.bt-stat .bt-v { font-family: var(--mono); font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bt-up { color: var(--good); }
.bt-down { color: var(--danger); }
.bt-note { color: var(--faint); font-size: 0.72rem; font-family: var(--mono); margin-top: 6px; line-height: 1.5; }
.bt-spark { height: 120px; width: 100%; margin-top: 8px; }
.bt-trades { max-height: 260px; overflow-y: auto; }

.log-list { max-height: 300px; overflow-y: auto; }
.log-list .log-row { font-family: var(--mono); font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  body::before { animation: none; }
}
