:root {
  --bg: #08111d; --bg2: #0b1624; --panel: #0e1a2a; --panel2: #112033; --line: #1c2c42; --line2: #26395a;
  --text: #e6edf6; --muted: #8b9ab0; --dim: #5f6f86;
  --teal: #2fd3b5; --teal-d: #0f3d3a; --teal-bg: #0c2a2c; --blue: #5b8cff; --amber: #f5b03c;
  --green: #34d399; --red: #f87171; --red-bg: #2a1418; --green-bg: #0c2a22;
  --r: 12px; --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.pos { color: var(--green); } .neg { color: var(--red); }
.eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--teal); display: grid; place-items: center; color: #06231f; flex: none; }
.brand b { font-size: 14px; letter-spacing: 0.02em; } .brand b span { color: var(--teal); }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.nav { padding: 6px 8px; overflow-y: auto; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #c4cfdd; margin-bottom: 2px; text-decoration: none; }
.nav a:hover { background: var(--panel2); }
.nav a.on { background: var(--teal-d); color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav .badge { margin-left: auto; }
.nav .sect { font-size: 10px; letter-spacing: 0.16em; color: var(--dim); padding: 18px 12px 6px; text-transform: uppercase; }
.side .me { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 9px; background: var(--teal-d); color: var(--teal); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.me b { display: block; font-size: 13px; } .me small { color: var(--teal); font-size: 11px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: rgba(8,17,29,0.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar .live { font-size: 11px; letter-spacing: 0.12em; color: var(--teal); text-transform: uppercase; display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(47,211,181,0.15); }
.dot.off { background: var(--dim); box-shadow: none; }
.topbar .sp { flex: 1; }
.topbar .role { font-size: 11px; color: var(--amber); letter-spacing: 0.08em; text-transform: uppercase; }
.burger { display: none; background: none; border: 0; padding: 4px; }
.page { padding: 26px 28px 60px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sp { flex: 1; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card + .card { margin-top: 16px; }
.card h3 + p { margin-top: 4px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; text-decoration: none !important; color: var(--text); }
.btn:hover { border-color: #3a5480; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #052520; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: #4a2228; background: var(--red-bg); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: #13233a; color: #9fb0c8; border: 1px solid var(--line); white-space: nowrap; }
.tag-ok { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; padding: 5px 9px; border-radius: 6px; border: 1px solid #1f6b55; background: var(--green-bg); color: var(--green); }
.tag-no { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; padding: 5px 9px; border-radius: 6px; border: 1px solid var(--line2); color: var(--muted); }
.tag-lock { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; padding: 5px 9px; border-radius: 6px; border: 1px solid #5a4415; color: var(--amber); background: #261d0b; }
.badge { min-width: 20px; height: 20px; border-radius: 10px; background: #1b2a42; color: #9fb0c8; font-size: 11px; display: inline-grid; place-items: center; padding: 0 6px; }
.badge.t { background: var(--teal-d); color: var(--teal); }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; padding: 3px 9px; border-radius: 6px; letter-spacing: 0.04em; }
.status.LONG, .status.BUY { color: var(--green); background: var(--green-bg); }
.status.SHORT, .status.SELL { color: var(--red); background: var(--red-bg); }
.status.FLAT, .status.EXIT, .status.ALERT { color: var(--muted); background: #16243a; }
.banner { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r); border: 1px solid #1f6b55; background: linear-gradient(90deg, #0c2a26, #0b1d22); margin-bottom: 20px; }
.banner b { white-space: nowrap; color: var(--teal); letter-spacing: 0.04em; font-size: 13px; }
.banner .sp { flex: 1; }
.banner.warn { border-color: #5a4415; background: #1d170b; } .banner.warn b { color: var(--amber); }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); margin-bottom: 18px; }
.tabs button { background: none; border: 0; padding: 8px 14px; border-radius: 8px; color: #b5c2d4; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.tabs button.on { background: var(--panel2); color: var(--teal); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .sp { flex: 1; }
.search { position: relative; flex: 1; min-width: min(220px, 100%); max-width: 460px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--dim); }
.search input { padding-left: 36px; }
input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
textarea { resize: vertical; min-height: 90px; }
input[type=checkbox] { width: auto; accent-color: var(--teal); }
input[type=date] { color-scheme: dark; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > label.f { flex: 1; min-width: 140px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* strategy card */
.s-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 12px; border-top: 2px solid var(--teal); transition: border-color .15s, transform .15s; cursor: pointer; }
.s-card:hover { border-color: var(--line2); transform: translateY(-1px); }
.s-card.f-optmath { border-top-color: var(--blue); } .s-card.f-original { border-top-color: #3a4d6b; }
.s-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.s-card .ico { width: 38px; height: 38px; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line2); display: grid; place-items: center; color: var(--teal); }
.s-card h3 { font-size: 17px; font-weight: 600; }
.s-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.s-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.s-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: auto; }
.stat small { display: block; color: var(--muted); font-size: 11px; } .stat b { font-size: 15px; }
.s-card .live { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--bg2); border-radius: 8px; padding: 8px 10px; }
.s-card .foot { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; color: var(--teal); font-weight: 600; }
.fam-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 28px 0 12px; }

/* KPIs */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.kpi small { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.kpi b { display: block; font-size: 24px; margin-top: 4px; font-weight: 700; letter-spacing: -0.02em; }
.kpi i { font-style: normal; font-size: 12px; color: var(--muted); }
.hero-stats { display: flex; gap: 12px; }
.hero-stats .box { border: 1px solid var(--line2); border-radius: 10px; padding: 12px 18px; text-align: center; min-width: 108px; }
.hero-stats b { font-size: 24px; display: block; } .hero-stats small { font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; letter-spacing: 0.04em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel2); white-space: nowrap; position: sticky; top: 0; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #0f1e31; }
td.r, th.r { text-align: right; }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* charts */
.chart { width: 100%; height: 260px; display: block; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--dim); font-size: 10.5px; font-family: var(--font); }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.months div { border-radius: 7px; padding: 7px 8px; font-size: 11px; background: #13233a; }
.months div b { display: block; font-size: 13px; }

/* code */
pre.code { background: #060d17; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow: auto; max-height: 520px; font: 12.5px/1.55 var(--mono); color: #cfe3ff; margin: 0; white-space: pre; }
.locked { position: relative; border: 1px dashed #5a4415; border-radius: var(--r); padding: 28px; text-align: center; background: repeating-linear-gradient(45deg, #0d1828, #0d1828 10px, #0e1a2b 10px, #0e1a2b 20px); }
.locked h3 { margin: 8px 0; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(2,6,12,0.7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px; }
.modal.wide { width: min(900px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal header button { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--teal); padding: 12px 16px; border-radius: 10px; z-index: 60; max-width: 380px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); animation: tin .2s ease; }
.toast.bad { border-left-color: var(--red); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.flash { animation: flash 1.6s ease; }
@keyframes flash { 0% { background: rgba(47,211,181,0.25); } 100% { background: transparent; } }

/* public pages */
.pub { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.pub-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.pub-top nav { display: flex; gap: 10px; align-items: center; }
.hero { padding: 70px 0 50px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: 46px; line-height: 1.1; letter-spacing: -0.03em; }
.hero h1 em { font-style: normal; color: var(--teal); }
.hero p { font-size: 17px; color: var(--muted); max-width: 560px; }
.hero .cta { display: flex; gap: 12px; margin-top: 26px; }
.ticker { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.ticker .t-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ticker .t-row:last-child { border: 0; }
.section { padding: 40px 0; }
.section > h2 { font-size: 28px; margin-bottom: 8px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.plan.hot { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }
.plan .price { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { padding: 0; margin: 6px 0 12px; list-style: none; } .plan li { padding: 4px 0 4px 22px; position: relative; color: #c4cfdd; }
.plan li::before { content: '✓'; position: absolute; left: 0; color: var(--teal); font-weight: 700; }
.plan .btn { margin-top: auto; }
.auth { max-width: 420px; margin: 50px auto; }
.disclaimer { font-size: 12px; color: var(--dim); border-top: 1px solid var(--line); padding: 22px 0 40px; margin-top: 30px; }
.steps { counter-reset: s; } .steps li { margin-bottom: 8px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: 1fr 1fr; } .hero { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,0.6); }
  .burger { display: block; }
  .page { padding: 18px 16px 50px; }
  .topbar { padding: 10px 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; } .hero { padding-top: 30px; }
  .hero-stats { flex-wrap: wrap; }
  .topbar .live span.t { display: none; }
}
