/* ==========================================================================
   Algocron UI
   ========================================================================== */
:root {
  --bg: #0a0b0c;
  --bg-2: #111315;
  --glass: rgba(24, 26, 29, 0.86);
  --glass-2: rgba(32, 35, 39, 0.9);
  --line: rgba(217, 221, 226, 0.1);
  --line-2: rgba(217, 221, 226, 0.2);
  --text: #eef1f4;
  --muted: #9ba2aa;
  --dim: #5f666e;
  --accent: #d9dde2;
  --lime: #e6f0ff;
  --ink: #0a0b0c; /* text on steel */
  --pink: #c9bcff;
  --yellow: #e6f0ff;
  --purple: #c9bcff;
  --green: #7ee2a8;
  --red: #ff5f57;
  --amber: #f2c46d;
  --grad: linear-gradient(180deg, #f4f6f8 0%, #c9ced4 48%, #9aa1a9 52%, #e3e7eb 100%);
  --radius: 0px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 0 0 1px var(--line) inset;
  --cut: 14px;
  font-family: "Inter Tight", system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 80% -10%, #0a2a16 0%, transparent 60%), var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.88em; }
::selection { background: rgba(217, 221, 226, 0.4); color: #fff; }

/* ---------- background layers ---------- */
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55; }
.aurora { position: fixed; inset: -20%; z-index: 0; pointer-events: none; filter: blur(80px); opacity: 0.5; }
.aurora span { position: absolute; width: 45vw; height: 45vw; border-radius: 50%; mix-blend-mode: screen; }
.aurora span:nth-child(1) { background: #3fbf6a; top: 0; left: 10%; animation: drift1 22s ease-in-out infinite alternate; }
.aurora span:nth-child(2) { background: #c2508f; bottom: 0; right: 5%; animation: drift2 26s ease-in-out infinite alternate; }
.aurora span:nth-child(3) { background: #3b8fb5; top: 40%; left: 45%; width: 30vw; height: 30vw; opacity: 0.5; animation: drift3 30s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(20vw, 15vh) scale(1.2); } }
@keyframes drift2 { to { transform: translate(-25vw, -10vh) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-15vw, 20vh) scale(1.3); } }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); transition: opacity 0.7s var(--ease), visibility 0.7s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-logo { display: grid; justify-items: center; gap: 22px; }
.boot-ring { width: 120px; height: 120px; }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 6; }
.ring-draw {
  fill: none; stroke: url(#brand-grad); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 315; stroke-dashoffset: 315; transform: rotate(-90deg); transform-origin: center;
  animation: draw 1.1s var(--ease) forwards;
}
.hand { stroke: #fff; stroke-width: 5; stroke-linecap: round; transform-origin: 60px 60px; }
.hand-m { animation: spin 1.2s var(--ease) forwards; }
.hand-h { animation: spin 1.6s var(--ease) forwards; opacity: 0.7; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes spin { from { transform: rotate(-360deg); } to { transform: rotate(0); } }
.boot-word { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; display: flex; }
.boot-word span { display: inline-block; opacity: 0; transform: translateY(24px) rotateX(80deg); animation: letter 0.6s var(--spring) forwards; }
.boot-word span:nth-child(n) { animation-delay: calc(0.35s + var(--i, 0) * 0.05s); }
.grad, .grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes letter { to { opacity: 1; transform: none; } }

/* ---------- shell ---------- */
#app { position: relative; z-index: 1; min-height: 100vh; opacity: 0; transition: opacity 0.6s var(--ease) 0.1s; }
body.ready #app { opacity: 1; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  background: rgba(18, 19, 24, 0.55); border-bottom: 1px solid var(--line);
}
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.03em; }
.brand b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { width: 30px; height: 30px; }
.brand-hand { transform-origin: 32px 32px; animation: tick 60s steps(60) infinite; }
@keyframes tick { to { transform: rotate(360deg); } }

nav { position: relative; display: flex; gap: 4px; padding: 5px; margin: 0 auto; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
nav button {
  position: relative; z-index: 1; border: 0; background: none; padding: 9px 18px; border-radius: 999px;
  color: var(--muted); font-weight: 600; cursor: pointer; display: flex; gap: 8px; align-items: center; transition: color 0.3s;
}
nav button i { font-style: normal; opacity: 0.8; }
nav button:hover { color: #fff; }
nav button.active { color: var(--ink); }
.nav-pill {
  position: absolute; z-index: 0; top: 5px; bottom: 5px; border-radius: 999px; background: var(--grad);
  box-shadow: 0 6px 24px -4px rgba(217, 221, 226, 0.7); transition: left 0.5s var(--spring), width 0.5s var(--spring);
}
.conn { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 0 var(--amber); animation: ping 2s infinite; }
.conn.ok .dot { background: var(--green); --c: var(--green); }
.conn.bad .dot { background: var(--red); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(217, 221, 226, 0.6); } 80%, 100% { box-shadow: 0 0 0 10px rgba(217, 221, 226, 0); } }

main { max-width: 1320px; margin: 0 auto; padding: 32px 28px 80px; }
.view { display: none; }
.view.active { display: block; animation: viewIn 0.6s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(0.99); filter: blur(6px); } }
.reveal { opacity: 0; transform: translateY(22px); }
.view.active .reveal { animation: rise 0.8s var(--ease) forwards; }
.view.active .reveal:nth-child(2) { animation-delay: 0.08s; }
.view.active .reveal:nth-child(3) { animation-delay: 0.16s; }
.view.active .reveal:nth-child(4) { animation-delay: 0.24s; }
.grid-2 .reveal:nth-child(2) { animation-delay: 0.3s !important; }
@keyframes rise { to { opacity: 1; transform: none; } }

h1 { font-size: clamp(34px, 5vw, 58px); line-height: 1.02; letter-spacing: -0.045em; margin: 6px 0 14px; font-weight: 800; }
h2 { font-size: 34px; letter-spacing: -0.04em; margin: 0; }
h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.sub { color: var(--muted); margin: 6px 0 0; font-size: 15.5px; line-height: 1.5; }
.eyebrow { color: var(--lime); font-weight: 600; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; margin: 0; }

/* ---------- cards ---------- */
.card {
  position: relative; background: var(--glass); border-radius: var(--radius); padding: 22px;
  backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); box-shadow: var(--shadow);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(217, 221, 226, 0.35), transparent 35%, transparent 65%, rgba(230, 240, 255, 0.25));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; margin-top: 20px; }

/* ---------- hero ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 32px; padding: 26px 0 30px; }
.hero h1 { max-width: 640px; }
.hero-stats { display: flex; align-items: center; gap: 26px; }
.stat-orb { position: relative; width: 168px; height: 168px; border-radius: 50%; }
.stat-orb::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; box-shadow: 0 0 40px -6px rgba(217, 221, 226, 0.55), inset 0 0 30px -10px rgba(230, 240, 255, 0.4); }
.stat-orb svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.orb-track { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 7; }
.orb-fill { fill: none; stroke: url(#brand-grad); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 276.5; stroke-dashoffset: 276.5; transition: stroke-dashoffset 1.4s var(--ease); }
.orb-inner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.orb-inner small, .mini-stats small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.orb-inner b { font-size: 30px; letter-spacing: -0.03em; }
.mini-stats { display: grid; gap: 16px; }
.mini-stats div { display: grid; }
.mini-stats b { font-size: 24px; letter-spacing: -0.02em; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.flash-up { animation: flashUp 0.9s var(--ease); }
.flash-down { animation: flashDown 0.9s var(--ease); }
@keyframes flashUp { 30% { color: var(--green); text-shadow: 0 0 18px var(--green); transform: scale(1.08); } }
@keyframes flashDown { 30% { color: var(--red); text-shadow: 0 0 18px var(--red); transform: scale(1.08); } }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 18px; cursor: pointer;
  background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); transition: transform 0.4s var(--spring), border-color 0.3s, background 0.3s;
}
.step:hover { transform: translateY(-4px); border-color: rgba(217, 221, 226, 0.5); background: rgba(217, 221, 226, 0.08); }
.step .n { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: var(--ink); background: var(--grad); box-shadow: 0 8px 20px -6px rgba(217, 221, 226, 0.8); }
.step p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

/* ---------- buttons / chips / forms ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  border-radius: 12px; padding: 11px 18px; font-weight: 650; overflow: hidden; isolation: isolate;
  transition: transform 0.25s var(--spring), box-shadow 0.3s, background 0.3s, opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.big { width: 100%; padding: 15px; font-size: 16px; border-radius: 14px; }
.btn.primary { background: var(--grad); color: var(--ink); box-shadow: 0 10px 30px -10px rgba(217, 221, 226, 0.9); }
.btn.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 40px -10px rgba(230, 240, 255, 0.7); }
.btn.primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform 0.8s var(--ease);
}
.btn.primary:hover::after { transform: translateX(120%); }
.btn.ghost { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); }
.btn.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.btn.danger { background: linear-gradient(120deg, #e5383b, #ff5c6a); color: #fff; }
.btn .spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(3, 20, 10, 0.3); border-top-color: var(--ink); animation: rot 0.7s linear infinite; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-label { opacity: 0.8; }
@keyframes rot { to { transform: rotate(360deg); } }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: rgba(255, 255, 255, 0.45); animation: ripple 0.6s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-2); color: var(--muted); }
.chip.paper { color: var(--lime); border-color: rgba(230, 240, 255, 0.35); background: rgba(230, 240, 255, 0.08); }
.chip.live { color: var(--red); border-color: rgba(255, 92, 106, 0.4); background: rgba(255, 92, 106, 0.1); }
.chip.signals { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); }
.chip.ok { color: var(--green); border-color: rgba(217, 221, 226, 0.4); background: rgba(217, 221, 226, 0.08); }
.live-badge { display: inline-flex; gap: 6px; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: 0.15em; color: var(--red); }
.live-badge span { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(18, 19, 24, 0.55);
  color: var(--text); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(217, 221, 226, 0.18); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), rgba(255, 255, 255, 0.1) var(--p, 50%)); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(217, 221, 226, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4); cursor: grab; transition: transform 0.2s var(--spring); }
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.25); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 5px rgba(217, 221, 226, 0.35); }
output { color: var(--text); font-weight: 700; float: right; }
.row { display: flex; gap: 8px; align-items: center; }
.upload { white-space: nowrap; color: var(--text); }

.seg { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(18, 19, 24, 0.55); border: 1px solid var(--line-2); position: relative; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; position: relative; z-index: 1; transition: color 0.25s; }
.seg button.on { color: #fff; }
.seg .seg-pill { position: absolute; top: 4px; bottom: 4px; border-radius: 9px; background: var(--glass-2); box-shadow: 0 0 0 1px rgba(217, 221, 226, 0.5), 0 6px 18px -6px rgba(217, 221, 226, 0.8); transition: left 0.45s var(--spring), width 0.45s var(--spring); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line-2); background: rgba(18, 19, 24, 0.5); color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.3s var(--spring); }
.chips button.on { color: var(--ink); border-color: transparent; background: var(--grad); transform: scale(1.06); box-shadow: 0 6px 18px -6px rgba(217, 221, 226, 0.9); }
.hint { font-weight: 400; color: var(--dim); font-size: 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.toggle input { display: none; }
.toggle .sw { width: 44px; height: 26px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); position: relative; transition: background 0.3s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.35s var(--spring); }
.toggle input:checked + .sw { background: var(--grad); }
.toggle input:checked + .sw::after { transform: translateX(18px); }

/* ---------- bots ---------- */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.bot-list { display: grid; gap: 10px; }
.bot-row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); transition: transform 0.3s var(--spring), border-color 0.3s; cursor: pointer; }
.bot-row:hover { transform: translateX(4px); border-color: rgba(217, 221, 226, 0.4); }
.bot-row .meta { flex: 1; min-width: 0; }
.bot-row .meta small { color: var(--muted); }
.bot-row .pnl { font-weight: 700; font-variant-numeric: tabular-nums; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex: none; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 0 rgba(217, 221, 226, 0.7); animation: ping 1.8s infinite; }

