/* 3body.bot dashboard. Dark instrument panel, mobile first; desktop layout from 1024px. */

:root {
  --bg: #05060A;
  --surface: #0C0F17;
  --surface-2: #121826;
  --well: #070910;
  --line: #1C2230;
  --line-2: #283044;
  --text: #E6EAF2;
  --muted: #8790A3;
  --faint: #5B6478;
  --up: #3DDC97;
  --down: #FF5C7A;
  --sun-a: #FFB547;
  --accent: #FF007A;        /* the brand accent: buttons, active tab, the Navigator, focus */
  --accent-strong: #E6006E; /* filled buttons with white text (4.6:1) */
  --accent-rgb: 255, 0, 122;
  --sun-b: #5CE1E6;
  --sun-c: #FF6B6B;
  --btc: #F7931A;
  --eth: #8C8CFF;
  --bnb: #F3BA2F;
  --sol: #14F1B2;
  --xau: #E8D9A8;
  --font-ui: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --r: 12px;
  --r-sm: 8px;
  --top-h: 54px;
  --tab-h: 62px;
  --gut: 12px;
  --sat: max(env(safe-area-inset-top, 0px), var(--tg-top, 0px));
  --sab: max(env(safe-area-inset-bottom, 0px), var(--tg-bottom, 0px));
  --sal: max(env(safe-area-inset-left, 0px), var(--tg-left, 0px));
  --sar: max(env(safe-area-inset-right, 0px), var(--tg-right, 0px));
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + var(--sat) + 12px); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 78% -8%, rgba(92, 225, 230, 0.07), transparent 62%),
    radial-gradient(760px 460px at 6% 4%, rgba(var(--accent-rgb), 0.05), transparent 60%),
    radial-gradient(600px 400px at 50% 110%, rgba(255, 107, 107, 0.04), transparent 60%),
    radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--bg);
}
img, svg, canvas { display: block; }
a { color: var(--sun-b); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, .num, .mono-val, kbd {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: 'tnum' 1;
}
.num { letter-spacing: -0.01em; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.cap { text-transform: capitalize; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--surface-2); border-radius: 8px; color: var(--text); }
.skip:focus { top: 12px; }
.noscript { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ------------------------------------------------------------------ labels, atoms */
.label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
h2.label { display: inline-flex; align-items: center; gap: 9px; color: #B4BBCB; }
h2.label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}
h3.label.sub { margin: 18px 0 10px; }
.tagline { color: var(--muted); font-size: 13px; }
.lead { color: #C7CDD9; margin-bottom: 14px; }
.note { color: var(--muted); font-size: 13.5px; }
.note b { color: var(--text); font-weight: 600; }
.error { color: var(--down); font-size: 13.5px; margin-top: 10px; }
.warn { grid-column: 1 / -1; color: var(--sun-a); font-size: 12.5px; font-family: var(--font-mono); }
.empty { color: var(--muted); font-size: 13.5px; padding: 12px 0; list-style: none; }

.badge-paper {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 5px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: rgba(var(--accent-rgb), 0.06);
  white-space: nowrap;
}

.skel {
  display: inline-block;
  width: var(--w, 6ch);
  max-width: 100%;
  height: 0.9em;
  vertical-align: -0.1em;
  border-radius: 4px;
  background: linear-gradient(90deg, #111623 0%, #1B2232 50%, #111623 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skel-w8 { --w: 9ch; }
.skel-block, .j-skel, .msg-skel {
  display: block;
  height: 72px;
  border-radius: 10px;
  background: linear-gradient(90deg, #0F1320 0%, #171D2B 50%, #0F1320 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.j-skel { height: 46px; margin: 10px 0; list-style: none; }
.msg-skel { height: 54px; width: 70%; margin: 12px 0; }
.msg-skel.r { margin-left: auto; width: 46%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, filter 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:hover { border-color: #3B4660; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-strong); color: #FFFFFF; border-color: transparent; box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.2), 0 6px 22px -10px rgba(var(--accent-rgb), 0.7); }
.btn.primary:hover { background: var(--accent); filter: none; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; transform: none; filter: none; }
@media (pointer: coarse) { .btn.sm { min-height: 44px; } }

.seg {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--well);
}
.seg button {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button[aria-selected='true'], .seg button[aria-checked='true'] { background: #1A2134; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg-sm button { min-height: 30px; font-family: var(--font-mono); font-size: 12px; padding: 0 10px; }
@media (pointer: coarse) { .seg button, .seg-sm button { min-height: 44px; } }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: #C9CFDB;
  font-size: 13px;
  text-align: left;
}
.chip:hover { border-color: #3B4660; color: var(--text); }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
@media (pointer: coarse) { .chip { min-height: 44px; } }

select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
  width: 100%;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--well) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238790A3' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center / 12px 8px;
  font-size: 15px;
}

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: 14px; }
.switch.row { display: flex; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line-2); transition: background 0.2s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #C9CFDB; transition: transform 0.2s, background 0.2s; }
.switch input:checked + .switch-ui { background: rgba(61, 220, 151, 0.35); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: var(--up); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-ui { opacity: 0.5; }

.meter { position: relative; display: inline-block; width: 52px; height: 4px; margin-left: 8px; vertical-align: middle; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.meter::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); background: var(--accent); border-radius: 2px; }
.meter-wide { display: block; width: 100%; margin: 8px 0 0; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--top-h) + var(--sat));
  padding: var(--sat) calc(var(--gut) + var(--sar)) 0 calc(var(--gut) + var(--sal));
  background: rgba(5, 6, 10, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid rgba(28, 34, 48, 0.85);
}
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text); text-decoration: none !important; flex: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 10px rgba(var(--accent-rgb), 0.25); }
.wordmark { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.wordmark span { color: var(--muted); font-weight: 500; }
.topnav { display: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.orbit-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 15, 23, 0.8);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  white-space: nowrap;
  text-decoration: none !important;
}
.orbit-chip::after { content: ''; position: absolute; inset: -6px 0; }
.orbit-chip-label { overflow: hidden; text-overflow: ellipsis; }
.orbit-chip-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.orbit-chip[data-state='stable'] { color: var(--sun-b); border-color: rgba(92, 225, 230, 0.3); }
.orbit-chip[data-state='stable'] .orbit-chip-dot { background: var(--sun-b); box-shadow: 0 0 8px var(--sun-b); }
.orbit-chip[data-state='turbulent'] { color: var(--sun-a); border-color: rgba(255, 181, 71, 0.32); }
.orbit-chip[data-state='turbulent'] .orbit-chip-dot { background: var(--sun-a); box-shadow: 0 0 8px var(--sun-a); animation: pulse 2s infinite; }
.orbit-chip[data-state='chaotic'] { color: var(--sun-c); border-color: rgba(255, 107, 107, 0.36); }
.orbit-chip[data-state='chaotic'] .orbit-chip-dot { background: var(--sun-c); box-shadow: 0 0 10px var(--sun-c); animation: pulse 0.9s infinite; }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; flex: none; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.conn[data-conn='live'] .conn-dot { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2.4s infinite; }
.conn[data-conn='reconnecting'] .conn-dot, .conn[data-conn='connecting'] .conn-dot { background: var(--sun-a); }
.conn[data-conn='offline'] .conn-dot { background: var(--down); }
.conn-label { display: none; }
.acct-chip { display: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

@media (max-width: 420px) {
  .topbar > .badge-paper { display: none; }
}
@media (max-width: 400px) {
  .oc-word { display: none; }
}
@media (max-width: 359px) {
  .wordmark { font-size: 16px; }
  .oc-num { display: none; }
  .orbit-chip { padding: 0 9px; font-size: 11px; }
}

/* ------------------------------------------------------------------ bottom tab bar */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tab-h) + var(--sab));
  padding: 0 var(--sar) var(--sab) var(--sal);
  background: rgba(7, 9, 14, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none !important;
}
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabbar svg .fill { fill: currentColor; stroke: none; }
.tabbar a[aria-current='page'] { color: var(--text); }
.tabbar a[aria-current='page']::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 30%;
  right: 30%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.tabbar a[aria-current='page'] svg { stroke: var(--accent); }
.tabbar a[aria-current='page'] svg .fill { fill: var(--accent); }
html.kb .tabbar { display: none; }

/* ------------------------------------------------------------------ main + views */
main {
  display: block;
  width: 100%;
  padding: var(--gut) calc(var(--gut) + var(--sar)) 4px calc(var(--gut) + var(--sal));
  outline: none;
}

/* ------------------------------------------------------------------ footer */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 6px calc(var(--gut) + var(--sar)) 0 calc(var(--gut) + var(--sal));
  /* outside <main>, so the sticky orbit column ends above it; on phones it clears the fixed tab bar */
  padding: 14px 2px calc(var(--tab-h) + var(--sab) + 20px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 12px/1.4 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.03em;
}
.foot-chain { display: inline-flex; align-items: center; gap: 8px; }
html.kb .site-foot { padding-bottom: 20px; }
.foot-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px rgba(61, 220, 151, 0.55); }
.view { display: none; min-width: 0; }
html[data-view='orbit'] #view-orbit,
html[data-view='agent'] #view-agent,
html[data-view='ask'] #view-ask,
html[data-view='account'] #view-account { display: block; }

.panel {
  position: relative;
  min-width: 0;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0) 120px), var(--surface);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 12px; min-height: 24px; }
