@font-face { font-family: 'Chakra Petch'; font-weight: 500; font-display: swap; src: url(/fonts/chakra-petch-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 600; font-display: swap; src: url(/fonts/chakra-petch-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 700; font-display: swap; src: url(/fonts/chakra-petch-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url(/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url(/fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --bg: #03050a;
  --bg2: #060a11;
  --panel: #0a0f18;
  --panel2: #0e1521;
  --line: rgba(170, 195, 230, 0.11);
  --line2: rgba(170, 195, 230, 0.2);
  --text: #e8eef7;
  --muted: #8b97a9;
  --dim: #5a6577;
  --accent: #5ce1ff;
  --accent-ink: #02141a;
  --violet: #9b8cff;
  --ok: #3ef0a1;
  --warn: #ffc85c;
  --bad: #ff5c7a;
  --chrome: linear-gradient(180deg, #ffffff 0%, #d3dbe6 34%, #7b879a 50%, #e6ecf4 68%, #9aa5b6 100%);
  --display: 'Chakra Petch', ui-sans-serif, system-ui, sans-serif;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px;
  --header-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: rgba(92, 225, 255, .3); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.chrome-text {
  background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.kicker { font: 500 12px/1 var(--mono); letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }

/* ── Header ───────────────────────────────────────── */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; gap: 18px; padding: 0 clamp(16px, 3vw, 36px);
  background: linear-gradient(180deg, rgba(3, 5, 10, .92), rgba(3, 5, 10, .6));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 21px/1 var(--display); letter-spacing: .14em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 12px; border-radius: 9px; color: var(--muted); font-size: 14px; transition: color .2s, background .2s; }
.nav a:hover, .nav a.active { color: var(--text); background: rgba(255, 255, 255, .04); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.ca-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line2); background: rgba(10, 15, 24, .8); font: 500 12.5px/1 var(--mono); color: var(--muted);
  cursor: pointer; white-space: nowrap; transition: border-color .2s, color .2s;
}
.ca-chip b { color: var(--text); font-weight: 500; }
.ca-chip:hover { border-color: var(--accent); color: var(--text); }
.ca-chip.soon { cursor: default; }
.ca-chip.soon:hover { border-color: var(--line2); color: var(--muted); }
.ca-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.ca-chip.live .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line2); background: rgba(10, 15, 24, .8); transition: border-color .2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; fill: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer;
  font: 600 14px/1 var(--sans); letter-spacing: .01em; transition: transform .15s, border-color .2s, background .2s, box-shadow .2s;
  white-space: nowrap;
}
.btn:hover { border-color: rgba(255, 255, 255, .35); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary {
  border: 0; color: #05070c; background: var(--chrome);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 8px 30px -10px rgba(220, 235, 255, .55);
}
.btn-primary:hover { box-shadow: 0 0 0 1px rgba(255, 255, 255, .5) inset, 0 10px 36px -8px rgba(92, 225, 255, .55); }
.btn-accent { border: 0; color: var(--accent-ink); background: var(--accent); box-shadow: 0 8px 30px -12px var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: rgba(255, 92, 122, .35); background: rgba(255, 92, 122, .06); }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

/* ── Panels / badges ──────────────────────────────── */
.panel {
  background: linear-gradient(180deg, rgba(14, 21, 33, .9), rgba(9, 13, 21, .9));
  border: 1px solid var(--line); border-radius: var(--r); padding: 20px;
}
.panel-title { font: 600 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font: 500 11.5px/1 var(--mono); letter-spacing: .04em; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.pending_confirmation, .badge.waiting { color: var(--warn); border-color: rgba(255, 200, 92, .3); }
.badge.executing { color: var(--accent); border-color: rgba(92, 225, 255, .35); }
.badge.filled { color: var(--ok); border-color: rgba(62, 240, 161, .3); }
.badge.partially_filled { color: var(--ok); border-color: rgba(62, 240, 161, .3); }
.badge.failed { color: var(--bad); border-color: rgba(255, 92, 122, .3); }
.badge.cancelled, .badge.expired { color: var(--dim); }
.badge.soon { color: var(--violet); border-color: rgba(155, 140, 255, .35); }

/* ── Toast ────────────────────────────────────────── */
.toasts { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast {
  padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(10, 15, 24, .96);
  font-size: 14px; max-width: 360px; box-shadow: 0 20px 50px -20px #000; animation: toastIn .25s ease-out;
}
.toast.err { border-color: rgba(255, 92, 122, .45); }
.toast.ok { border-color: rgba(62, 240, 161, .4); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ── Order Card ───────────────────────────────────── */
.order-card {
  position: relative; border-radius: 14px; padding: 16px; margin-top: 10px; overflow: hidden;
  border: 1px solid var(--line2); background:
    radial-gradient(120% 140% at 100% 0%, rgba(92, 225, 255, .08), transparent 55%),
    linear-gradient(180deg, #0f1724, #0a0f18);
}
.order-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--chrome);
}
.oc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.oc-title { font: 600 15px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.oc-legs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 12px; }
.oc-leg { background: rgba(255, 255, 255, .025); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.oc-leg small { display: block; color: var(--dim); font: 500 10.5px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.oc-leg strong { display: block; font: 500 16px/1.25 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-arrow { color: var(--accent); font-size: 18px; }
.oc-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; font-size: 12.5px; margin-bottom: 12px; }
.oc-meta div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line); padding: 4px 0; min-width: 0; }
.oc-meta span:first-child { color: var(--dim); flex-shrink: 0; }
.oc-meta span:last-child { font-family: var(--mono); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-note { font-size: 12.5px; color: var(--warn); margin: -4px 0 10px; }
.oc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.oc-progress { font: 12.5px/1.4 var(--mono); color: var(--muted); margin-top: 10px; }
.oc-progress a { color: var(--accent); }

/* ── Utilities ────────────────────────────────────── */
.wrap { width: min(1180px, 100% - 40px); margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.hide { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer {
  border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 13px; position: relative; z-index: 2; background: var(--bg);
}
.site-footer .wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.site-footer .links { margin-left: auto; display: flex; gap: 16px; }
.site-footer a:hover { color: var(--text); }

@media (max-width: 860px) {
  .nav { display: none; }
  .ca-chip .ca-label { display: none; }
}
@media (max-width: 560px) {
  :root { --header-h: 60px; }
  .site-header { gap: 10px; }
  .brand span { display: none; }
  .header-right { gap: 6px; }
  .ca-chip { padding: 0 10px; font-size: 11.5px; }
  .header-right .btn { padding: 0 12px; font-size: 13px; }
  .oc-meta { grid-template-columns: minmax(0, 1fr); }
}