.bots-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.bot-cards { display: grid; gap: 14px; }
.bot-card { cursor: pointer; transition: transform 0.4s var(--spring), box-shadow 0.4s; opacity: 0; animation: rise 0.7s var(--ease) forwards; }
.bot-card:hover { transform: translateY(-3px); }
.bot-card.selected { box-shadow: var(--shadow), 0 0 0 1.5px var(--accent), 0 20px 50px -20px rgba(217, 221, 226, 0.8); }
.bot-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bot-card h3 { display: flex; gap: 10px; align-items: center; }
.bot-card .facts { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 14px; }
.bot-card .bottom { display: flex; justify-content: space-between; align-items: center; }
.bot-card .pnl { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.power { --s: 54px; width: var(--s); height: var(--s); border-radius: 50%; border: 0; cursor: pointer; position: relative; display: grid; place-items: center; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px var(--line-2); transition: transform 0.35s var(--spring), background 0.4s, box-shadow 0.4s; }
.power svg { width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 2.4; stroke-linecap: round; transition: stroke 0.3s; }
.power:hover { transform: scale(1.08); }
.power:active { transform: scale(0.92); }
.power.on { background: var(--grad); box-shadow: 0 0 0 6px rgba(217, 221, 226, 0.18), 0 10px 30px -6px rgba(230, 240, 255, 0.8); }
.power.on svg { stroke: var(--ink); }
.power.on::before, .power.on::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(230, 240, 255, 0.6); animation: halo 2s var(--ease) infinite; }
.power.on::after { animation-delay: 1s; }
@keyframes halo { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.power.busy { animation: rot 0.9s linear infinite; }

.bot-detail { min-height: 520px; }
.bot-detail.empty { display: grid; place-items: center; }
.empty-state { text-align: center; color: var(--muted); padding: 40px; }
.empty-icon { font-size: 34px; width: 72px; height: 72px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 22px; background: rgba(217, 221, 226, 0.12); animation: float 3s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head h3 { font-size: 22px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.kpi { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.kpi small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.kpi b { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.chart-wrap { position: relative; height: 340px; border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, rgba(18, 19, 24, 0.6), rgba(18, 19, 24, 0.25)); border: 1px solid var(--line); }
.chart-wrap canvas { width: 100%; height: 100%; display: block; }
.chart-legend { position: absolute; top: 10px; left: 12px; display: flex; gap: 12px; font-size: 12px; color: var(--muted); pointer-events: none; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.tabs { display: flex; gap: 4px; margin: 18px 0 10px; }
.tabs button { border: 0; background: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.tabs button.on { color: #fff; background: rgba(255, 255, 255, 0.07); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 300px; overflow: auto; }
.feed li { padding: 11px 13px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); font-size: 13.5px; display: flex; gap: 10px; align-items: baseline; animation: slideIn 0.5s var(--ease); }
.feed li .t { color: var(--dim); font-size: 12px; font-family: "JetBrains Mono", monospace; flex: none; }
.feed li .r { color: var(--muted); font-size: 12.5px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } }

.activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 330px; overflow: hidden; mask-image: linear-gradient(#000 80%, transparent); }
.activity li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); font-size: 13.5px; animation: dropIn 0.6s var(--spring); }
.activity .ico { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; background: rgba(255, 255, 255, 0.06); }
.activity .ico.buy { background: rgba(217, 221, 226, 0.15); color: var(--green); }
.activity .ico.sell { background: rgba(255, 92, 106, 0.15); color: var(--red); }
.activity .ico.win { background: rgba(217, 221, 226, 0.2); }
.activity small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px) scale(0.96); } }
.muted { color: var(--muted); }

.broker-card { display: flex; align-items: center; gap: 18px; margin-top: 20px; }
.broker-logo { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-weight: 900; font-size: 24px; background: linear-gradient(135deg, #1e3a8a, #0ea5e9); box-shadow: 0 10px 30px -10px #0ea5e9; }
.broker-body { flex: 1; }
.broker-body p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- build ---------- */
.build-layout { display: grid; grid-template-columns: 230px 1fr 280px; gap: 18px; align-items: start; }
.script-list { padding: 10px; }
.script-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.script-list li { padding: 11px 12px; border-radius: 12px; cursor: pointer; transition: background 0.25s, transform 0.3s var(--spring); }
.script-list li:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(3px); }
.script-list li.on { background: rgba(217, 221, 226, 0.16); box-shadow: inset 3px 0 0 var(--accent); }
.script-list li b { display: block; font-size: 14px; }
.script-list li small { color: var(--dim); font-size: 12px; }
.script-list li.err small { color: var(--red); }
.editor-card { padding: 0; overflow: hidden; }
.editor-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.editor-actions { display: flex; gap: 8px; }
#editor-wrap { height: 560px; }
#editor-wrap textarea { width: 100%; height: 100%; border: 0; border-radius: 0; background: transparent; font-family: "JetBrains Mono", monospace; font-size: 13.5px; resize: none; padding: 16px; }
.CodeMirror { height: 100%; background: transparent; color: #e2f5e9; font-family: "JetBrains Mono", monospace; font-size: 13.5px; line-height: 1.6; }
.CodeMirror-gutters { background: rgba(18, 19, 24, 0.4); border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: var(--dim); }
.CodeMirror-cursor { border-left: 2px solid var(--lime); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected { background: rgba(217, 221, 226, 0.3) !important; }
.CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.03); }
.cm-s-default .cm-keyword { color: #5eead4; }
.cm-s-default .cm-def { color: #7ee0a8; }
.cm-s-default .cm-variable-2 { color: #f78c6c; }
.cm-s-default .cm-string { color: #c3e88d; }
.cm-s-default .cm-number { color: #f78c6c; }
.cm-s-default .cm-comment { color: #5f7a6a; font-style: italic; }
.cm-s-default .cm-builtin { color: #aaff5c; }
.cm-s-default .cm-property { color: #b9f5cf; }
.cm-s-default .cm-operator { color: #89ddff; }
.cm-s-default .cm-variable { color: #eefaf2; }
.cm-s-default .cm-meta { color: #ffcb6b; }
.editor-msg { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease), padding 0.4s; font-size: 13.5px; }
.editor-msg.show { max-height: 100px; padding: 12px 16px; }
.editor-msg.ok { color: var(--green); }
.editor-msg.err { color: var(--red); font-family: "JetBrains Mono", monospace; }
.cheatsheet h4 { margin: 0 0 10px; }
.cheatsheet dl { margin: 0; display: grid; gap: 4px; }
.cheatsheet dt { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--lime); margin-top: 10px; }
.cheatsheet dd { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- backtest ---------- */
.bt-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.bt-form { display: grid; gap: 16px; position: sticky; top: 90px; }
.param-form { display: grid; gap: 16px; }
.param-form:empty { display: none; }
.bt-results { display: grid; gap: 16px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { padding: 16px; border-radius: 16px; background: var(--glass); box-shadow: var(--shadow); opacity: 0; animation: pop 0.6s var(--spring) forwards; }
.tile small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; }
.tile b { font-size: 26px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(0.92); } to { opacity: 1; transform: none; } }
.equity-svg { width: 100%; height: 280px; display: block; overflow: visible; }
.equity-line { fill: none; stroke: url(#eq-grad); stroke-width: 2.5; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(217, 221, 226, 0.7)); }
.equity-line.anim { animation: draw 2s var(--ease) forwards; }
.equity-area { opacity: 0; animation: fadeIn 1.2s var(--ease) 0.8s forwards; }
@keyframes fadeIn { to { opacity: 1; } }
.equity-dot { fill: #fff; filter: drop-shadow(0 0 8px var(--lime)); opacity: 0; animation: fadeIn 0.4s 1.9s forwards; }
.notice { font-size: 13px; color: var(--amber); background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.25); padding: 10px 14px; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--dim); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; }
td { padding: 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
tbody tr { opacity: 0; animation: rowIn 0.45s var(--ease) forwards; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.table-wrap { max-height: 420px; overflow: auto; }
.side-pill { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
.side-pill.buy { background: rgba(217, 221, 226, 0.15); color: var(--green); }
.side-pill.sell { background: rgba(255, 92, 106, 0.15); color: var(--red); }
.skeleton { height: 120px; border-radius: 16px; background: linear-gradient(100deg, rgba(255, 255, 255, 0.03) 30%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 70%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(2, 5, 3, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeIn 0.3s forwards; opacity: 0; padding: 20px; }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(640px, 100%); max-height: 90vh; overflow: auto; background: #1d1f27; border-radius: 24px; padding: 28px; box-shadow: 0 40px 120px -20px #000, 0 0 0 1px var(--line-2); animation: modalIn 0.55s var(--spring); }
.modal-card.narrow { width: min(440px, 100%); }
.modal-card p { color: var(--muted); line-height: 1.55; }
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(0.94); } }
.x { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.06); cursor: pointer; font-size: 20px; transition: transform 0.3s var(--spring), background 0.2s; }
.x:hover { transform: rotate(90deg); background: rgba(255, 255, 255, 0.12); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.bot-form { display: grid; gap: 18px; margin-top: 18px; }
.bot-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bot-form fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 16px; margin: 0; }
.bot-form legend { padding: 0 8px; font-weight: 700; font-size: 13px; color: var(--text); }
details.adv summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; list-style: none; }
details.adv summary::before { content: "▸ "; display: inline-block; transition: transform 0.3s; }
details.adv[open] summary::before { transform: rotate(90deg); }
details.adv[open] > div { animation: rise 0.5s var(--ease); }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mode-card { border: 1px solid var(--line-2); border-radius: 14px; padding: 13px; cursor: pointer; transition: all 0.35s var(--spring); background: rgba(18, 19, 24, 0.5); }
.mode-card b { display: block; color: var(--text); font-size: 14px; margin-bottom: 3px; }
.mode-card span { color: var(--dim); font-size: 12px; font-weight: 400; line-height: 1.35; display: block; }
.mode-card.on { border-color: var(--accent); background: rgba(217, 221, 226, 0.12); transform: translateY(-2px); box-shadow: 0 10px 30px -12px rgba(217, 221, 226, 0.9); }
.mode-card.on.live { border-color: var(--red); background: rgba(255, 92, 106, 0.1); box-shadow: 0 10px 30px -12px rgba(255, 92, 106, 0.9); }

/* ---------- toasts / confetti ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 10px; width: min(360px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: rgba(9, 18, 13, 0.92); backdrop-filter: blur(16px); box-shadow: 0 20px 50px -10px #000, 0 0 0 1px var(--line-2); animation: toastIn 0.6s var(--spring); position: relative; overflow: hidden; font-size: 14px; }
.toast.out { animation: toastOut 0.4s var(--ease) forwards; }
.toast .ti { font-size: 18px; }
.toast small { display: block; color: var(--muted); margin-top: 2px; font-size: 12.5px; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: var(--grad); animation: life 4.5s linear forwards; }
.toast.win { box-shadow: 0 20px 50px -10px #000, 0 0 0 1px rgba(217, 221, 226, 0.5), 0 0 40px -10px var(--green); }
.toast.loss { box-shadow: 0 20px 50px -10px #000, 0 0 0 1px rgba(255, 92, 106, 0.4); }
.toast.err::after { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) scale(0.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px) scale(0.9); } }
@keyframes life { from { width: 100%; } to { width: 0; } }
#confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .build-layout { grid-template-columns: 200px 1fr; }
  .cheatsheet { display: none; }
  .bots-layout, .bt-layout, .grid-2 { grid-template-columns: 1fr; }
  .bt-form { position: static; }
}
@media (max-width: 760px) {
  .topbar { padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  nav { order: 3; width: 100%; justify-content: space-between; }
  nav button { padding: 8px 10px; font-size: 13px; }
  nav button i { display: none; }
  .conn .txt { display: none; }
  main { padding: 20px 16px 60px; }
  .hero { flex-direction: column; align-items: flex-start; }
  .tiles, .kpis, .bot-form .two { grid-template-columns: 1fr 1fr; }
  .steps, .mode-cards { grid-template-columns: 1fr; }
  .hero-stats { width: 100%; justify-content: space-between; }
  .build-layout { grid-template-columns: 1fr; }
  #editor-wrap { height: 420px; }
  .view-head { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .aurora, #bg { display: none; }
}
[hidden] { display: none !important; }

/* ---------- strategy assistant ---------- */
.small { font-size: 12.5px; }
.build-switch { min-width: 280px; }
.assist-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.assist-side { display: grid; gap: 20px; min-width: 0; }
.assist-layout > *, .assist-side > * { min-width: 0; }
.tv-card .card-head { flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tv-note { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.tv-note a { color: var(--accent); text-decoration: none; font-weight: 600; }
.tv-note a:hover { text-decoration: underline; }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 560px; padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-head > div:nth-child(2) { flex: 1; min-width: 0; }
.chat-head small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.ai-orb { width: 38px; height: 38px; border-radius: 12px; background: var(--grad); position: relative; flex: none; box-shadow: 0 8px 24px -8px rgba(217, 221, 226, 0.9); overflow: hidden; }
.ai-orb span { position: absolute; inset: 7px; border-radius: 50%; border: 2.5px solid var(--ink); border-right-color: transparent; animation: rot 3s linear infinite; }
.ai-orb.busy span { animation-duration: 0.7s; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 88%; animation: msgIn 0.5s var(--spring) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: linear-gradient(135deg, rgba(217, 221, 226, 0.22), rgba(230, 240, 255, 0.12)); border: 1px solid rgba(217, 221, 226, 0.35); border-bottom-right-radius: 6px; }
.msg.bot .bubble { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-2); border-bottom-left-radius: 6px; }
.bubble { padding: 12px 15px; border-radius: 18px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; word-wrap: break-word; }
.bubble img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin-bottom: 8px; }
.bubble .pine-tag { display: inline-block; font-size: 12px; color: var(--lime); margin-top: 6px; }
.msg .script-pill { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(18, 19, 24, 0.6); border: 1px solid var(--line-2); cursor: pointer; transition: transform 0.3s var(--spring), border-color 0.3s; }
.msg .script-pill:hover { transform: translateY(-2px); border-color: rgba(217, 221, 226, 0.5); }
.script-pill .file { font-family: "JetBrains Mono", monospace; font-size: 13px; flex: 1; }
.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }
.step-text { margin-left: 10px; color: var(--muted); font-size: 13.5px; animation: fadeSwap 0.5s var(--ease); }
@keyframes fadeSwap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.welcome { margin: auto 0; text-align: center; padding: 10px 6px; animation: rise 0.8s var(--ease) both; }
.welcome h3 { font-size: 22px; letter-spacing: -0.03em; margin-bottom: 6px; }
.welcome p { color: var(--muted); margin: 0 auto 18px; max-width: 440px; line-height: 1.5; font-size: 14px; }
.ideas { display: grid; gap: 10px; text-align: left; }
.idea { padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); cursor: pointer; font-size: 13.5px; color: var(--text); transition: transform 0.35s var(--spring), border-color 0.3s, background 0.3s; opacity: 0; animation: rise 0.6s var(--ease) forwards; }
.idea:nth-child(1) { animation-delay: 0.15s; } .idea:nth-child(2) { animation-delay: 0.25s; } .idea:nth-child(3) { animation-delay: 0.35s; }
.idea:hover { transform: translateX(6px); border-color: rgba(217, 221, 226, 0.5); background: rgba(217, 221, 226, 0.07); }
.idea b { color: var(--accent); margin-right: 6px; }

.composer { border-top: 1px solid var(--line); padding: 12px 14px 14px; display: grid; gap: 10px; background: rgba(18, 19, 24, 0.35); }
.composer.drag { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(217, 221, 226, 0.08); }
.composer textarea { resize: none; border-radius: 14px; max-height: 180px; line-height: 1.5; }
.pine-input { font-family: "JetBrains Mono", monospace; font-size: 12.5px; min-height: 110px; max-height: 220px !important; resize: vertical !important; animation: rise 0.4s var(--ease); }
.composer-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-tools .grow { flex: 1; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all 0.25s; }
.tool-btn:hover, .tool-btn.on { color: var(--text); border-color: rgba(217, 221, 226, 0.5); background: rgba(217, 221, 226, 0.1); }
.tool-select { width: auto; padding: 7px 30px 7px 11px; font-size: 12.5px; border-radius: 10px; }
.send .arrow { font-weight: 900; transition: transform 0.3s var(--spring); }
.send:hover .arrow { transform: translateY(-3px); }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; }
.attachments:empty { display: none; }
.thumb { position: relative; width: 74px; height: 54px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); animation: pop 0.4s var(--spring) both; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 12px; cursor: pointer; line-height: 1; }

.tv-card { padding: 16px; }
.tv-chart { height: 330px; width: 100%; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: rgba(18, 19, 24, 0.6); }
.tv-fallback { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 13.5px; text-align: center; padding: 20px; }
.script-card { padding: 16px; }
.script-card .card-head { gap: 10px; }
.script-card .card-head h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-body { max-height: 340px; overflow: auto; border-radius: 12px; }
.gen-body pre { margin: 0; padding: 14px; background: rgba(18, 19, 24, 0.6); border: 1px solid var(--line); border-radius: 12px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; line-height: 1.6; color: #e2f5e9; white-space: pre; }
.gen-body pre .ln { display: block; opacity: 0; animation: lineIn 0.35s var(--ease) forwards; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.gen-body .kw { color: #5eead4; } .gen-body .str { color: #c3e88d; } .gen-body .com { color: #5f7a6a; font-style: italic; } .gen-body .num { color: #f78c6c; } .gen-body .fn { color: #7ee0a8; }
.gen-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.small-empty { padding: 26px; }
.small-empty .empty-icon { width: 56px; height: 56px; font-size: 24px; }
.badge-ok, .badge-bad { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; animation: pop 0.5s var(--spring) both; }
.badge-ok { color: var(--accent); background: rgba(217, 221, 226, 0.12); border: 1px solid rgba(217, 221, 226, 0.4); }
.badge-bad { color: var(--red); background: rgba(255, 92, 106, 0.1); border: 1px solid rgba(255, 92, 106, 0.4); }
.assist-banner { margin: 0 18px; margin-top: 12px; }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 10px; }

/* tradingview alert helper (bot detail) */
.tv-alert { display: grid; gap: 12px; animation: rise 0.5s var(--ease); }
.copy-row { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.bots-layout > *, .bot-detail, #detail-root { min-width: 0; }
.copy-row code { min-width: 0; }
.copy-row code, .copy-block { flex: 1; display: block; padding: 10px 12px; border-radius: 10px; background: rgba(18, 19, 24, 0.6); border: 1px solid var(--line-2); font-size: 12.5px; overflow-x: auto; white-space: pre; }
.copy-block { white-space: pre; }

@media (max-width: 1100px) {
  .assist-layout { grid-template-columns: 1fr; }
  .chat-card { height: 640px; }
}

/* ---------- login ---------- */
#login { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: radial-gradient(800px 600px at 50% 30%, rgba(217, 221, 226, 0.15), transparent 70%); }
#login[hidden] { display: none !important; }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; padding: 36px 30px; border-radius: 28px; background: rgba(9, 18, 13, 0.85); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 40px 120px -30px #000, 0 0 0 1px var(--line-2), 0 0 80px -30px rgba(217, 221, 226, 0.6); animation: modalIn 0.7s var(--spring); }
.login-card h2 { font-size: 28px; }
.login-card p { margin: 0 0 6px; color: var(--muted); font-size: 14.5px; }
.login-mark { width: 64px; height: 64px; filter: drop-shadow(0 0 18px rgba(217, 221, 226, 0.6)); animation: float 3s ease-in-out infinite; }
.login-card input { text-align: center; letter-spacing: 0.1em; }
.login-card small { min-height: 18px; color: var(--red); }
.login-card.shake { animation: shake 0.45s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
body.locked #app { filter: blur(10px); pointer-events: none; }

/* ---------- accounts ---------- */
.login-card.swap > * { animation: rise 0.5s var(--ease) both; }
.login-card.swap > *:nth-child(2) { animation-delay: 0.04s; } .login-card.swap > *:nth-child(3) { animation-delay: 0.08s; }
.login-card.swap > *:nth-child(4) { animation-delay: 0.12s; } .login-card.swap > *:nth-child(5) { animation-delay: 0.16s; }
.login-card.swap > *:nth-child(6) { animation-delay: 0.2s; } .login-card.swap > *:nth-child(7) { animation-delay: 0.24s; }
.login-card input[type="email"], .login-card input[type="password"] { text-align: left; letter-spacing: normal; }
.login-card .terms { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-weight: 400; font-size: 12.5px; color: var(--muted); line-height: 1.45; cursor: pointer; }
.login-card .terms input { margin-top: 2px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.login-card small.ok-msg { color: var(--accent); }
.auth-foot { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--muted); }
.auth-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }
.sent-ico { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 28px; background: rgba(217, 221, 226, 0.12); animation: float 3s ease-in-out infinite; }
.big-spin { display: inline-block !important; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(217, 221, 226, 0.25); border-top-color: var(--accent); animation: rot 0.8s linear infinite; }
.acct-btn { border: 0; background: none; padding: 0; cursor: pointer; margin-left: 4px; }
.acct-btn .avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--ink); background: var(--grad); box-shadow: 0 6px 18px -6px rgba(217, 221, 226, 0.9); transition: transform 0.3s var(--spring); }
.acct-btn:hover .avatar { transform: scale(1.08); }
.acct-menu { position: absolute; right: 24px; top: 64px; width: 250px; padding: 8px; border-radius: 16px; background: #1d1f27; box-shadow: 0 30px 80px -20px #000, 0 0 0 1px var(--line-2); display: grid; gap: 2px; z-index: 40; animation: modalIn 0.35s var(--spring); }
.acct-menu .menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu .menu-head b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.acct-menu .menu-head small { color: var(--muted); font-size: 12px; }
.acct-menu button { text-align: left; border: 0; background: none; color: var(--text); padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.acct-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.acct-menu .danger-text { color: var(--red); }
.chip.clickable { cursor: pointer; color: var(--accent); border-color: rgba(217, 221, 226, 0.4); }
.chip.clickable:hover { background: rgba(217, 221, 226, 0.12); }
.form-err { color: var(--red); min-height: 16px; }

/* ---------- stainless layer ---------- */
h1, h2, h3, h4, .brand, .boot-word, .kpi b, .tile b, .orb-inner b, .bot-card h3, .detail-head h3 { font-family: "Chakra Petch", "Inter Tight", sans-serif; text-transform: uppercase; letter-spacing: 0.02em; }
h1 { letter-spacing: 0; }
.eyebrow, .kpi small, .tile small, th, .orb-inner small, .mini-stats small, label { font-family: "JetBrains Mono", monospace; letter-spacing: 0.14em; }
.aurora { display: none; }
#bg { opacity: 0.25; }
body { background: radial-gradient(1200px 600px at 70% -10%, #1a1d21, transparent 60%), var(--bg); }
.card, .tile, .kpi, .bot-row, .step, .feed li, .activity li, .modal-card, .toast, .acct-menu, .login-card, .mode-card, .script-list li, .seg, .chips button, .signup-pill { border-radius: 0 !important; }
.card, .modal-card, .login-card, .tile {
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 1.5px), repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 3px), linear-gradient(135deg, #202326 0%, #15171a 40%, #1c1f22 62%, #121416 100%);
  box-shadow: inset 0 0 0 1px var(--line);
}
.card::before { display: none; }
.btn { border-radius: 0; clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px); font-family: "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: 0.1em; font-size: 12.5px; }
.btn.primary { background: var(--accent); color: var(--ink); box-shadow: none; }
.btn.primary:hover:not(:disabled) { background: #fff; transform: none; box-shadow: 0 0 30px -6px rgba(230, 240, 255, 0.6); }
.btn.primary::after { display: none; }
.btn.ghost { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line-2); }
.btn.danger { background: #ff5f57; }
nav { border-radius: 0; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
nav button { border-radius: 0; font-family: "JetBrains Mono", monospace; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
nav button i { display: none; }
.nav-pill { border-radius: 0; background: var(--accent); box-shadow: 0 0 24px -6px rgba(230, 240, 255, 0.6); }
.chip { border-radius: 0; font-family: "JetBrains Mono", monospace; letter-spacing: 0.1em; text-transform: uppercase; font-size: 10.5px; }
.chip.paper { color: var(--text); border-color: var(--line-2); background: rgba(255, 255, 255, 0.05); }
.chip.live { color: #ff5f57; } .chip.signals { color: #f2c46d; }
.step .n { border-radius: 0; background: var(--accent); color: var(--ink); clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.orb-fill { stroke: var(--lime); filter: drop-shadow(0 0 6px rgba(230, 240, 255, 0.6)); }
.stat-orb::before { box-shadow: 0 0 40px -10px rgba(230, 240, 255, 0.3); }
.power { border-radius: 0; clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.power.on { background: var(--accent); box-shadow: none; }
.power.on::before, .power.on::after { border-radius: 0; border-color: rgba(230, 240, 255, 0.6); }
.status-dot { border-radius: 0; transform: rotate(45deg); width: 8px; height: 8px; }
.status-dot.on { background: #7ee2a8; }
.avatar { border-radius: 0 !important; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); background: var(--accent) !important; box-shadow: none !important; }
input[type="text"], input[type="number"], input[type="password"], input[type="email"], select, textarea { border-radius: 0; }
.chips button.on, .mode-card.on { background: var(--accent); color: var(--ink); box-shadow: none; transform: none; }
.mode-card.on b, .mode-card.on span { color: var(--ink); }
.mode-card.on.live { background: #ff5f57; }
.seg .seg-pill { border-radius: 0; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px var(--line-2); }
.empty-icon { border-radius: 0; background: rgba(255, 255, 255, 0.06); clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.brand-mark { width: 26px; height: 26px; fill: var(--accent); }
.brand span { font-weight: 700; letter-spacing: 0.22em; font-size: 17px; }
.login-mark2 { width: 56px; height: 56px; fill: var(--accent); filter: drop-shadow(0 0 18px rgba(230, 240, 255, 0.35)); }
.acct-menu { clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.equity-line { stroke: var(--lime); filter: drop-shadow(0 0 6px rgba(230, 240, 255, 0.5)); }
.ai-orb { border-radius: 0; background: var(--accent); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); box-shadow: none; }
.ai-orb span { border-radius: 0; }
.msg.user .bubble { background: var(--accent); color: var(--ink); border: 0; border-radius: 0; clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%); }
.msg.bot .bubble { border-radius: 0; }
.idea b, .auth-link, .tv-note a { color: var(--lime); }
.toast::after, .how-progress i, .fill { background: var(--lime); }
.sent-ico { border-radius: 0; background: rgba(255, 255, 255, 0.06); }
.big-spin { border-top-color: var(--lime); border-radius: 0; }
.login-card .terms input { accent-color: #d9dde2; }
/* ---------- iridescent layer (colour + smoothness) ---------- */
:root {
  --c1: #5ee7ff; --c2: #7b6dff; --c3: #ff6bd6; --c4: #ffb86b;
  --iri: linear-gradient(110deg, var(--c1), var(--c2) 30%, var(--c3) 60%, var(--c4) 80%, var(--c1));
  --lime: #5ee7ff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes iri { to { background-position: 200% 0; } }
.aurora { display: block; opacity: 0.2; }
.aurora span:nth-child(1) { background: #7b6dff; } .aurora span:nth-child(2) { background: #ff6bd6; } .aurora span:nth-child(3) { background: #5ee7ff; }
.grad-text, .orb-inner b.pos { background: var(--iri); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: iri 8s linear infinite; }
.btn.primary, .nav-pill, .step .n, .chips button.on, .mode-card.on:not(.live), .avatar, .ai-orb, .msg.user .bubble, .modes span.on, .acct-btn .avatar {
  background: var(--iri) !important; background-size: 200% 100% !important; animation: iri 8s linear infinite; color: var(--ink);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.12) saturate(1.1); box-shadow: 0 0 34px -8px rgba(123, 109, 255, 0.8); background: var(--iri); background-size: 200% 100%; }
.card, .modal-card, .login-card, .tile {
  background:
    linear-gradient(90deg, var(--c1), var(--c2), var(--c3), var(--c4)) top / 100% 1.5px no-repeat,
    radial-gradient(60% 60% at 100% 0%, rgba(123, 109, 255, 0.1), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 3px),
    linear-gradient(135deg, #202326 0%, #15171a 40%, #1c1f22 62%, #121416 100%);
}
.orb-fill { stroke: #7b6dff; filter: drop-shadow(0 0 8px rgba(123, 109, 255, 0.8)); }
.power.on { background: var(--iri); background-size: 200% 100%; animation: iri 6s linear infinite; }
.power.on::before, .power.on::after { border-color: rgba(123, 109, 255, 0.7); }
.status-dot.on { background: var(--c1); }
.equity-line { stroke: #7b6dff; filter: drop-shadow(0 0 8px rgba(123, 109, 255, 0.7)); }
input:focus, select:focus, textarea:focus { border-color: var(--c2); box-shadow: 0 0 0 4px rgba(123, 109, 255, 0.18); }
.view.active { animation: viewIn 0.9s var(--ease); }
.view.active .reveal { animation: rise 1.1s var(--ease) forwards; }
.nav-pill { transition: left 0.7s var(--ease), width 0.7s var(--ease); }
.seg .seg-pill { transition: left 0.6s var(--ease), width 0.6s var(--ease); }
.toast::after { background: var(--iri); }
.idea b, .auth-link, .tv-note a, .cheatsheet dt { color: var(--c1); }
.login-mark2 { fill: url(#brand-grad); filter: drop-shadow(0 0 18px rgba(123, 109, 255, 0.5)); }
.brand-mark { fill: url(#brand-grad); }