.panel-head .tagline { font-size: 12.5px; }

/* ------------------------------------------------------------------ orbit view */
.readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-bottom: 12px;
}
.ro { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ro-state { grid-column: 1 / -1; }
.ro-big { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.ro-sub { color: var(--muted); font-size: 12px; }
.orbit-word { color: var(--text); }
.orbit-word[data-state='stable'] { color: var(--sun-b); }
.orbit-word[data-state='turbulent'] { color: var(--sun-a); }
.orbit-word[data-state='chaotic'] { color: var(--sun-c); }
.chaos-meter {
  position: relative;
  display: block;
  height: 6px;
  margin-top: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(92, 225, 230, 0.18), rgba(255, 181, 71, 0.18), rgba(255, 107, 107, 0.2));
}
.chaos-meter span {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sun-b), var(--sun-a) 55%, var(--sun-c));
  clip-path: inset(0 calc((1 - var(--v, 0)) * 100%) 0 0 round 3px);
  transition: clip-path 1.2s ease;
}
.chaos-meter span::after {
  content: '';
  position: absolute;
  top: -4px;
  left: calc(var(--v, 0) * 100% - 1px);
  width: 2px;
  height: 14px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 0 6px #fff;
}

.orbit-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 0.94;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(var(--accent-rgb), 0.05), transparent 30%),
    radial-gradient(ellipse at 50% 50%, rgba(92, 225, 230, 0.05), transparent 70%),
    var(--well);
  -webkit-user-select: none;
  user-select: none;
}
.orbit-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; }
.orbit-wait {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  pointer-events: none;
}
.orbit-stage.is-ready .orbit-wait { display: none; }
.orbit-wait-dots, .orbit-dots, .chat-orb {
  position: relative;
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  animation: spin 2.4s linear infinite;
}
.orbit-wait-dots { width: 34px; height: 34px; }
.orbit-wait-dots i, .orbit-dots i, .chat-orb i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--accent);
  transform: rotate(0deg) translateX(7px);
}
.orbit-wait-dots i { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; transform: rotate(0deg) translateX(13px); }
.orbit-wait-dots i:nth-child(2), .orbit-dots i:nth-child(2), .chat-orb i:nth-child(2) { background: var(--sun-b); transform: rotate(120deg) translateX(7px); }
.orbit-wait-dots i:nth-child(3), .orbit-dots i:nth-child(3), .chat-orb i:nth-child(3) { background: var(--sun-c); transform: rotate(240deg) translateX(7px); }
.orbit-wait-dots i:nth-child(2) { transform: rotate(120deg) translateX(13px); }
.orbit-wait-dots i:nth-child(3) { transform: rotate(240deg) translateX(13px); }
@keyframes spin { to { transform: rotate(360deg); } }

