:root {
  color-scheme: dark;
  --bg: #090b0e;
  --panel: rgba(18, 21, 26, 0.88);
  --panel-strong: #13171c;
  --line: rgba(255, 255, 255, 0.085);
  --line-bright: rgba(255, 255, 255, 0.14);
  --text: #f4f6f8;
  --muted: #8b939e;
  --muted-2: #606873;
  --lime: #b6fa48;
  --lime-soft: rgba(182, 250, 72, 0.12);
  --purple: #8a6cff;
  --purple-soft: rgba(138, 108, 255, 0.14);
  --red: #ff5f72;
  --red-soft: rgba(255, 95, 114, 0.12);
  --amber: #f8bb55;
  --radius: 18px;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% -8%, rgba(116, 83, 255, 0.1), transparent 31%),
    linear-gradient(180deg, #090b0e 0%, #0b0e11 54%, #090b0d 100%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.ambient { position: fixed; z-index: -1; pointer-events: none; filter: blur(100px); opacity: 0.11; }
.ambient-one { width: 330px; height: 330px; border-radius: 50%; background: var(--lime); top: 28%; left: -230px; }
.ambient-two { width: 420px; height: 420px; border-radius: 50%; background: var(--purple); right: -300px; top: 62%; }
.shell { width: min(1500px, 100%); margin: 0 auto; padding: 0 36px 40px; }

.topbar {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(9, 11, 14, 0.82);
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { width: 35px; height: 35px; display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 7px; border: 1px solid rgba(182, 250, 72, 0.25); background: var(--lime-soft); border-radius: 10px; }
.brand-mark i { display: block; background: var(--lime); border-radius: 2px; }
.brand-mark i:nth-child(1) { height: 35%; }
.brand-mark i:nth-child(2) { height: 68%; }
.brand-mark i:nth-child(3) { height: 100%; }
.brand b { display: block; font-size: 15px; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--muted); font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.runtime-pill { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; font-weight: 700; }
.runtime-pill.running { border-color: rgba(182, 250, 72, 0.25); color: var(--lime); background: var(--lime-soft); }
.runtime-pill.error { border-color: rgba(255, 95, 114, 0.25); color: var(--red); background: var(--red-soft); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 3px rgba(96, 104, 115, 0.1); }
.running .status-dot { background: var(--lime); box-shadow: 0 0 0 3px rgba(182, 250, 72, 0.12), 0 0 12px var(--lime); animation: pulse 2s infinite; }
.error .status-dot { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.45; } }
.mode-control { height: 38px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 5px 0 12px; color: var(--muted); font-size: 11px; }
.mode-control select { border: 0; color: var(--text); background: #15191e; border-radius: 7px; padding: 6px 24px 6px 9px; outline: none; font-weight: 700; font-size: 11px; }
.btn, .icon-button, .text-button, .close-button { border: 0; cursor: pointer; transition: 160ms ease; }
.btn { min-height: 38px; border-radius: 10px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; font-weight: 800; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn-primary { color: #11150b; background: var(--lime); box-shadow: 0 8px 24px rgba(182, 250, 72, 0.1); }
.btn-primary:hover:not(:disabled) { background: #c5ff67; box-shadow: 0 10px 28px rgba(182, 250, 72, 0.18); }
.btn-stop { color: #ffcbd1; background: var(--red-soft); border: 1px solid rgba(255, 95, 114, 0.22); }
.btn-secondary { color: var(--text); background: #1b2026; border: 1px solid var(--line); }
.icon-button { width: 38px; height: 38px; border-radius: 10px; color: var(--muted); background: transparent; border: 1px solid var(--line); font-size: 16px; }
.icon-button:hover { color: var(--text); border-color: var(--line-bright); background: rgba(255,255,255,0.03); }
.play-icon { font-size: 9px; }

main { padding-top: 38px; }
.hero-row { display: grid; grid-template-columns: 1fr 430px; gap: 72px; align-items: end; padding: 36px 8px 44px; }
.eyebrow, .panel-kicker { color: var(--muted); text-transform: uppercase; letter-spacing: 0.17em; font-size: 10px; font-weight: 800; margin: 0 0 14px; }
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow span { width: 18px; height: 1px; background: var(--lime); }
h1 { margin: 0; font-size: clamp(42px, 5vw, 70px); line-height: 0.98; letter-spacing: -0.06em; font-weight: 700; }
h1 em { color: var(--lime); font-style: normal; font-weight: 500; }
.hero-copy { max-width: 580px; color: var(--muted); font-size: 15px; line-height: 1.65; margin: 22px 0 0; }
.strategy-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(21,25,30,0.96), rgba(15,18,22,0.9)); border-radius: var(--radius); padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,0.2); }
.strategy-card-head, .strategy-meta { display: flex; justify-content: space-between; align-items: center; }
.strategy-card-head span, .strategy-meta span { color: var(--muted); font-size: 11px; }
.strategy-card-head b { font-family: var(--mono); font-size: 20px; }
.strategy-track { height: 8px; display: grid; grid-template-columns: 1fr 0.55fr 1fr; gap: 3px; margin: 28px 0 9px; position: relative; }
.strategy-track span { border-radius: 6px; }
.loss-zone { background: linear-gradient(90deg, var(--red), rgba(255,95,114,0.25)); }
.neutral-zone { background: #343a42; }
.profit-zone { background: linear-gradient(90deg, rgba(182,250,72,0.25), var(--lime)); }
.strategy-track i { width: 13px; height: 13px; background: var(--text); border: 3px solid #191e23; border-radius: 50%; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--line-bright); }
.strategy-labels { display: flex; justify-content: space-between; color: var(--muted-2); font-family: var(--mono); font-size: 9px; }
.strategy-labels span:first-child { color: #ff8996; }
.strategy-labels span:last-child { color: var(--lime); }
.strategy-meta { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.strategy-meta strong { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 500; }
.strict-gate { display: grid; grid-template-columns: 9px 1fr; gap: 10px; align-items: center; margin-top: 15px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,0.018); }
.strict-gate-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); box-shadow: 0 0 0 4px rgba(255,255,255,0.025); }
.strict-gate b, .strict-gate small { display: block; }
.strict-gate b { font-size: 9px; margin-bottom: 4px; }
.strict-gate small { color: var(--muted-2); font-family: var(--mono); font-size: 8px; line-height: 1.45; }
.strict-gate.active { border-color: rgba(182,250,72,0.18); background: rgba(182,250,72,0.035); }
.strict-gate.active .strict-gate-dot { background: var(--lime); box-shadow: 0 0 0 4px var(--lime-soft); }
.strict-gate.rejected { border-color: rgba(255,95,114,0.18); background: rgba(255,95,114,0.035); }
.strict-gate.rejected .strict-gate-dot { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }

.wallet-selector { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 10px; }
.wallet-card { display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; text-align: left; padding: 18px 20px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.wallet-card:hover { border-color: var(--line-bright); }
.wallet-card.selected { border-color: rgba(182,250,72,.55); background: linear-gradient(125deg, rgba(182,250,72,.10), var(--panel)); }
.wallet-card span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.wallet-card strong { grid-column: 1; font: 700 27px var(--mono); letter-spacing: -.04em; }
.wallet-card small { grid-column: 1; color: var(--muted); font-size: 11px; }
.wallet-card em { grid-column: 2; grid-row: 2 / 4; align-self: center; color: var(--lime); font-size: 10px; font-style: normal; font-weight: 700; }
.wallet-view-label { color: var(--muted); font-size: 11px; font-weight: 700; margin: 0 0 12px 3px; }
.metrics { display: grid; grid-template-columns: 1.25fr repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); margin-bottom: 18px; }
.metric { min-height: 139px; padding: 24px 26px; border-left: 1px solid var(--line); position: relative; }
.metric:first-child { border-left: 0; }
.metric-featured { background: linear-gradient(140deg, rgba(182,250,72,0.06), transparent 72%); }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.info-dot { width: 14px; height: 14px; border: 1px solid var(--line-bright); border-radius: 50%; font-size: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted-2); }
.metric strong { display: block; font-family: var(--mono); font-size: 30px; margin: 15px 0 11px; letter-spacing: -0.04em; }
.metric-featured strong { color: var(--lime); }
.metric-featured strong.pnl-negative { color: var(--red); }
.metric-foot { color: var(--muted-2); font-size: 10px; }
.metric-foot span { color: var(--muted); }

.main-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.8fr); gap: 18px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); box-shadow: 0 20px 55px rgba(0,0,0,0.12); }
.panel-head { min-height: 82px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-kicker { margin-bottom: 5px; color: var(--lime); font-size: 8px; }
.panel-head h2, .dialog-head h2 { font-size: 16px; margin: 0; letter-spacing: -0.025em; }
.panel-note { color: var(--muted-2); font-size: 9px; font-family: var(--mono); }
.chart-wrap { height: 312px; padding: 20px 16px 14px; position: relative; }
#pnlChart { width: 100%; height: 100%; overflow: visible; }
.empty-state { position: absolute; inset: 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.empty-state span { font-size: 38px; color: var(--lime); opacity: 0.55; line-height: 1; }
.empty-state b { font-size: 12px; margin: 10px 0 5px; }
.empty-state small { color: var(--muted-2); font-size: 9px; }
.chart-grid { stroke: rgba(255,255,255,0.055); stroke-width: 1; stroke-dasharray: 2 5; }
.chart-axis-label { fill: #606873; font-size: 9px; font-family: var(--mono); }
.chart-area { fill: url(#areaGradient); }
.chart-line { fill: none; stroke: var(--lime); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 7px rgba(182,250,72,0.25)); }
.chart-point { fill: var(--lime); stroke: #11161a; stroke-width: 2; }
.live-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--lime); background: var(--lime-soft); padding: 6px 9px; border-radius: 12px; text-transform: uppercase; font-size: 7px; letter-spacing: 0.14em; font-weight: 800; }
.live-chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--lime); }
.activity-list { height: 312px; overflow: auto; padding: 8px 18px 16px; scrollbar-width: thin; scrollbar-color: #2b323a transparent; }
.activity { display: grid; grid-template-columns: 31px 1fr auto; gap: 10px; align-items: start; padding: 12px 2px; border-bottom: 1px solid rgba(255,255,255,0.045); }
.activity:last-child { border-bottom: 0; }
.activity-icon { width: 29px; height: 29px; display: flex; align-items: center; justify-content: center; border-radius: 9px; font-size: 11px; font-weight: 900; font-family: var(--mono); }
.activity.buy .activity-icon { color: var(--lime); background: var(--lime-soft); }
.activity.sell .activity-icon { color: var(--red); background: var(--red-soft); }
.activity.system .activity-icon { color: #ac9bff; background: var(--purple-soft); }
.activity b { display: block; font-size: 10px; margin: 1px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.activity small { display: block; color: var(--muted-2); font-size: 8px; font-family: var(--mono); }
.activity time { color: var(--muted-2); font-size: 8px; font-family: var(--mono); padding-top: 2px; }
.activity-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 10px; }

.table-panel { margin-bottom: 18px; overflow: hidden; }
.table-heading { min-height: 78px; }
.table-actions, .export-actions { display: flex; align-items: center; gap: 12px; }
.table-actions > span { color: var(--muted-2); font-size: 9px; }
.text-button { background: transparent; color: var(--muted); padding: 5px; font-size: 9px; font-weight: 700; }
.text-button:hover { color: var(--lime); }
.table-scroll { overflow: auto; position: relative; }
table { border-collapse: collapse; width: 100%; min-width: 850px; }
th { height: 39px; text-align: left; color: var(--muted-2); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; padding: 0 22px; background: rgba(255,255,255,0.012); border-bottom: 1px solid var(--line); }
td { height: 62px; padding: 0 22px; font-size: 10px; color: #c7cbd1; border-bottom: 1px solid rgba(255,255,255,0.045); font-family: var(--mono); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,0.018); }
.token-cell { display: flex; align-items: center; gap: 10px; font-family: var(--sans); }
.token-avatar { width: 29px; height: 29px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: linear-gradient(145deg, #2a323b, #171c21); color: var(--lime); font-size: 9px; font-weight: 900; border: 1px solid var(--line); }
.token-cell b { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.token-cell small { color: var(--muted-2); font-size: 8px; font-family: var(--mono); }
.pnl-positive { color: var(--lime); }
.pnl-negative { color: var(--red); }
.reason-chip { display: inline-flex; padding: 5px 8px; border-radius: 8px; font-size: 7px; font-weight: 800; letter-spacing: 0.08em; }
.reason-chip.win { color: var(--lime); background: var(--lime-soft); }
.reason-chip.loss { color: var(--red); background: var(--red-soft); }
.reason-chip.time { color: var(--amber); background: rgba(248,187,85,0.1); }
.table-empty { min-height: 110px; display: flex; align-items: center; justify-content: center; color: var(--muted-2); font-size: 10px; }

footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 3px 4px; color: var(--muted-2); font-size: 8px; text-transform: uppercase; letter-spacing: 0.08em; }

dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid var(--line-bright); border-radius: 20px; padding: 0; color: var(--text); background: #11151a; box-shadow: 0 30px 100px rgba(0,0,0,0.65); }
dialog::backdrop { background: rgba(3,5,7,0.72); backdrop-filter: blur(6px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 24px 26px 18px; border-bottom: 1px solid var(--line); }
.close-button { color: var(--muted); background: transparent; font-size: 25px; font-weight: 300; }
.close-button:hover { color: var(--text); }
.dialog-copy { margin: 20px 26px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
code { font-family: var(--mono); color: var(--lime); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 22px 26px; }
.form-grid label { display: grid; grid-template-columns: 1fr auto; gap: 7px; color: var(--muted); font-size: 9px; font-weight: 700; }
.form-grid label span { color: var(--muted-2); font-family: var(--mono); font-size: 8px; }
.form-grid input { grid-column: 1 / -1; width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #0c0f12; color: var(--text); padding: 0 12px; font-family: var(--mono); font-size: 11px; }
.form-grid input:focus { border-color: rgba(182,250,72,0.45); box-shadow: 0 0 0 3px rgba(182,250,72,0.07); }
.live-readiness { margin: 0 26px; border: 1px solid var(--line); background: rgba(255,255,255,0.018); border-radius: 11px; padding: 12px 14px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.live-readiness.ready { border-color: rgba(182,250,72,0.18); color: #cce8a0; background: rgba(182,250,72,0.04); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 20px 26px 24px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 25px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; background: #20262d; border: 1px solid var(--line-bright); border-radius: 11px; padding: 11px 16px; font-size: 10px; color: var(--text); box-shadow: 0 15px 50px rgba(0,0,0,0.35); transition: 180ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: #ffd0d6; border-color: rgba(255,95,114,0.3); }

@media (max-width: 1080px) {
  .hero-row { grid-template-columns: 1fr 370px; gap: 40px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3), .metric:nth-child(5) { border-left: 0; border-top: 1px solid var(--line); }
  .metric:nth-child(4), .metric:nth-child(5) { border-top: 1px solid var(--line); }
  .main-grid { grid-template-columns: 1fr; }
  .pulse-panel .activity-list { height: 260px; }
  .mode-control > span { display: none; }
}

@media (max-width: 760px) {
  .wallet-selector { grid-template-columns: 1fr; }
  .shell { padding: 0 15px 28px; }
  .topbar { height: auto; min-height: 72px; padding: 12px 0; align-items: flex-start; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 310px; }
  .runtime-pill { order: 4; height: 30px; }
  .mode-control { height: 34px; }
  .btn, .icon-button { min-height: 34px; height: 34px; }
  .hero-row { grid-template-columns: 1fr; gap: 30px; padding: 24px 0 34px; }
  h1 { font-size: 43px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { border-left: 0; border-top: 1px solid var(--line); min-height: 116px; }
  .metric:first-child { border-top: 0; }
  .panel-head { padding: 19px; }
  .chart-wrap { height: 270px; }
  .table-actions > span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; align-items: flex-start; gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