.orbit-hint { position: absolute; left: 12px; bottom: 10px; color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; pointer-events: none; }
.hint-touch { display: none; }
@media (hover: none) { .hint-hover { display: none; } .hint-touch { display: inline; } }
.corner { position: absolute; width: 12px; height: 12px; border: 0 solid rgba(135, 144, 163, 0.45); pointer-events: none; }
.corner.tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.corner.tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; }
.corner.bl { bottom: 8px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; }
.corner.br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

.body-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  min-width: 156px;
  padding: 9px 11px 10px;
  border: 1px solid color-mix(in srgb, var(--c, #8790A3) 45%, var(--line));
  border-radius: 9px;
  background: rgba(10, 13, 20, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8), 0 0 24px -10px var(--c, transparent);
  pointer-events: none;
  will-change: transform;
}
.tip-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.tip-head i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.tip-head b { font-family: var(--font-mono); font-size: 12.5px; color: var(--c); }
.tip-head span { color: var(--muted); font-size: 12px; }
.tip-px { margin: 3px 0 6px; font-size: 18px; font-weight: 500; }
.tip-grid { display: grid; grid-template-columns: auto auto; gap: 2px 12px; margin: 0; font-size: 11.5px; }
.tip-grid dt { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.tip-grid dd { margin: 0; text-align: right; }

.coupling { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.coupling-copy { flex: 1 1 200px; min-width: 0; color: var(--muted); font-size: 13px; max-width: 40ch; }
.coupling-grid {
  flex: 1 1 260px;
  max-width: 380px;
  display: grid;
  grid-template-columns: 36px repeat(4, minmax(0, 1fr));
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.coupling-grid:empty { min-height: 120px; border-radius: 8px; background: linear-gradient(90deg, #0F1320, #171D2B, #0F1320); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.cg, .cg-h, .cg-x { display: flex; align-items: center; justify-content: center; height: 24px; border-radius: 4px; }
.cg { color: var(--text); }
.cg-h { color: var(--c, var(--muted)); font-weight: 600; }
.cg-row { justify-content: flex-start; }

/* assets */
.panel-assets { container: assets / inline-size; }
.assets { margin: 0 -4px; }
.asset-th { display: none; }
.asset {
  position: relative;
  display: grid;
  grid-template-columns: minmax(78px, auto) minmax(36px, 1fr) auto;
  grid-template-areas: 'sym spark price' 'stats stats stats';
  align-items: center;
  gap: 6px 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 8px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  border-radius: 0;
  transition: background 0.15s;
}
.asset:first-of-type, .asset-th + .asset { border-top-color: transparent; }
.asset:hover { background: rgba(255, 255, 255, 0.022); }
.asset::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--c); opacity: 0; transition: opacity 0.2s; }
.asset.is-picked::before, .asset[aria-expanded='true']::before { opacity: 1; }
.asset[aria-expanded='true'] { background: rgba(255, 255, 255, 0.025); }
.a-sym { grid-area: sym; display: grid; grid-template-columns: 10px auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-width: 0; }
.a-sym i { grid-row: 1 / 3; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.a-sym b { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--c); line-height: 1.2; }
.a-sym small { color: var(--muted); font-size: 12px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-spark { grid-area: spark; min-width: 0; height: 32px; }
.a-spark .spark { width: 100%; height: 32px; overflow: visible; }
.a-price { grid-area: price; display: flex; flex-direction: column; align-items: flex-end; min-width: 0; }
.a-price b { font-size: 15px; font-weight: 500; white-space: nowrap; }
.a-price small { font-size: 12px; }
.a-stats { grid-area: stats; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; padding-left: 18px; }
.a-stats > span { display: inline-flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.a-stats em { font-style: normal; color: var(--faint); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.a-stats b { font-weight: 500; }
.a-h24 { display: none !important; }
.flash-up { animation: flash-up 1s ease-out; }
.flash-down { animation: flash-down 1s ease-out; }
@keyframes flash-up { 0% { color: var(--up); text-shadow: 0 0 12px rgba(61, 220, 151, 0.6); } 100% { color: inherit; } }
@keyframes flash-down { 0% { color: var(--down); text-shadow: 0 0 12px rgba(255, 92, 122, 0.6); } 100% { color: inherit; } }

@container assets (min-width: 600px) {
  .asset-th, .asset {
    grid-template-columns: 150px minmax(70px, 1fr) 124px minmax(270px, 300px);
    grid-template-areas: 'sym spark price stats';
    gap: 0 16px;
  }
  .asset-th {
    display: grid;
    padding: 0 8px 8px;
    color: var(--faint);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .asset-th .r { text-align: right; }
  .a-stats-h, .a-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 10px; padding-left: 0; }
  .a-stats-h span, .a-stats > span { justify-content: flex-end; text-align: right; }
  .a-stats em { display: none; }
  .a-h24 { display: inline-flex !important; }
  .a-ch-m { display: none; }
  .a-sym { grid-template-columns: 10px auto; }
}

.asset-detail { padding: 6px 8px 14px 8px; border-top: 1px dashed var(--line); }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0; }
.detail-readout { color: var(--muted); font-size: 11px; min-height: 1em; }
.candle-wrap { position: relative; height: 200px; }
.candle-canvas { width: 100%; height: 100%; touch-action: pan-y; }
.candle-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 12px 0 0; }
.detail-meta dt { color: var(--muted); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.detail-meta dd { margin: 2px 0 0; font-size: 13px; }
@container assets (min-width: 600px) { .detail-meta { grid-template-columns: repeat(4, 1fr); } }

/* ------------------------------------------------------------------ agent view */
.bodies-line { color: #C7CDD9; font-size: 14px; line-height: 1.55; }
.b-obs { color: var(--sun-b); font-weight: 600; }
.b-nav { color: var(--accent); font-weight: 600; }
.b-anc { color: var(--sun-c); font-weight: 600; }
.paper-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.agent-status {
  container: status / inline-size;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.kv { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.kv b { font-weight: 500; font-size: 14px; }
.kv small { color: var(--muted); font-weight: 400; }
.panel-agent { container: agenthead / inline-size; }
@container agenthead (min-width: 560px) { .agent-status { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status[data-status='observing'] { color: var(--sun-b); border-color: rgba(92, 225, 230, 0.35); }
.status[data-status='observing'] i { animation: pulse 1.6s infinite; }
.status[data-status='thinking'] { color: var(--accent); border-color: rgba(var(--accent-rgb), 0.4); background: rgba(var(--accent-rgb), 0.06); }
.status[data-status='thinking'] i { animation: pulse 0.8s infinite; box-shadow: 0 0 8px currentColor; }
.status[data-status='halted'], .status[data-status='over-budget'] { color: var(--sun-c); border-color: rgba(255, 107, 107, 0.4); }
.status[data-status='active'] { color: var(--up); }
.status[data-status='off'] { color: var(--faint); }

.halted { color: var(--sun-c); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 22px; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat b { font-size: 15px; font-weight: 500; }
.stat-main { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: 12px; }
.stat-main .label { flex-basis: 100%; }
.big { font-size: 28px !important; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.delta { font-size: 14px; }
.chart-wrap { position: relative; height: 158px; margin-top: 12px; }
.chart-wrap.sm { height: 120px; }
.equity-canvas { width: 100%; height: 100%; touch-action: pan-y; }
.chart-readout { position: absolute; top: -2px; left: 6px; color: var(--text); font-size: 11px; pointer-events: none; text-shadow: 0 1px 4px var(--bg); }

.pos {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--c) 8%, transparent), transparent 46%), var(--well);
}
.pos-head {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  grid-template-areas: 'sym side . pnl' 'qty qty qty val';
  align-items: baseline;
  gap: 4px 10px;
}
.pos-sym { grid-area: sym; display: inline-flex; align-items: center; gap: 7px; color: var(--c); font-family: var(--font-mono); font-weight: 600; font-size: 14px; }
.pos-sym i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.pos-side { grid-area: side; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.pos-qty { grid-area: qty; color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-val { grid-area: val; font-size: 13px; text-align: right; }
.pos-pnl { grid-area: pnl; font-size: 15px; font-weight: 500; text-align: right; white-space: nowrap; }
.pos-pnl small { font-size: 11.5px; opacity: 0.85; }
.range { position: relative; height: 18px; margin: 12px 6px 2px; }
.range-track { position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 1px; background: linear-gradient(90deg, rgba(255, 92, 122, 0.45), var(--line-2) 35%, var(--line-2) 65%, rgba(61, 220, 151, 0.45)); }
.range-mark { position: absolute; top: 4px; width: 2px; height: 10px; margin-left: -1px; border-radius: 1px; }
.range-mark.stop { background: var(--down); }
.range-mark.target { background: var(--up); }
.range-mark.entry { background: var(--muted); height: 8px; top: 5px; }
.range-now { position: absolute; top: 4px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(5, 6, 10, 0.9), 0 0 10px var(--c); }
.range-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; color: var(--muted); font-size: 10.5px; }
.range-labels span { white-space: nowrap; }
.range-labels span:last-child { margin-left: auto; }
.pos-thesis { margin-top: 10px; }
.pos-thesis summary { display: flex; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; list-style: none; }
.pos-thesis summary::-webkit-details-marker { display: none; }
.pos-thesis summary .label { flex: none; color: var(--accent); }
.pos-thesis summary::after { content: ''; flex: none; width: 7px; height: 7px; margin-left: auto; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
.pos-thesis[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.pos-thesis-peek { min-width: 0; color: #C7CDD9; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-thesis[open] .pos-thesis-peek { visibility: hidden; }
.pos-thesis p { color: #C7CDD9; font-size: 13.5px; line-height: 1.55; padding: 2px 0 2px; }
@media (pointer: coarse) { .pos-thesis summary { min-height: 44px; } }
.pos-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 8px; color: var(--muted); font-size: 11.5px; font-family: var(--font-mono); }
.pos-meta b { color: var(--text); font-weight: 500; }
.positions.compact .pos { padding: 10px; }

.live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.live-tag[data-conn='live'] i { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2.4s infinite; }
.stream-now { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 9px; color: var(--muted); font-size: 13px; }

.journal { list-style: none; margin: 0; padding: 0; }
.j { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.journal > .j:first-child { border-top-color: transparent; }
.j-time { color: var(--faint); font-size: 10.5px; padding-top: 3px; }
.j-body { min-width: 0; overflow-wrap: anywhere; }
.j-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 4px; }
.j-text { font-size: 13.5px; color: #CDD3DE; line-height: 1.55; }
.j-kind, .j-reason { color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.j-amt { margin-left: auto; font-size: 13px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.tag-obs { color: var(--sun-b); background: rgba(92, 225, 230, 0.1); }
.tag-nav { color: var(--accent); background: rgba(var(--accent-rgb), 0.1); }
.tag-anc { color: var(--sun-c); background: rgba(255, 107, 107, 0.12); }
.tag-order { color: var(--text); background: rgba(230, 234, 242, 0.08); box-shadow: inset 0 0 0 1px var(--line-2); }
.tag-exit { color: #C9B8FF; background: rgba(167, 139, 250, 0.12); }
.tag-lesson { color: var(--xau); background: rgba(232, 217, 168, 0.1); }
.tag-regime { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.tag-misc { color: var(--muted); background: rgba(135, 144, 163, 0.1); }
.sym { display: inline-flex; align-items: center; gap: 5px; color: var(--c); font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; }
.sym i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.side { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; }
.side-buy { color: var(--up); }
.side-sell { color: var(--down); }
.j-facts { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 11.5px; margin: 2px 0 6px; }

.j-thinking .j-thought { position: relative; padding-left: 12px; color: #AEB6C6; font-size: 13.5px; line-height: 1.6; }
.j-thinking .j-thought::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px; border-radius: 1px; background: linear-gradient(180deg, var(--accent), rgba(var(--accent-rgb), 0.1)); }
.j-tool { padding: 6px 0; }
.j-tool .j-time { padding-top: 1px; }
.j-tool .j-body > .j-tool { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.j-tool-name { color: #AEB6C6; }
.j-tool-name::before { content: '> '; color: var(--faint); }
.j-tool-ok.ok { color: var(--up); }
.j-tool-ok.fail { color: var(--down); }
.j-tool-brief { min-width: 0; }
.j-order .j-body { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--well); }
.j-reject .j-body { padding: 9px 12px; border-left: 2px solid var(--sun-c); border-radius: 4px 9px 9px 4px; background: rgba(255, 107, 107, 0.06); }
.j-rule { display: inline-block; margin: 2px 0 6px; padding: 1px 6px; border-radius: 4px; background: rgba(255, 107, 107, 0.1); color: #FFA3A3; font-size: 11px; }
.j-exit .j-body { padding: 9px 12px; border-left: 2px solid #A78BFA; border-radius: 4px 9px 9px 4px; background: rgba(167, 139, 250, 0.06); }
.j-lesson .j-body { padding: 10px 12px; border: 1px dashed rgba(232, 217, 168, 0.35); border-radius: 9px; }
.j-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.j-tags span { padding: 1px 7px; border-radius: 4px; background: rgba(232, 217, 168, 0.08); color: var(--xau); font-family: var(--font-mono); font-size: 10.5px; }
.j-regime .j-body { padding: 8px 12px; border-radius: 9px; background: linear-gradient(90deg, rgba(92, 225, 230, 0.06), rgba(255, 181, 71, 0.06), rgba(255, 107, 107, 0.06)); }
.j-fresh { animation: j-in 0.6s ease-out; }
.j-fresh .j-time { color: var(--accent); }
@keyframes j-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.stream-foot { display: flex; justify-content: center; gap: 8px; padding-top: 8px; }
.tbl-more { display: flex; justify-content: center; padding-top: 10px; }
.stream-foot:empty { display: none; }

/* tables (trades, ledger): cards on narrow containers, a grid when wide */
.panel-trades, .card-ledger { container: tbl / inline-size; }
.tbl { font-size: 13px; }
.tbl .tr.th { display: none; }
.tbl .tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.tbl .tr:nth-child(2) { border-top-color: transparent; }
.tbl .tr::after { content: ''; order: 5; flex-basis: 100%; height: 0; }
.tbl em { font-style: normal; color: var(--faint); margin-right: 4px; }
.tbl .td:empty { display: none; }
.t-sym { order: 1; } .t-side { order: 2; } .t-usd { order: 3; margin-left: auto; } .t-pnl { order: 4; min-width: 64px; text-align: right; }
.t-qty { order: 6; color: var(--muted); font-size: 12px; } .t-px { order: 7; color: var(--muted); font-size: 12px; } .t-fee { order: 8; color: var(--muted); font-size: 12px; }
.t-reason { order: 9; color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.t-time { order: 10; margin-left: auto; color: var(--faint); font-size: 11px; }
@container tbl (min-width: 620px) {
  .tbl-trades .tr, .tbl-trades .th {
    display: grid;
    grid-template-columns: 92px 62px 44px minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr) 64px 76px 64px;
    gap: 0 10px;
    align-items: center;
  }
  .tbl .tr::after { display: none; }
  .tbl-trades .tr.th, .tbl-ledger .tr.th { display: grid; }
  .tbl .th { padding: 0 0 8px; border-top: 0; color: var(--faint); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
  .tbl em { display: none; }
  .tbl .td { order: 0; margin: 0; min-width: 0; color: inherit; font-size: 12.5px; text-align: left; }
  .tbl-trades .t-qty, .tbl-trades .t-px, .tbl-trades .t-usd, .tbl-trades .t-fee, .tbl-trades .t-pnl { text-align: right; }
  .tbl-trades .th span:nth-child(n + 4):nth-child(-n + 8) { text-align: right; }
  .tbl .t-time { color: var(--muted); font-size: 11.5px; }
  .tbl .t-reason { font-size: 10.5px; color: var(--muted); }
}

/* ------------------------------------------------------------------ ask view */
.panel-ask { display: flex; flex-direction: column; min-height: calc(100dvh - var(--top-h) - var(--sat) - var(--tab-h) - var(--sab) - 44px); padding-bottom: 0; }
.ask-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ask-intro { flex: 1 1 260px; min-width: 0; }
.ask-title { font-size: 20px; letter-spacing: -0.01em; }
.ask-sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; max-width: 60ch; }
.ask-sub b { color: var(--text); font-weight: 500; }
.ask-bal { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--well); }
.ask-bal b { font-size: 15px; font-weight: 500; }
.chat { flex: 1; padding: 14px 0; min-width: 0; }
.chat > * { scroll-margin-bottom: calc(var(--tab-h) + var(--sab) + 96px); }
.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 4px; text-align: center; color: var(--muted); font-size: 14px; }
.chat-orb { width: 48px; height: 48px; animation-duration: 6s; }
.chat-orb i { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; transform: rotate(0deg) translateX(18px); box-shadow: 0 0 12px currentColor; }
.chat-orb i:nth-child(2) { transform: rotate(120deg) translateX(18px); }
.chat-orb i:nth-child(3) { transform: rotate(240deg) translateX(18px); }
.suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 560px; }
.msg { display: flex; flex-direction: column; margin: 0 0 16px; min-width: 0; }
.msg-user { align-items: flex-end; }
.msg-user .bubble { max-width: 86%; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 14px 14px 4px 14px; background: var(--surface-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-who { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.msg-meta { color: var(--faint); font-size: 10.5px; margin-top: 4px; }
.msg-who .msg-meta { margin: 0; }
.msg-nav .bubble { max-width: 100%; padding: 2px 0 2px 14px; border-left: 2px solid rgba(var(--accent-rgb), 0.55); color: #D3D8E2; overflow-wrap: anywhere; }
.bubble.thinking { display: flex; align-items: center; gap: 12px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.md p { margin: 0 0 8px; }
.md p:last-child { margin-bottom: 0; }
.md ul { margin: 6px 0 8px; padding-left: 18px; }
.md li { margin: 2px 0; }
.md code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); font-size: 0.9em; }
.md strong { color: var(--text); font-weight: 600; }
.md .md-h { font-weight: 600; color: var(--text); }
.msg-charge { margin-top: 8px; padding-left: 16px; color: var(--muted); font-size: 11px; }
.notice { margin: 4px 0 16px; padding: 14px; border-radius: 10px; font-size: 14px; }
.notice p { margin-bottom: 12px; }
.notice p:last-child { margin-bottom: 0; }
.notice-credits { border: 1px solid rgba(var(--accent-rgb), 0.45); background: rgba(var(--accent-rgb), 0.06); }
.notice-error { border: 1px solid rgba(255, 92, 122, 0.4); background: rgba(255, 92, 122, 0.06); color: #FFB3C0; }
.ask-gate { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; padding: 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--well); font-size: 14px; }
.ask-gate p { flex: 1 1 240px; color: var(--muted); }
.ask-gate b { color: var(--text); }
.composer {
  position: sticky;
  bottom: calc(var(--tab-h) + var(--sab));
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 0 -14px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r) var(--r);
  background: rgba(12, 15, 23, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
html.kb .composer { bottom: 0; }
.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  max-height: 160px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--well);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
}
.composer textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), 0.6); }
.composer .send { width: 46px; min-height: 46px; padding: 0; border-radius: 12px; flex: none; }
.send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ account view */
.acct-grid { display: flex; flex-direction: column; }
.acct-col { display: contents; }
.card { margin-bottom: 12px; }
.card-signin, .card-id { order: 1; }
#acct-how, .card-credits { order: 2; }
.card-agent { order: 3; }
.card-tg { order: 4; }
.card-ledger { order: 5; }
.card-app { order: 6; }
.banner { margin-bottom: 12px; padding: 12px 14px; border: 1px solid rgba(92, 225, 230, 0.35); border-radius: 10px; background: rgba(92, 225, 230, 0.06); font-size: 14px; }
.signin-ways { display: grid; gap: 10px; }
.walletapps { margin-top: 14px; }
.walletapp-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.walletapp-row .btn { flex: 1 1 auto; }
.tg-wait { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; margin-top: 14px; padding: 12px; border: 1px dashed rgba(92, 225, 230, 0.4); border-radius: 10px; font-size: 13.5px; color: var(--muted); }
.tg-wait b { color: var(--text); }
.tg-wait-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.facts { margin: 0; padding: 0 0 0 18px; color: #C7CDD9; font-size: 14px; }
.facts li { margin: 4px 0; }
.facts li::marker { color: var(--accent); }
.facts b { font-weight: 500; }

.kv-row { display: grid; grid-template-columns: minmax(86px, 120px) minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; min-height: 48px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.panel-head + .kv-row { border-top: 0; }
.mono-val { min-width: 0; font-size: 12.5px; color: #D3D8E2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono-val.break { white-space: normal; word-break: break-all; }
.card-foot { display: flex; justify-content: flex-end; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.balance { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.balance .label { flex-basis: 100%; }
.topup { display: flex; flex-direction: column; gap: 10px; }
.topup.is-off { opacity: 0.55; }
.eth-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 12px; background: var(--well); transition: border-color 0.15s, box-shadow 0.15s; }
.eth-input:focus-within { border-color: rgba(var(--accent-rgb), 0.6); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12); }
.eth-input input { flex: 1; min-width: 0; min-height: 54px; padding: 0 14px; border: 0; background: transparent; outline: none; font-family: var(--font-mono); font-size: 22px; font-variant-numeric: tabular-nums; }
.eth-input input::placeholder { color: var(--faint); }
.eth-input .unit { padding-right: 14px; color: var(--muted); font-family: var(--font-mono); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.estimate { min-height: 1.5em; color: var(--muted); font-size: 13.5px; }
.estimate b { color: var(--text); font-weight: 500; }
.tx { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 13.5px; }
.tx.credited { border-color: rgba(61, 220, 151, 0.4); background: rgba(61, 220, 151, 0.05); }
.advanced { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.advanced summary { display: flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 13.5px; cursor: pointer; list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: ''; width: 7px; height: 7px; margin-right: 10px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform 0.2s; }
.advanced[open] summary::before { transform: rotate(45deg); }
.advanced .note { margin: 4px 0 8px; }
.advanced code { color: var(--sun-b); }

.agent-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.field { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.field .seg { align-self: flex-start; }
.field-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; align-items: end; }
.field-row > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-row b { min-height: 44px; display: flex; align-items: center; font-weight: 500; }
.wake { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.wake .note { flex: 1 1 180px; }
.mybook { margin-top: 14px; }
.mybook .positions { margin-top: 12px; }
.app-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 14px; padding: 10px 0; border-top: 1px solid var(--line); }
.panel-head + .app-row { border-top: 0; padding-top: 0; }
.app-row > div { flex: 1 1 200px; min-width: 0; }
.tbl-ledger .l-time { order: 10; margin-left: auto; color: var(--faint); font-size: 11px; }
.tbl-ledger .l-kind { order: 1; }
.tbl-ledger .l-usd { order: 3; margin-left: auto; font-weight: 500; }
.tbl-ledger .l-eth { order: 6; color: var(--muted); font-size: 12px; }
.tbl-ledger .l-ethusd { order: 7; color: var(--muted); font-size: 12px; }
.tbl-ledger .l-detail { order: 8; display: inline-flex; flex-wrap: wrap; gap: 4px 10px; min-width: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.kind { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kind-deposit { color: var(--up); }
.kind-charge { color: var(--accent); }
@container tbl (min-width: 620px) {
  .tbl-ledger .tr, .tbl-ledger .th { display: grid; grid-template-columns: 96px 76px 96px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 10px; align-items: center; }
  .tbl-ledger .l-usd, .tbl-ledger .l-eth, .tbl-ledger .l-ethusd { text-align: right; }
  .tbl-ledger .th span:nth-child(n + 3):nth-child(-n + 5) { text-align: right; }
}

/* ------------------------------------------------------------------ toasts */
.toasts { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--sab) + 12px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(420px, calc(100% - 24px)); transform: translateX(-50%); pointer-events: none; }
.toast { max-width: 100%; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: rgba(18, 24, 38, 0.97); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.9); font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity 0.25s, transform 0.25s; }
.toast.in { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(61, 220, 151, 0.45); }
.toast-error { border-color: rgba(255, 92, 122, 0.5); }

/* ------------------------------------------------------------------ Telegram, APK */
.tg .hide-in-tg { display: none !important; }

/* ------------------------------------------------------------------ small phones */
@media (max-width: 360px) {
  :root { --gut: 10px; }
  .panel { padding: 12px; }
  .composer { margin: 0 -12px; padding: 10px 12px 12px; }
  .ro-big { font-size: 18px; }
  .big { font-size: 24px !important; }
  .a-stats { gap: 3px 12px; padding-left: 0; }
  .asset { gap: 6px 10px; padding: 12px 6px; }
  .kv-row { grid-template-columns: 80px minmax(0, 1fr) auto; }
  .j { grid-template-columns: 50px minmax(0, 1fr); gap: 8px; }
}

/* ------------------------------------------------------------------ tablet + desktop */
@media (min-width: 700px) {
  :root { --gut: 18px; }
  .readout { grid-template-columns: 1.4fr 1fr 1fr; }
  .ro-state { grid-column: auto; }
  .orbit-stage { aspect-ratio: 16 / 10; }
  .panel { padding: 16px 18px; }
  .composer { margin: 0 -18px; padding: 12px 18px 14px; }
}

@media (min-width: 1024px) {
  :root { --top-h: 60px; --gut: 24px; }
  .tabbar { display: none; }
  .topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 22px;
  }
  .topnav a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
  }
  .topnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
  .topnav a[aria-current='page'] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
  html[data-view='orbit'] .topnav a[data-nav='agent'], html[data-view='agent'] .topnav a[data-nav='orbit'] { color: #B4BBCB; }
  .conn-label { display: inline; }
  .acct-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--line-2);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none !important;
  }
  .acct-chip.is-in { font-family: var(--font-mono); font-weight: 500; font-variant-numeric: tabular-nums; }
  .acct-chip:not(.is-in) { background: var(--accent-strong); color: #FFFFFF; border-color: transparent; }

  main { max-width: 1640px; margin: 0 auto; padding: 22px calc(var(--gut) + var(--sar)) 8px calc(var(--gut) + var(--sal)); }
  /* lines up with main's content column (max 1640px, gutters) */
  .site-foot { margin: 6px max(calc(var(--gut) + var(--sar)), calc((100% - 1640px) / 2 + var(--gut))) 0; padding: 14px 2px 40px; }
  html[data-view='orbit'] main, html[data-view='agent'] main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }
  html[data-view='orbit'] #view-agent, html[data-view='agent'] #view-orbit { display: block; }
  /* the orbit column stays in view while the agent column scrolls; it scrolls on its own when taller than the screen */
  html[data-view='orbit'] #view-orbit, html[data-view='agent'] #view-orbit {
    position: sticky;
    top: calc(var(--top-h) + var(--sat) + 22px);
    max-height: calc(100vh - var(--top-h) - var(--sat) - 38px);
    overflow-y: auto;
    margin-right: -8px;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }
  #view-orbit::-webkit-scrollbar { width: 6px; }
  #view-orbit::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
  .panel { margin-bottom: 16px; padding: 18px 20px; }
  .orbit-stage { aspect-ratio: auto; height: clamp(420px, calc(100vh - 330px), 620px); max-height: none; }
  .ro-big { font-size: 22px; }
  .journal { max-height: 620px; overflow-y: auto; padding-right: 6px; margin-right: -6px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  .journal::-webkit-scrollbar { width: 6px; }
  .journal::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }

  #view-ask { max-width: 900px; margin: 0 auto; }
  .panel-ask { min-height: calc(100vh - var(--top-h) - 70px); }
  .composer { bottom: 0; margin: 0 -20px; padding: 14px 20px 18px; }

  #view-account { max-width: 1240px; margin: 0 auto; }
  .acct-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .acct-col { display: flex; flex-direction: column; min-width: 0; }
  .card { margin-bottom: 16px; }
  .toasts { left: auto; right: 24px; bottom: 24px; transform: none; align-items: flex-end; }
}

@media (min-width: 1440px) {
  html[data-view='orbit'] main, html[data-view='agent'] main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; }
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .skel, .skel-block, .j-skel, .msg-skel { animation: none !important; }
}

/* ------------------------------------------------------------------ $3BODY coin */
.buy-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #FFFFFF;
  font: 600 12.5px/1 var(--font-ui);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 18px -10px rgba(var(--accent-rgb), 0.8);
}
.buy-chip:hover { background: var(--accent); }
@media (pointer: coarse) { .buy-chip { height: 36px; } }
.foot-token { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.foot-buy { color: var(--accent); text-decoration: none; font-weight: 600; }
.foot-buy:hover { text-decoration: underline; }
.ca-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--well);
  color: var(--muted);
  font: 500 12px/1 var(--font-mono);
  cursor: pointer;
}
.ca-copy:hover { color: var(--text); border-color: rgba(var(--accent-rgb), 0.5); }
.ca-copy-label { color: var(--accent); }
@media (pointer: coarse) { .ca-copy { min-height: 40px; } }
@media (max-width: 420px) { .buy-chip { padding: 0 9px; font-size: 12px; } }
