/* ==========================================================================
   APP STYLES — components only reference tokens from tokens.css.
   Sections: base · primitives (buttons, pills, inputs) · title bar · rail ·
   meeting feed · side panel · status bar · settings sheet · toasts
   ========================================================================== */

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
  overflow: hidden;
  user-select: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: var(--radius-sm); }
code { font-family: var(--font-mono); font-size: 0.92em; padding: 1px 4px; background: var(--surface-3); border-radius: var(--radius-xs); }
kbd { font-family: var(--font-sans); font-size: var(--fs-2xs); opacity: 0.72; margin-left: var(--sp-1); letter-spacing: 0.02em; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); font-size: var(--fs-sm); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
/* A live number that just changed: a short tint behind it (tweenNumber in dom.js). */
.tick-up { animation: tick-up 900ms ease-out; border-radius: 4px; }
.tick-down { animation: tick-down 900ms ease-out; border-radius: 4px; }
@keyframes tick-up { from { background: var(--pos-soft); } to { background: transparent; } }
@keyframes tick-down { from { background: var(--neg-soft); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .tick-up, .tick-down { animation: none; } }
.sub { color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-tight); margin-top: 2px; font-weight: var(--fw-regular); }
.tk { font-weight: var(--fw-semibold); letter-spacing: 0.01em; }
.h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }
.eyebrow { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-3); }
.row-gap { display: flex; gap: var(--sp-2); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- primitives: buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 var(--sp-3);
  border-radius: var(--radius-sm); border: var(--border-w) solid transparent;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn--secondary { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn--ghost.is-on { background: var(--warn-soft); color: var(--warn); }
.btn--danger-soft { background: var(--neg-soft); color: var(--neg); }
.btn--danger-soft:hover { background: var(--neg); color: #fff; }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--sm { height: var(--control-h-sm); }
.btn--sm.btn--icon { width: var(--control-h-sm); }
.btn--xs { height: 20px; padding: 0 8px; font-size: var(--fs-xs); border-radius: var(--radius-xs); }

.link { color: var(--accent); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.link--quiet { color: var(--text-3); font-weight: var(--fw-regular); }
.link--quiet:hover { color: var(--text-2); }
.link--danger { color: var(--neg); }

/* ---------- primitives: badges, pills, chips ---------- */
.badge {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps);
  border-radius: var(--radius-xs); background: var(--accent-soft); color: var(--accent);
}
.badge--warn { background: var(--warn-soft); color: var(--warn); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); border-radius: 999px; white-space: nowrap;
  background: var(--info-soft); color: var(--info);
}
.pill--pos { background: var(--pos-soft); color: var(--pos); }
.pill--neg { background: var(--neg-soft); color: var(--neg); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--accent, .pill--live { background: var(--accent-soft); color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; height: 18px; padding: 0 6px;
  font-size: var(--fs-2xs); font-weight: var(--fw-medium); color: var(--text-2);
  border: var(--border-w) solid var(--border); border-radius: var(--radius-xs); background: var(--surface);
}
.chip--quiet { color: var(--text-3); }
.chip--warn { color: var(--warn); border-color: transparent; background: var(--warn-soft); }

.kw { font-weight: var(--fw-semibold); padding: 0 3px; border-radius: var(--radius-xs); font-size: 0.92em; }
.kw--pos { color: var(--pos); background: var(--pos-soft); }
.kw--neg { color: var(--neg); background: var(--neg-soft); }
.kw--warn { color: var(--warn); background: var(--warn-soft); }
.kw--info { color: var(--info); background: var(--info-soft); }

.count { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.divider-v { width: 1px; height: 18px; background: var(--border); margin: 0 var(--sp-1); }

.live-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- layout shell ---------- */
.app { display: grid; grid-template-rows: var(--titlebar-h) 1fr var(--statusbar-h); height: 100vh; }
.body { display: grid; grid-template-columns: var(--rail-w) 1fr var(--side-w); min-height: 0; }

/* ---------- title bar ---------- */
.titlebar {
  /* Sides take what they need; the session pill is centred in the space between them. */
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: var(--sp-3); position: relative;
  padding: 0 var(--sp-3); background: var(--bg); border-bottom: var(--border-w) solid var(--border);
  -webkit-app-region: drag;
}
.titlebar button, .titlebar .market { -webkit-app-region: no-drag; }
html[data-platform="darwin"] .titlebar { padding-left: 84px; }
/* Room for the Windows minimise / maximise / close buttons. They keep their size when the app is
   zoomed (Text size), so the room comes from what Windows reports (titlebar-area), never less than 148px. */
html:not([data-platform="darwin"]) .titlebar { padding-right: max(148px, calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, calc(100vw - 148px)))); }

.titlebar__brand { display: flex; align-items: center; gap: var(--sp-2); }
/* Everything in the title bar at 120%: logo, mode and market switches, plan, session pill,
   next round and the buttons (the overflow menu measures zoomed sizes, so it still works). */
.titlebar__brand, .titlebar__actions, .titlebar__center > * { zoom: 1.2; } /* the centre's box stays unzoomed so it centres exactly */
.logo {
  width: 18px; height: 18px; border-radius: 5px; background: var(--text); position: relative;
}
.logo::before, .logo::after { content: ""; position: absolute; left: 4px; right: 4px; height: 2px; background: var(--bg); border-radius: 1px; }
.logo::before { top: 6px; right: 7px; }
.logo::after { top: 10px; }
.brand-name { font-weight: var(--fw-semibold); letter-spacing: -0.01em; }

/* The session pill sits in the exact middle of the window (the island opens right over it). */
.titlebar__center { display: flex; justify-content: center; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.titlebar.is-tight .titlebar__center { position: static; transform: none; grid-column: 2; } /* narrow window: between the sides */
.market {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: 26px; padding: 0 var(--sp-3);
  border: var(--border-w) solid var(--border); border-radius: 999px; background: var(--surface); font-size: var(--fs-xs);
}
.market .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.market__state { font-weight: var(--fw-semibold); }
.market__cd { display: inline-flex; align-items: baseline; gap: 5px; padding-left: var(--sp-2); border-left: var(--border-w) solid var(--border); }
.market__cd small { color: var(--text-3); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.market__cd b { font-weight: var(--fw-semibold); font-size: var(--fs-xs); min-width: 58px; }
.market__cd.is-dim b { color: var(--text-3); min-width: 0; }
.market__cd[hidden] { display: none; }
.market__247 b { min-width: 0; color: var(--text-2); letter-spacing: 0.04em; }
.market.is-open .dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.market.is-open .market__state { color: var(--pos); }
.market.is-closed .dot { background: var(--text-3); }
.market.is-error .dot { background: var(--warn); }
.market.is-error .market__state { color: var(--warn); }

/* Trading mode switch: Paper (blue) · Demo (amber) · Market (red, real money) */
.seg--mode { -webkit-app-region: no-drag; margin-left: var(--sp-1); }
.seg--mode .seg__btn { height: 22px; padding: 0 10px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: 0.06em; text-transform: uppercase; }
.seg--mode .seg__btn:disabled { opacity: 0.35; cursor: not-allowed; }
.seg--mode .seg__btn.is-on[data-mode="paper"] { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.seg--mode .seg__btn.is-on[data-mode="demo"] { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.seg--mode .seg__btn.is-on[data-mode="live"] { background: var(--neg); color: #fff; box-shadow: none; }
.seg--mode .seg__btn[data-mode="live"]:not(.is-on):hover { color: var(--neg); }
/* A red line across the top whenever real money is in play */
.app.is-live .titlebar { box-shadow: inset 0 2px 0 var(--neg); }
.app.is-live .statusbar { box-shadow: inset 0 1px 0 var(--neg); }

/* Market (live) confirmation */
.sheet.sheet--small { width: min(520px, calc(100vw - 48px)); height: auto; grid-template-rows: auto auto auto; }
.live__body { padding: var(--sp-4) var(--sp-5); font-size: var(--fs-sm); color: var(--text-2); }
.live__body p { margin: 0 0 var(--sp-2); color: var(--text); }
.live__body ul { margin: 0 0 var(--sp-3); padding-left: 18px; }
.live__body li { margin: 4px 0; }
.live__keys { margin-bottom: var(--sp-3); }
.live__keys .notice { margin: 0; justify-content: space-between; }
.live__ack { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border: var(--border-w) solid var(--neg); border-radius: var(--radius-md); background: var(--neg-soft); color: var(--text); font-weight: var(--fw-medium); cursor: pointer; }
.live__ack input { accent-color: var(--neg); }
.btn--danger { background: var(--neg); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.08); }

.titlebar__actions { grid-column: 3; display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-1); }
.next-round { display: flex; flex-direction: row; align-items: center; gap: 4px; height: 24px; padding: 0 8px; margin-right: var(--sp-1); border-radius: 999px; background: var(--surface-2); line-height: 1; white-space: nowrap; }
.next-round__label { font-size: 11px; opacity: .75; }
.next-round__value { font-size: var(--fs-xs); font-weight: var(--fw-medium); }

/* ---------- section heads ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; height: 24px; margin-bottom: var(--sp-2); }
.section-head--spaced { margin-top: var(--sp-6); }

/* ---------- left rail ---------- */
.rail { padding: var(--sp-4) var(--sp-3); border-right: var(--border-w) solid var(--border); overflow-y: auto; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bot {
  display: grid; grid-template-columns: 14px 18px 1fr auto; align-items: center; gap: var(--sp-2);
  padding: 7px var(--sp-2); border-radius: var(--radius-md); position: relative;
  transition: background var(--dur) var(--ease);
}
.bot__idx { font-size: var(--fs-2xs); color: var(--text-3); text-align: center; }
.bot__dot { width: 8px; height: 8px; border-radius: 2px; background: var(--bot-c); }
.bot__main { min-width: 0; }
.bot__name { font-size: var(--fs-sm); font-weight: var(--fw-medium); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot__meta { font-size: var(--fs-2xs); color: var(--text-3); line-height: 1.3; }
.bot__state { font-size: var(--fs-2xs); color: var(--text-3); white-space: nowrap; }
.bot.is-active { background: var(--surface); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.bot.is-active .bot__state { color: var(--bot-c); font-weight: var(--fw-medium); }

.bot.is-done .bot__state { color: var(--text-2); }
.bot.is-error .bot__state { color: var(--neg); }

.rules { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--sp-3); margin: 0; font-size: var(--fs-xs); padding: var(--sp-3); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); }
.rules dt { color: var(--text-3); }
.rules dd { margin: 0; text-align: right; color: var(--text); font-weight: var(--fw-medium); }

/* ---------- meeting ---------- */
.meeting { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; background: var(--bg); }
.meeting__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-5); border-bottom: var(--border-w) solid var(--border); }
.meeting__bar .seg__btn { white-space: nowrap; }
#roundsMeta { white-space: nowrap; }
/* Not enough room next to the round controls: the round count goes first (it is also in the feed). */
@container meetingbar (max-width: 1100px) { #roundsMeta { display: none; } }
.meeting__bar { container: meetingbar / inline-size; }
.meeting__title { display: flex; align-items: center; gap: var(--sp-3); }
.meeting__actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; flex-shrink: 0; }
.meeting__actions .next-round { margin-right: 0; }
/* The view tabs (Dashboard … Report): about 25% larger than the other segmented controls. */
.seg--view { padding: 3px; }
.seg--view .seg__btn { height: 28px; padding: 0 13px; font-size: calc(var(--fs-xs) * 1.25); }

.seg { display: inline-flex; padding: 2px; background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); }
.seg__btn { height: 22px; padding: 0 10px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2); border-radius: var(--radius-sm); }
.seg__btn:hover { color: var(--text); }
.seg__btn.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.feed { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-5) var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-3); user-select: text; }

.empty { margin: auto; max-width: 340px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-8) 0; }
.empty__icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--surface); border: var(--border-w) solid var(--border); color: var(--text-2); margin-bottom: var(--sp-2); }
.empty__title { font-weight: var(--fw-semibold); font-size: var(--fs-lg); }
.empty__text { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--sp-3); }

.jump {
  position: absolute; bottom: var(--sp-4); left: 50%; transform: translateX(-50%);
  height: 28px; padding: 0 var(--sp-3); border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); box-shadow: var(--shadow-md);
}

/* round card */
.round { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); flex-shrink: 0; }
.round.is-live { border-color: var(--border-strong); }
.round__head {
  display: flex; align-items: center; gap: var(--sp-2); height: 42px; padding: 0 var(--sp-3) 0 var(--sp-2);
  cursor: pointer; user-select: none; border-radius: var(--radius-lg);
}
.round__head:hover { background: var(--hover); }
.round__chev { display: grid; place-items: center; width: 20px; color: var(--text-3); transition: transform var(--dur) var(--ease); transform: rotate(90deg); }
.round.is-collapsed .round__chev { transform: rotate(0); }
.round__no { font-weight: var(--fw-semibold); }
.round__time { color: var(--text-3); font-size: var(--fs-xs); }
.round__picks { display: flex; gap: 4px; }
.round__spacer, .msg__spacer { flex: 1; }
.round__dur { color: var(--text-3); font-size: var(--fs-xs); }
.round__body { border-top: var(--border-w) solid var(--border); padding: var(--sp-2) 0 var(--sp-3); }
.round.is-collapsed .round__body { display: none; }

/* message */
.msg { display: grid; grid-template-columns: 3px 1fr; gap: var(--sp-3); padding: var(--sp-2) var(--sp-4) var(--sp-2) var(--sp-3); }
.msg + .msg { border-top: var(--border-w) dashed var(--border); }
.msg__rail { background: var(--bot-c); border-radius: 2px; opacity: 0.9; }
.msg__main { min-width: 0; }
.msg__head { display: flex; align-items: center; gap: var(--sp-2); height: 22px; }
.msg__tag { font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); color: var(--bot-c); }
.msg__name { font-size: var(--fs-xs); color: var(--text-3); }
.msg__status { font-size: var(--fs-xs); color: var(--bot-c); font-weight: var(--fw-medium); }
.msg__time { font-size: var(--fs-2xs); color: var(--text-3); }
.msg__text { white-space: pre-wrap; word-break: break-word; font-size: var(--fs-md); color: var(--text); line-height: 1.6; }
.msg.is-system .msg__text { color: var(--text-2); }
.msg__error { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-1); color: var(--neg); font-size: var(--fs-xs); }
.msg__cites { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--sp-2); }
.cite {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; font-size: var(--fs-2xs);
  color: var(--text-2); background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius-xs);
}
.cite:hover { color: var(--accent); border-color: var(--accent); }

.caret { display: inline-block; width: 7px; height: 14px; margin-left: 1px; vertical-align: -2px; background: var(--bot-c); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.typing { display: inline-flex; gap: 3px; padding: 6px 0; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-3); animation: pulse 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

/* decisions table */
.decisions { margin: var(--sp-3) var(--sp-4) 0; border: var(--border-w) solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.decisions__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-3); background: var(--surface-2); border-bottom: var(--border-w) solid var(--border); }
.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.dtable th { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-3); text-align: left; padding: 7px var(--sp-3); border-bottom: var(--border-w) solid var(--border); }
.dtable th.num { text-align: right; }
.dtable td { padding: 8px var(--sp-3); border-bottom: var(--border-w) solid var(--border); vertical-align: top; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: var(--hover); }
/* bear debate under a trade */
.dtable tr.debate-row td { padding-top: 0; }
.dtable tbody tr.debate-row:hover { background: none; }
.debate { border-left: 2px solid var(--bot-skeptic); padding: 6px 0 4px var(--sp-3); display: flex; flex-direction: column; gap: 6px; }
.debate__head { display: flex; align-items: center; gap: var(--sp-2); }
.debate__title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--bot-skeptic); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.debate__err { font-size: var(--fs-xs); color: var(--neg); }
.debate__pt { display: grid; grid-template-columns: 18px 1fr; gap: 6px; font-size: var(--fs-xs); }
.debate__n { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-2xs); background: var(--surface-3); color: var(--text-2); }
.debate__reason { color: var(--text); }
.debate__why { color: var(--text-2); }
.debate__pt.is-rebutted .debate__why b { color: var(--pos); }
.debate__pt.is-stands .debate__why b { color: var(--neg); }
.debate__pt.is-stands .debate__n { background: var(--neg-soft); color: var(--neg); }
.status-cell { display: flex; align-items: center; gap: var(--sp-2); }

.notice { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) var(--sp-4) 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); font-size: var(--fs-sm); }
.notice--neg { background: var(--neg-soft); color: var(--neg); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--ok { background: var(--pos-soft); color: var(--pos); }

/* ---------- side panel ---------- */
.side { display: flex; flex-direction: column; border-left: var(--border-w) solid var(--border); min-height: 0; overflow-y: auto; }
.panel { padding: var(--sp-4); border-bottom: var(--border-w) solid var(--border); }
.panel--grow { flex: 1; min-height: 160px; }
.equity__value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: -0.02em; line-height: 1.2; }
.equity__pl { font-size: var(--fs-xs); margin-top: 2px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-top: var(--sp-3); }
.kv { display: flex; flex-direction: column; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-md); background: var(--surface); border: var(--border-w) solid var(--border); }
.kv span { font-size: var(--fs-2xs); color: var(--text-3); }
.kv b { font-size: var(--fs-sm); font-weight: var(--fw-medium); }

.table { display: flex; flex-direction: column; font-size: var(--fs-sm); }
.trow { display: grid; grid-template-columns: 1fr 44px 64px 84px 22px; align-items: center; gap: var(--sp-2); padding: 7px var(--sp-1); border-bottom: var(--border-w) solid var(--border); }
.trow:last-child { border-bottom: 0; }
.trow--head { font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-weight: var(--fw-semibold); padding-top: 0; }
.trow:not(.trow--head):hover { background: var(--hover); }
.row-action { width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--radius-xs); color: var(--text-3); opacity: 0; transition: opacity var(--dur-fast); }
.trow:hover .row-action { opacity: 1; }
.row-action:hover { background: var(--neg-soft); color: var(--neg); }
.table__empty { color: var(--text-3); font-size: var(--fs-xs); padding: var(--sp-3) 0; }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; justify-content: space-between; padding: 0 var(--sp-3);
  border-top: var(--border-w) solid var(--border); background: var(--bg); font-size: var(--fs-xs); color: var(--text-3);
}
.status-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.status-msg.is-error { color: var(--neg); }
.statusbar__right { display: flex; align-items: center; gap: var(--sp-2); }
.sep { opacity: 0.5; }

/* ---------- settings sheet ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal__scrim { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity var(--dur) var(--ease); }
.sheet {
  position: relative; width: min(760px, calc(100vw - 48px)); height: min(620px, calc(100vh - 80px));
  display: grid; grid-template-rows: auto 1fr auto; background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(6px) scale(0.99); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.modal.is-open .modal__scrim { opacity: 1; }
.modal.is-open .sheet { opacity: 1; transform: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-5); border-bottom: var(--border-w) solid var(--border); }
.sheet__body { display: grid; grid-template-columns: 172px 1fr; min-height: 0; }
.sheet__foot { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-5); border-top: var(--border-w) solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.tabs { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3); border-right: var(--border-w) solid var(--border); }
.tabs__btn { text-align: left; height: 30px; padding: 0 var(--sp-3); border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--text-2); }
.tabs__btn:hover { background: var(--hover); color: var(--text); }
.tabs__btn.is-on { background: var(--active); color: var(--text); font-weight: var(--fw-medium); }

.tabpanes { overflow-y: auto; padding: var(--sp-4) var(--sp-5) var(--sp-6); user-select: text; }
.pane { display: flex; flex-direction: column; }
.form-note { margin: 0 0 var(--sp-3); padding: var(--sp-3); font-size: var(--fs-xs); color: var(--text-2); background: var(--surface-2); border-radius: var(--radius-md); line-height: 1.55; }
.form-note--env { display: flex; align-items: center; gap: var(--sp-2); background: var(--accent-soft); color: var(--text-2); word-break: break-all; }
.form-note--env .pill { flex-shrink: 0; }
.input:disabled { opacity: 0.6; cursor: not-allowed; }
.form-group { margin: var(--sp-5) 0 var(--sp-1); font-size: var(--fs-2xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-3); }

/* The control column is at least 250px and grows to fit a wide switch; a switch that still doesn't
   fit wraps its buttons onto a second line instead of spilling out of the box. */
.field { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(250px, max-content); gap: var(--sp-4); align-items: center; padding: var(--sp-3) 0; border-bottom: var(--border-w) solid var(--border); }
.field__control { min-width: 0; max-width: 100%; }
.field__control > .seg { flex-wrap: wrap; max-width: 100%; justify-content: flex-end; row-gap: 2px; }
.field__label { min-width: 0; }
.field:last-child { border-bottom: 0; }
.field--toggle .field__control { justify-self: end; }
.field__label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.field__help { font-size: var(--fs-xs); color: var(--text-3); font-weight: var(--fw-regular); line-height: 1.45; }

.input {
  width: 100%; height: var(--control-h); padding: 0 var(--sp-2); background: var(--surface);
  border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm); font-size: var(--fs-sm); outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); user-select: text;
}
.input:hover { border-color: var(--text-3); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder { color: var(--text-3); }
select.input { padding-right: var(--sp-6); }
.input--num { text-align: right; padding-right: 0; }
.textarea { height: auto; padding: var(--sp-2); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55; resize: vertical; }

.input-wrap { display: flex; align-items: center; gap: var(--sp-2); }
.input-wrap--grow { flex: 1; position: relative; }
.input-wrap--grow .input { padding-right: 32px; }
.input-wrap--grow .btn { position: absolute; right: 2px; }
.input-suffix { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; min-width: 60px; }
.input-row { display: flex; align-items: center; gap: var(--sp-2); }

.switch { position: relative; display: inline-block; width: 32px; height: 18px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch__track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background var(--dur) var(--ease); }
.switch__thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--dur) var(--ease); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--focus); }

.botcard { border: var(--border-w) solid var(--border); border-radius: var(--radius-md); padding: var(--sp-3); margin-bottom: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.botcard__head { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.textarea.is-custom { border-color: var(--warn); }
.bot__custom { color: var(--warn); }
.botcard__row { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: var(--sp-2); }

/* ---------- about ---------- */
.about__head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.about__name { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; }
.about__ver { font-size: var(--fs-xs); color: var(--text-2); margin: 2px 0; }
.about__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--sp-5); }
.about__kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: var(--border-w) solid var(--border); font-size: var(--fs-sm); }
.about__kv span { color: var(--text-3); }
.about__log { font-size: var(--fs-sm); color: var(--text-2); }
.about__log h4 { margin: var(--sp-3) 0 4px; font-size: var(--fs-sm); color: var(--text); font-family: var(--font-mono); }
.about__log ul { margin: 0; padding-left: 18px; }
.about__log li { margin: 2px 0; }
.range { width: 100%; accent-color: var(--accent); }

/* title-bar logo (pixel coin) */
.logo-btn { -webkit-app-region: no-drag; display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--radius-sm); }
.logo-btn:hover { background: var(--hover); }
.brand-name b { color: var(--av-gold); font-weight: 800; }

/* ---------- dynamic island (notifications) ----------
   A black pill at the top centre that springs open to fit its message.
   --island-c is the bot's colour (or the kind's) and draws the border + glow. */
.toasts { position: fixed; top: 5px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; justify-content: center; pointer-events: none; }
/* The centre pill gives way to the island that sits over it (dom.js places the island). */
#market { transition: opacity 180ms ease; }
body.island-on #market { opacity: 0; pointer-events: none; }
.island {
  --island-c: var(--accent);
  -webkit-app-region: no-drag; pointer-events: auto; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 32px; max-width: min(620px, 70vw); padding: 5px 16px 5px 6px;
  background: #000; color: #f2f2f4; border: 1.5px solid var(--island-c); border-radius: 999px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--island-c) 18%, transparent), 0 10px 30px color-mix(in srgb, var(--island-c) 22%, transparent), 0 4px 14px rgba(0, 0, 0, 0.5);
  transform-origin: top center; transform: translateY(-6px) scale(0.32, 0.55); opacity: 0;
  transition: transform 560ms cubic-bezier(0.2, 1.35, 0.35, 1), opacity 160ms ease-out;
}
.island.is-in { transform: none; opacity: 1; animation: island-glow 1.8s ease-in-out 0.5s infinite; }
/* askIsland(): a question with two buttons in the pill. */
.island--ask { cursor: default; padding-right: 6px; }
.island__btns { display: inline-flex; gap: 6px; margin-left: 10px; flex: none; }
.island__btns .btn--ghost { color: #c4c4cc; }
.island__btns .btn--ghost:hover { background: #1a1a1f; color: #fff; }
.island.is-out { transform: translateY(-14px) scale(0.5, 0.4); opacity: 0; transition: transform 300ms cubic-bezier(0.5, 0, 0.75, 0), opacity 260ms ease-in; }
@keyframes island-glow {
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--island-c) 30%, transparent), 0 10px 34px color-mix(in srgb, var(--island-c) 34%, transparent), 0 4px 14px rgba(0, 0, 0, 0.5); }
}
.island__in { display: flex; align-items: center; gap: 10px; min-width: 0; opacity: 0; transform: scale(0.96); transition: opacity 200ms ease 170ms, transform 300ms ease 170ms; }
.island.is-in .island__in { opacity: 1; transform: none; }
.island.is-out .island__in { opacity: 0; transition: opacity 120ms; }
.island__icon, .island__av { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--island-c); background: color-mix(in srgb, var(--island-c) 18%, transparent); }
.island__av { border-radius: 7px; }
.island__av .av { width: 18px; height: 18px; }
.island__text { font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Avatars inside the island use the island colour and dark ink on any theme */
/* The island is black in both themes: bots use their dark-theme colours there, so Vega (white in
   the dark theme, near-black in the light one) never disappears into it. */
.island { --bot-lead: #ececef; --av-gold: #f2c14e; }
.island .av { --av-ink: #000; }
.island .av[data-bot="lead"] { --av-ink: #000; }

/* ---------- responsive: narrow windows collapse the rail ---------- */
@media (max-width: 1180px) {
  :root { --rail-w: 64px; --side-w: 290px; }
  .rail .section-head, .rail .rules, .bot__main, .bot__state, .bot__idx { display: none; }
  .bot { grid-template-columns: 1fr; justify-items: center; padding: 10px 0; }
  .bot .av-wrap { width: 22px; height: 22px; }
  .bot .av-wrap .av { width: 22px; height: 22px; }
}

/* ---------- updates: title-bar button + popover ---------- */
.upd-wrap { position: relative; -webkit-app-region: no-drag; }
#updateBtn { position: relative; }
#updateBtn .upd-dot {
  position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg); display: none;
}
#updateBtn.has-update { color: var(--accent); }
#updateBtn.has-update .upd-dot { display: block; }
#updateBtn.is-busy .icon { animation: upd-bob 1.1s var(--ease) infinite; }
@keyframes upd-bob { 50% { transform: translateY(2px); } }
.upd-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 300px;
  display: grid; gap: var(--sp-2); padding: var(--sp-3);
  background: var(--surface); border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
}
.upd__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.upd__ver { color: var(--accent); font-weight: var(--fw-semibold); }
.upd__bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.upd__bar span { display: block; height: 100%; background: var(--accent); transition: width var(--dur) var(--ease); }
.upd__err { margin: 0; color: var(--neg); }
.upd__notes {
  max-height: 160px; overflow: auto; padding: var(--sp-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-body);
}
.upd__notes p { margin: 0 0 4px; }
.upd__when { font-size: var(--fs-xs); }
.upd__actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.about__upd { display: flex; align-items: center; gap: var(--sp-2); }

/* ---------- plans: title-bar badge ---------- */
.plan-badge {
  --plan-c: var(--text-3);
  -webkit-app-region: no-drag; margin-left: var(--sp-1); margin-right: var(--sp-4); height: 22px; padding: 0 9px; border-radius: 999px; flex-shrink: 0; /* right after the WLNK name, with room before the mode switch */
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--plan-c); border: 1px solid color-mix(in srgb, var(--plan-c) 55%, transparent);
  background: color-mix(in srgb, var(--plan-c) 10%, transparent);
}
.plan-badge:hover { background: color-mix(in srgb, var(--plan-c) 20%, transparent); }
.plan-badge.is-ending { animation: island-glow 1.8s ease-in-out infinite; --island-c: var(--warn); }

/* ---------- plans island: the notification island opened up into a card ---------- */
.plan-host[hidden] { display: none; }
.plan-host { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: center; padding: 16px; }
.pi__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); animation: pi-fade 240ms ease-out; }
@keyframes pi-fade { from { opacity: 0; } }
.island.pisland {
  /* Dark ink on the black island whatever the app theme. */
  color-scheme: dark;
  --text: #f2f2f4; --text-2: #c4c4cc; --text-3: #8a8a94; --surface: #0b0b0d; --surface-2: #141418; --surface-3: #202026;
  --border: #26262c; --border-strong: #3a3a42; --hover: #1a1a1f;
  position: relative; cursor: default; display: block; width: min(1040px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100vh - 32px); overflow: auto; padding: 24px 26px; border-radius: 28px;
  font-size: var(--fs-md); transform-origin: center; transform: scale(0.18, 0.08);
  transition: transform 620ms cubic-bezier(0.2, 1.25, 0.35, 1), opacity 160ms ease-out, border-color 300ms;
}
.island.pisland.is-in { transform: none; }
.island.pisland.is-out { transform: scale(0.2, 0.08); }
.pisland .island__in { display: grid; gap: 18px; transition: opacity 200ms ease 240ms, transform 300ms ease 240ms; }
.pisland .muted { color: var(--text-3); }

.pi__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pi__title { font-size: 20px; font-weight: var(--fw-semibold); }
.pi__sub { color: var(--text-2); font-size: var(--fs-sm); margin-top: 2px; }
.pi__net { font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); color: var(--warn); border: 1px solid var(--warn); border-radius: 999px; padding: 2px 8px; }
.pi__err { margin: 0; color: var(--neg); font-size: var(--fs-sm); }

.pi__cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 980px) { .pi__cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pi__cards { grid-template-columns: 1fr; } }
.pi__headr { display: flex; align-items: center; gap: 8px; }
/* Trade card popup (tradecard.js) */
.island.pisland.tc { width: min(760px, calc(100vw - 32px)); }
.tc__img { display: block; width: 100%; border-radius: 14px; border: 1px solid var(--border); }
.tc__share { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc__share .btn { gap: 6px; }
.tc__sep { flex: 1; }
.tc__cap { font-size: var(--fs-xs); color: var(--text-3); }
.tv__symbtn { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; text-align: left; }
.tv__symbtn:hover .tk { text-decoration: underline; text-underline-offset: 3px; }
.pi__promoRow { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 6px 0; } /* centred: type, Apply, see the new price */
.pi__promo { width: 200px; height: 34px; letter-spacing: 0.12em; text-align: center; }
.pi__ref { color: var(--av-gold); font-size: var(--fs-sm); }
.pcard__tag { font-size: var(--fs-2xs); color: var(--plan-c); border: 1px solid color-mix(in srgb, var(--plan-c) 55%, transparent); border-radius: 999px; padding: 1px 7px; }
.pcard__list li { padding-left: 1.2em; text-indent: -1.2em; line-height: 1.35; }
.pcard {
  --plan-c: var(--text-3);
  display: grid; gap: 8px; align-content: start; padding: 14px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--border); transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}
.pcard.is-on { border-color: var(--plan-c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--plan-c) 18%, transparent); transform: translateY(-2px); }
.pcard__head { display: flex; justify-content: space-between; align-items: center; }
.pcard__head b { color: var(--plan-c); font-size: var(--fs-md); }
.pcard__cur { font-size: var(--fs-2xs); color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 7px; }
.pcard__price span { font-size: 26px; font-weight: 700; }
.pcard__price small { color: var(--text-3); }
.pcard__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.pcard__list li::before { content: '✓  '; color: var(--plan-c); }
.pcard .btn { justify-self: start; margin-top: 4px; }

.pi__row, .pi__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pi__foot--end { justify-content: flex-end; }
.pi__foot .muted { font-size: var(--fs-xs); }

.pi__pay { display: grid; grid-template-columns: 264px 1fr; gap: 24px; align-items: start; }
@media (max-width: 680px) { .pi__pay { grid-template-columns: 1fr; justify-items: center; } }
.pi__qr { width: 264px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--island-c) 25%, transparent); }
.pi__qr img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }
.pi__qrcap { margin-top: 8px; text-align: center; color: #333; font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.pi__fields { display: grid; gap: 6px; min-width: 0; }
.pi__label { font-size: var(--fs-2xs); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); margin-top: 4px; }
.pi__amount { display: flex; align-items: baseline; gap: 8px; }
.pi__amount .mono { font-size: 30px; font-weight: 700; color: var(--island-c); }
.pi__amount small { color: var(--text-2); font-weight: var(--fw-semibold); }
.pi__amount .btn { align-self: center; margin-left: auto; }
.pi__addr { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.pi__addr .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: var(--fs-md); }
.pi__warn { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--text-3); line-height: var(--lh-body); }

.pi__status { display: grid; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.pi__status.is-seen { border-color: color-mix(in srgb, var(--pos) 50%, transparent); }
.pi__status.is-exp { display: block; border-color: color-mix(in srgb, var(--warn) 50%, transparent); font-size: var(--fs-sm); }
.pi__statusline { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.pi__statusline .mono { margin-left: auto; }
.pi__status .link { justify-self: start; }
.pi__bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.pi__bar span { display: block; height: 100%; background: var(--pos); border-radius: 3px; transition: width 600ms var(--ease); }
.pi__bar.is-idle span { width: 30%; background: color-mix(in srgb, var(--island-c) 70%, transparent); animation: pi-scan 1.6s ease-in-out infinite; }
@keyframes pi-scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.pi__spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--island-c); animation: pi-rot 0.9s linear infinite; }
@keyframes pi-rot { to { transform: rotate(360deg); } }
.pi__pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 0 var(--pos); animation: pi-pulse 1.4s ease-out infinite; }
@keyframes pi-pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.pi__done { display: grid; justify-items: center; gap: 6px; padding: 18px 0 6px; text-align: center; }
.pi__check { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #000; background: var(--island-c); animation: pi-pop 600ms cubic-bezier(0.2, 1.6, 0.35, 1); margin-bottom: 6px; }
.pi__check .icon { stroke-width: 2.4; }
@keyframes pi-pop { from { transform: scale(0.2); opacity: 0; } }
.pisland.is-done { animation: island-glow 1.2s ease-in-out 3; }

/* ---------- boot cover + connection pill ---------- */
.boot-cover { position: fixed; inset: var(--titlebar-h) 0 0 0; z-index: 70; display: grid; place-items: center; background: var(--bg); transition: opacity 280ms ease; }
.boot-cover.is-out { opacity: 0; pointer-events: none; }
.boot-cover__in { display: grid; justify-items: center; gap: 12px; color: var(--text-2); font-size: var(--fs-sm); text-align: center; max-width: 420px; }
.boot-spin { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--av-gold); animation: pi-rot 0.9s linear infinite; }
.boot-spin[hidden] { display: none; }
.net-pill { display: inline-flex; align-items: center; gap: 6px; height: 18px; padding: 0 8px; border-radius: 999px; font-size: var(--fs-xs); color: var(--warn); background: var(--warn-soft); }
.net-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); animation: pi-pulse 1.4s ease-out infinite; }
.net-pill[hidden] { display: none; }

/* plans island: coins, networks, loading */
.pi__coin { position: relative; display: inline-block; flex-shrink: 0; }
.pi__coinMain svg { display: block; width: 100%; height: 100%; }
.pi__coinMain { display: block; width: 100%; height: 100%; }
.pi__coinNet { position: absolute; right: -3px; bottom: -3px; width: 48%; height: 48%; border-radius: 50%; box-shadow: 0 0 0 2px #000; }
.pi__coinNet svg { display: block; width: 100%; height: 100%; }
.pi__chains { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 640px) { .pi__chains { grid-template-columns: 1fr; } }
.pchain {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: border-color 160ms, box-shadow 160ms;
}
.pchain:hover:not(:disabled) { border-color: var(--border-strong); }
.pchain.is-on { border-color: var(--island-c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--island-c) 18%, transparent); }
.pchain:disabled { opacity: 0.45; cursor: not-allowed; }
.pchain__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.pchain__text b { font-size: var(--fs-md); }
.pchain__text small { color: var(--text-3); font-size: var(--fs-xs); }
.pchain__tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #000; background: transparent; }
.pchain.is-on .pchain__tick { background: var(--island-c); }
.pi__headl { display: flex; align-items: center; gap: 14px; }
.pi__netrow { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 2px; }
.pi__netchip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px 0 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.pi__netchip span { display: inline-flex; width: 19px; height: 19px; }
.pi__netchip svg { width: 100%; height: 100%; }
.pi__qrcap { display: flex; align-items: center; justify-content: center; gap: 6px; }
.pi__qrnet { display: inline-flex; width: 16px; height: 16px; }
.pi__qrnet svg { width: 100%; height: 100%; }
.pi__warn b { color: var(--warn); }
.pi__loading { display: grid; justify-items: center; gap: 10px; padding: 34px 0 20px; text-align: center; }
.pi__spin--lg { width: 30px; height: 30px; border-width: 3px; }
.pi__erricon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pi__btnspin { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: pi-rot 0.8s linear infinite; vertical-align: -1px; }

/* Settings → Bots: one short instruction per bot */
.botnote { min-height: 0; resize: vertical; }
.botnote__count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.botnote__count.is-full { color: var(--warn); }
.botcard__row .field__label { white-space: nowrap; }

/* Market confirmation: the paper-record bar */
.live__ready { margin: var(--sp-3) 0; padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--fs-sm); }
.live__ready:empty { display: none; }
.live__ready ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.live__readyhead { font-weight: var(--fw-semibold); }
.live__ready .pos { color: var(--pos); }
.live__ready .neg { color: var(--neg); }
.live__ready li .mono { color: var(--text-2); }

/* ---------- market toggle (emoji) + title-bar overflow menu ---------- */
.titlebar__brand, .titlebar__actions { min-width: 0; }
.titlebar__brand > *, .titlebar__actions > *, .titlebar__center > * { flex-shrink: 0; white-space: nowrap; }
.seg--asset { margin-left: var(--sp-2); }
.seg__btn--emoji { min-width: 30px; padding: 0 6px !important; }
.seg__emo { display: inline-flex; opacity: 0.5; transition: opacity 150ms, transform 150ms; }
.seg__emo svg { display: block; }
.seg__btn--emoji .seg__txt { display: none; }
.seg__btn--emoji.is-on { background: var(--surface-3); box-shadow: none; }
.seg__btn--emoji.is-on .seg__emo, .seg__btn--emoji:hover .seg__emo { opacity: 1; }
.seg__btn--emoji.is-on .seg__emo { transform: scale(1.08); }
.seg__btn--emoji:disabled { opacity: 0.4; cursor: not-allowed; }

.tbmenu-wrap { position: relative; -webkit-app-region: no-drag; }
.tbmenu-btn { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; }
.tbmenu-btn[hidden] { display: none; }
.tbmenu-btn span { display: block; width: 14px; height: 1.6px; border-radius: 1px; background: currentColor; transition: transform 160ms, opacity 160ms; }
.tbmenu-btn.is-on span:nth-child(1) { transform: translateY(4.6px) rotate(45deg); }
.tbmenu-btn.is-on span:nth-child(2) { opacity: 0; }
.tbmenu-btn.is-on span:nth-child(3) { transform: translateY(-4.6px) rotate(-45deg); }
.tbmenu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 290px; padding: var(--sp-2); border-radius: var(--radius-md); background: var(--surface); border: var(--border-w) solid var(--border-strong); box-shadow: var(--shadow-lg); }
.tbmenu[hidden] { display: none; }
.tbmenu__body { display: grid; gap: 2px; }
.tbmenu__row { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: var(--sp-2); padding: 8px 10px; border-radius: var(--radius-sm); }
.tbmenu__row:hover { background: var(--hover); }
.tbmenu__label { font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.tbmenu__row > :last-child { justify-self: start; margin: 0 !important; }
/* In the menu the market toggle shows its names too, and the next-round block sits on one line. */
.tbmenu .seg__btn--emoji .seg__txt { display: inline; margin-left: 6px; font-size: var(--fs-2xs); }
.tbmenu .seg__btn--emoji { padding: 0 10px !important; }
.tbmenu .next-round { flex-direction: row; align-items: baseline; gap: 8px; margin: 0; }
.tbmenu .next-round__label { display: none; }
.tbmenu .market { flex-wrap: wrap; height: auto; padding: 6px 12px; row-gap: 4px; }

/* shorts: a red-violet pill so they never look like a buy */
.pill--short { background: color-mix(in srgb, var(--bot-skeptic) 16%, transparent); color: var(--bot-skeptic); margin-left: 6px; font-weight: var(--fw-semibold); }

/* ---------- 0.9.1: sound bell, tokens in the status bar ---------- */
#muteBtn.is-muted { color: var(--text-3); }
.foot-tokens { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.foot-tokens.is-paid svg, .foot-tokens.is-paid b { color: #f2c14e; }
.foot-tokens.is-practice { color: var(--text-3); }
.foot-tokens.is-low { color: var(--warn); }
.foot-tokens.is-out { color: var(--neg); }

/* ---------- Luna reading the brief: a wave around the island ---------- */
.island--luna { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bot-news) 45%, transparent); animation: luna-ring 1.6s ease-out infinite; }
.island--luna .luna__av { animation: av-bob 0.9s steps(2) infinite; }
.luna__wave { display: inline-flex; align-items: center; gap: 2px; height: 16px; margin: 0 6px; }
.luna__wave i { width: 3px; height: 4px; border-radius: 2px; background: var(--bot-news); animation: luna-bar 0.9s ease-in-out infinite; }
.luna__wave i:nth-child(2) { animation-delay: 0.12s; } .luna__wave i:nth-child(3) { animation-delay: 0.24s; } .luna__wave i:nth-child(4) { animation-delay: 0.36s; } .luna__wave i:nth-child(5) { animation-delay: 0.48s; }
@keyframes luna-bar { 0%, 100% { height: 4px; } 50% { height: 15px; } }
@keyframes luna-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bot-news) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) { .island--luna, .luna__wave i, .island--luna .luna__av { animation: none; } }

/* ---------- 0.9.1 plans: annual toggle, promo check ---------- */
.pi__periodRow { display: flex; justify-content: center; }
.pi__cards.is-few { grid-template-columns: repeat(3, minmax(0, 260px)); justify-content: center; }
.pcard__save { font-size: var(--fs-2xs); color: var(--pos); margin-top: -4px; }
.pi__hint { margin: 0; text-align: center; font-size: var(--fs-xs); color: var(--text-3); }
.pi__promoBox { display: flex; gap: 8px; align-items: center; }
.pi__promoMsg { font-size: var(--fs-sm); }
.pi__promoMsg.is-ok { color: var(--pos); font-weight: var(--fw-semibold); }
.pi__promoMsg.is-ok s { color: var(--text-3); font-weight: normal; }
.pi__promoMsg.is-err { color: var(--neg); }
.pcard.is-lower { opacity: 0.5; }
.pcard.is-lower .btn[disabled] { cursor: not-allowed; }
.equity__label { font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
#acctKv { grid-template-columns: 1fr 1fr; }
#acctKv .kv b.pos { color: var(--pos); } #acctKv .kv b.neg { color: var(--neg); }

/* Run round while the plan's cooldown runs: the button fills up as the wait passes */
#runBtn.run--cool { position: relative; overflow: hidden; background: color-mix(in srgb, var(--accent) 28%, var(--surface-2)); color: var(--text); }
#runBtn.run--cool::before { content: ""; position: absolute; inset: 0; width: var(--fill, 0%); background: var(--accent); opacity: 0.85; transition: width 0.9s linear; z-index: 0; }
#runBtn.run--cool > * { position: relative; z-index: 1; }
#runBtn.run--cool.is-closed { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
#runBtn.run--cool.is-closed::before { display: none; }
#runBtn.run--cool.is-queued { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
/* The island stays visible over onboarding and the tour (Luna narrates there) */
.toasts { z-index: 2100; }

/* ---------- 0.9.5: settings easier to read, with icons and search ---------- */
#settings .sheet { width: min(1080px, calc(100vw - 48px)); height: min(760px, calc(100vh - 64px)); }
#settings .sheet__body { grid-template-columns: 236px 1fr; }
.tabs { gap: 3px; overflow-y: auto; }
.tabs__btn { height: 38px; font-size: var(--fs-md); display: flex; align-items: center; gap: 10px; }
.tabs__btn i { font-style: normal; width: 20px; text-align: center; font-size: 15px; }
.settings__search { height: 36px; margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.field__label { font-size: var(--fs-md); }
.field__help { font-size: var(--fs-xs); line-height: 1.5; }
.form-note { font-size: var(--fs-sm); }
.form-group { font-size: var(--fs-xs); margin-top: var(--sp-6, 28px); }
.sresults { display: grid; gap: 6px; }
.sresult { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; text-align: left; padding: 10px 12px; border-radius: var(--radius-md); background: var(--surface-2); border: var(--border-w) solid var(--border); }
.sresult:hover { border-color: var(--accent); }
.sresult b { display: block; font-size: var(--fs-md); }
.sresult small { color: var(--text-3); font-size: var(--fs-xs); }
.sresult__tab { font-size: var(--fs-xs); color: var(--text-3); }
.field.is-found { animation: found 1.8s ease-out; border-radius: var(--radius-md); }
@keyframes found { 0%, 40% { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); } 100% { box-shadow: none; } }

/* ---------- a round in progress: the island and the desk roster ---------- */
.island--desk { animation: dk-ring 1.8s ease-out infinite; }
.island--desk .dk__av { animation: av-bob 0.9s steps(2) infinite; }
.dk__dots { display: inline-flex; gap: 3px; margin: 0 8px 0 4px; }
.dk__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--island-c, var(--accent)); animation: dk-dot 1.2s ease-in-out infinite; }
.dk__dots i:nth-child(2) { animation-delay: 0.15s; } .dk__dots i:nth-child(3) { animation-delay: 0.3s; }
.dk__time { font-size: 11px; color: #8a8a94; }
@keyframes dk-dot { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes dk-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--island-c, var(--accent)) 45%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }
/* The bot with the floor glows in the left sidebar */
.bot.is-active .av-wrap { border-radius: 6px; animation: bot-glow 1.4s ease-in-out infinite; }
@keyframes bot-glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bot-c) 0%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bot-c) 45%, transparent), 0 0 14px color-mix(in srgb, var(--bot-c) 50%, transparent); } }
.bot.is-active { background: color-mix(in srgb, var(--bot-c) 8%, transparent); border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) { .island--desk, .island--desk .dk__av, .dk__dots i, .bot.is-active .av-wrap { animation: none; } }
/* House rules: each value on one line (long ones end with … and show in full on hover) */
.rules dt, .rules dd { white-space: nowrap; }
.rules dd { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* Which mode and desk the house rules (and the per-desk settings) are for */
.rules-desk, .deskswitch__mode { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); margin-left: auto; margin-right: 8px; white-space: nowrap; }
.rules-desk.is-demo, .deskswitch__mode.is-demo { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.rules-desk.is-live, .deskswitch__mode.is-live { background: color-mix(in srgb, var(--neg) 18%, transparent); color: var(--neg); }
.deskswitch { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; margin-bottom: var(--sp-3); border-radius: var(--radius-md); background: var(--surface-2); border: var(--border-w) solid var(--border); }
.deskswitch__label { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; }
.deskswitch__mode { margin-left: 0; }
.deskswitch__note { font-size: var(--fs-xs); }
/* Settings closed with unsaved changes: the sheet shakes and Save glows */
#settings .sheet.is-shake { animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
/* Save: a green border that pulses; Discard changes is the red (danger) button */
#saveBtn.is-nudge { outline: 2px solid var(--pos); outline-offset: 2px; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pos) 60%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--pos) 22%, transparent); } }
/* The GeckoTerminal chart link: an outlined little button, so it reads as something to click. */
.gecko { display: inline-flex; align-items: center; justify-content: center; margin-left: 5px; height: 18px; min-width: 22px; padding: 0 4px; font-size: 11px; line-height: 1; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; vertical-align: middle; transition: border-color 120ms, background 120ms, transform 120ms; }
.gecko:hover { border-color: var(--blue, #4d7fff); background: color-mix(in srgb, var(--blue, #4d7fff) 16%, var(--surface-2)); transform: translateY(-1px); }
.gecko:active { transform: none; }

/* ---------- several islands at once: the later ones are glowing balls ---------- */
.toasts { gap: 8px; align-items: flex-start; }
/* Balls wait to the right of the full island without moving it off the centre. */
.island.is-ball { position: absolute; top: 0; left: calc(100% + 8px + var(--ball-i, 0) * 40px); width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; justify-content: center; border-radius: 50%; overflow: hidden; cursor: pointer; animation: ball-glow 1.3s ease-in-out infinite; }
.island.is-ball .island__in { gap: 0; justify-content: center; }
.island.is-ball .island__in > :not(.island__av):not(.island__icon) { display: none; }
.island.is-ball .island__av, .island.is-ball .island__icon { width: 24px; height: 24px; }
.island.is-ball:hover { transform: scale(1.12); }
@keyframes ball-glow { 0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--island-c) 30%, transparent), 0 0 8px color-mix(in srgb, var(--island-c) 35%, transparent); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--island-c) 18%, transparent), 0 0 18px color-mix(in srgb, var(--island-c) 65%, transparent); } }
@media (prefers-reduced-motion: reduce) { .island.is-ball { animation: none; } }
.tv__symwrap { display: inline-flex; align-items: center; gap: 2px; }
.dpos__sym { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.tchip .gecko { font-size: 10px; height: 16px; min-width: 18px; padding: 0 2px; }

/* Preloading (dom.js Preload): placeholders until the first real figures arrive. */
@keyframes preload-shimmer { from { background-position: -160px 0; } to { background-position: 160px 0; } }
body.is-preloading :is(#equity, #dayPl, #acctKv .kv b, #planBtn, #rules dd, .dhero__value, .dhero__change, .dhero__mult, .dhero__wl, .kpi__value, .tv__acct b) {
  color: transparent !important; border-color: transparent !important; border-radius: 6px; user-select: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--text) 7%, transparent) 0%, color-mix(in srgb, var(--text) 16%, transparent) 50%, color-mix(in srgb, var(--text) 7%, transparent) 100%) 0 0 / 320px 100% !important;
  animation: preload-shimmer 1.2s linear infinite;
}
body.is-preloading :is(#equity, #dayPl, #acctKv .kv b, #rules dd, .dhero__value, .dhero__change, .dhero__mult, .dhero__wl) * { visibility: hidden; }
body.is-preloading #equity { min-width: 140px; display: inline-block; }
body.is-preloading #positions, body.is-preloading #orders { opacity: .35; }

/* The round chip saying why nothing new starts (all memecoin slots used, out of tokens…). */
.next-round.is-waiting { background: color-mix(in srgb, var(--warn) 16%, var(--surface-2)); }
.next-round.is-waiting .next-round__value { color: var(--warn); }

/* Start-up loader (dom.js Preload): the desk's bots bobbing in the middle, the app blurred behind,
   until the first real figures are in. */
.bootload { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(12px) saturate(0.8); -webkit-backdrop-filter: blur(12px) saturate(0.8); transition: opacity 360ms ease; -webkit-app-region: drag; }
.bootload.is-out { opacity: 0; pointer-events: none; }
.bootload__card { display: grid; justify-items: center; gap: 10px; padding: 26px 34px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); text-align: center; }
.bootload__card b { font-size: 16px; }
.bootload__sub { font-size: 13px; color: var(--text-3); }
.bootload__bots { display: flex; gap: 12px; margin-bottom: 4px; }
.bootload__bot { width: 62px; height: 62px; display: grid; place-items: center; border-radius: 16px; background: color-mix(in srgb, var(--bot-c) 16%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--bot-c) 40%, transparent); animation: boot-bob 1.1s ease-in-out infinite; animation-delay: calc(var(--i) * 0.14s); }
/* The loader's one bot (dom.js picks it): its colour, a gentle bob and a soft glow. */
.bootload__bot { width: 96px; height: 96px; border-radius: 0; animation-duration: 1.4s; background: none; box-shadow: none; border: 0; }
.bootload__bot svg { width: 88px; height: 88px; }
.bootload__bot[data-bot="lead"] { --bot-c: var(--bot-lead); }
.bootload__bot[data-bot="news"] { --bot-c: var(--bot-news); }
.bootload__bot[data-bot="scanner"] { --bot-c: var(--bot-scanner); }
.bootload__bot[data-bot="planner"] { --bot-c: var(--bot-planner); }
.bootload__bot[data-bot="risk"] { --bot-c: var(--bot-risk); }
.bootload__bot[data-bot="skeptic"] { --bot-c: var(--bot-skeptic); }
.bootload__sub { font-family: var(--font-mono); letter-spacing: 0.02em; }
.bootload__card b { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.14em; }
.bootload__bar { position: relative; width: 180px; height: 4px; border-radius: 99px; overflow: hidden; background: var(--surface-2); margin-top: 4px; }
.bootload__bar i { position: absolute; inset: 0; width: 40%; border-radius: 99px; background: var(--accent); animation: boot-bar 1.2s ease-in-out infinite; }
@keyframes boot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes boot-bar { from { transform: translateX(-110%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .bootload__bot, .bootload__bar i { animation: none; } }

/* ---------- Settings, refreshed: softer cards, clear sections, livelier controls ---------- */
#settings .sheet { border-radius: 20px; overflow: hidden; }
#settings .sheet__head { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface)); }
#settings .tabs { gap: 3px; padding: var(--sp-3) var(--sp-2); background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
#settings .tabs__btn { position: relative; height: 36px; display: flex; align-items: center; gap: 10px; border-radius: 10px; transition: background 140ms ease, color 140ms ease, transform 140ms ease; }
#settings .tabs__btn i { font-style: normal; width: 22px; text-align: center; font-size: 15px; }
#settings .tabs__btn:hover { transform: translateX(2px); }
#settings .tabs__btn.is-on { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--text); }
#settings .tabs__btn.is-on::before { content: ''; position: absolute; left: -2px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
#settings .pane { gap: 6px; padding-bottom: var(--sp-5); }
#settings .form-group { display: flex; align-items: center; gap: 10px; margin: var(--sp-5) 0 var(--sp-2); color: var(--accent); }
#settings .form-group::after { content: ''; flex: 1; height: 1px; background: var(--border); }
#settings .form-note { position: relative; padding: 10px 12px 10px 36px; border: 1px solid var(--border); border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--surface-2)); }
#settings .form-note::before { content: 'ℹ'; position: absolute; left: 12px; top: 9px; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
#settings .field { padding: 12px 14px; border: 1px solid transparent; border-bottom: 1px solid transparent; border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 45%, transparent); transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
#settings .field:hover { background: var(--surface-2); border-color: var(--border); }
#settings .field:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, transparent); box-shadow: 0 0 0 3px var(--focus); }
#settings .field__help { margin-top: 2px; }
#settings .input { height: 34px; border-radius: 10px; background: var(--surface); transition: border-color 140ms ease, box-shadow 140ms ease; }
#settings .input-suffix { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
#settings .seg { border-radius: 12px; padding: 3px; }
#settings .seg__btn { height: 28px; padding: 0 12px; border-radius: 9px; transition: background 140ms ease, color 140ms ease; }
#settings .seg__btn.is-on { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--text); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
#settings .switch { width: 38px; height: 22px; }
#settings .switch__thumb { top: 3px; left: 3px; width: 16px; height: 16px; }
#settings .switch input:checked ~ .switch__track { background: var(--accent); }
#settings .switch input:checked ~ .switch__track .switch__thumb, #settings .switch input:checked + .switch__track .switch__thumb { transform: translateX(16px); }
#settings #settingsSearch { height: 36px; border-radius: 12px; }

/* The share card (Settings → Profile). */
.sharecard { display: grid; gap: 10px; margin-top: var(--sp-4); padding: 18px; border-radius: 18px; border: 1px solid var(--border); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%), var(--surface-2); }
.sharecard__head { display: flex; gap: 12px; align-items: center; }
.sharecard__head b { display: block; font-size: 15px; }
.sharecard__head small { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.4; }
.sharecard__badge { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-size: 18px; background: color-mix(in srgb, var(--accent) 18%, var(--surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.sharecard__label { margin-top: 4px; font-size: var(--fs-2xs); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-3); }
.sharecard__chips { display: flex; gap: 8px; flex-wrap: wrap; }
.sharechip { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); transition: all 140ms ease; }
.sharechip:hover { border-color: var(--text-3); color: var(--text); }
.sharechip.is-on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }
.sharechip.is-on::before { content: '✓ '; color: var(--accent); font-weight: 700; }
.sharecard__tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sharetile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-align: left; transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease; }
.sharetile:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.sharetile__icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: 16px; background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); color: var(--accent); }
.sharetile__text { display: grid; }
.sharetile__text small { color: var(--text-3); font-size: var(--fs-xs); }
.sharecard__send-row { display: grid; grid-template-columns: 160px 1fr auto; gap: 8px; }
.sharecard__id { letter-spacing: .06em; text-transform: uppercase; }
.sharecard .input { height: 38px; border-radius: 12px; background: var(--surface); }
.sharecard__send { height: 38px; padding: 0 18px; border-radius: 12px; }
.sharecard__fine { margin: 0; font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 900px) { .sharecard__send-row { grid-template-columns: 1fr; } .sharecard__tiles { grid-template-columns: 1fr; } }

/* Update notes: one heading per version newer than the installed one. */
.upd__ver { margin-top: 8px; font-family: var(--font-mono); font-size: var(--fs-2xs); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.upd__ver:first-child { margin-top: 0; }

/* House rules → Real money: an emoji per desk; the desk shown is lit, the others dimmed. */
.rules-live { display: inline-flex; gap: 6px; justify-content: flex-end; }
.rules-live__d { font-size: 15px; line-height: 1; opacity: .35; filter: grayscale(.6); transition: opacity 150ms ease; }
.rules-live__d.is-on { opacity: 1; filter: none; }

/* Vega speaking (vega.js speak): his avatar bobs with a gold pulse and a voice wave plays beside
   it, on the island and on his Settings bubble, only while the voice is playing. */
.vega__wave { display: none; align-items: center; gap: 2px; height: 14px; margin: 0 2px 0 -2px; }
.vega__wave i { width: 3px; height: 4px; border-radius: 2px; background: var(--av-gold, #f2c14e); animation: luna-bar 0.8s ease-in-out infinite; }
.vega__wave i:nth-child(2) { animation-delay: .12s; } .vega__wave i:nth-child(3) { animation-delay: .24s; } .vega__wave i:nth-child(4) { animation-delay: .36s; }
body.vega-talking .vega__wave { display: inline-flex; }
body.vega-talking .island[data-bot="lead"] .island__av,
body.vega-talking .vcoach__av { animation: av-bob .9s steps(2) infinite, vega-ring 1.4s ease-out infinite; }
body.vega-talking .island[data-bot="lead"].island--ask { animation: vega-ring 1.6s ease-out infinite; }
.vcoach__body small .vega__wave { margin: 0 0 0 8px; height: 10px; vertical-align: middle; }
@keyframes vega-ring { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--av-gold, #f2c14e) 55%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { body.vega-talking .island[data-bot="lead"] .island__av, body.vega-talking .vcoach__av, body.vega-talking .island--ask, .vega__wave i { animation: none; } }
.botnote__rule { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; padding: 8px 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-xs); background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: var(--fs-xs); color: var(--text-2); }
.botnote__rule[hidden] { display: none; }
.botnote__rule span { flex: 1; min-width: 200px; }

/* Forex setup (Settings → Forex) and the gold-bars icon wherever Forex is named. */
.fx__ico { display: inline-flex; align-items: center; gap: 6px; }
.fx__ico svg { width: 16px; height: 16px; flex: none; }
.tabs__svg svg { width: 16px; height: 16px; display: block; }
.hl__svg svg { display: block; }
.fx__wiz, .fx__all { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.fx__steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.fx__stepdot { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: var(--fs-2xs); color: var(--text-3); }
.fx__stepdot.is-on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.fx__stepdot.is-done { color: var(--text-2); }
.fx__q { margin: 10px 0 0; font-size: var(--fs-md, 15px); }
.fx__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.fx__strats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.fx__card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.fx__card small { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.45; }
.fx__card--sm { padding: 10px 12px; }
.fx__card:hover { border-color: var(--border-strong); }
.fx__card.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.fx__chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.fx__chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; }
.fx__chip b { display: block; font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text); }
.fx__chip small { display: block; font-size: var(--fs-2xs); color: var(--text-3); }
.fx__chip.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.fx__tick { width: 14px; color: var(--accent); font-weight: 700; }
.fx__row { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.fx__seg { flex-wrap: wrap; }
.fx__field { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fx__why { margin: 0; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: var(--fs-xs); line-height: 1.5; color: var(--text-2); }
.fx__nav { display: flex; justify-content: space-between; margin-top: 8px; }

.fx__hours { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fx__hours label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-2xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.fx__time { width: 130px; font-family: var(--font-mono); }
.fx__tz { min-width: 240px; }
.fx__hours .form-note { flex-basis: 100%; margin: 0; }

.next-round.is-action, .is-action.is-waiting { cursor: pointer; }
.is-action.is-waiting:hover { filter: brightness(1.15); }

/* Desks you trade (Settings → General) and off desks in the title bar. */
.dsw__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dsw__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dsw__row--1 { grid-template-columns: minmax(0, 1fr); }
.dsw { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'ico name state' 'btns btns btns'; align-items: center; gap: 8px 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-3); min-width: 0; }
.dsw__ico { grid-area: ico; }
.dsw__name { grid-area: name; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsw__ico svg { width: 18px; height: 18px; display: block; filter: grayscale(1); opacity: .6; }
.dsw__state { grid-area: state; font: 700 var(--fs-2xs) var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.dsw__btns { grid-area: btns; display: flex; gap: 6px; flex-wrap: wrap; }
.dsw__btns .btn { flex: 1 1 0; min-width: 0; }
.dsw.is-on { border-color: color-mix(in srgb, var(--pos) 55%, var(--border)); }
.dsw.is-on .dsw__name { color: var(--text); }
.dsw.is-on .dsw__ico svg { filter: none; opacity: 1; }
.dsw.is-on .dsw__state { color: var(--pos); background: color-mix(in srgb, var(--pos) 14%, transparent); }
.dsw.is-paused { border-color: color-mix(in srgb, var(--warn) 55%, var(--border)); }
.dsw.is-paused .dsw__state { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.field__label .deskswitch__mode { align-self: flex-start; margin: 2px 0 0; }
#assetSeg .seg__btn.is-off:not(.is-on) { opacity: .4; }
#assetSeg .seg__btn.is-off:not(.is-on) svg { filter: grayscale(1); }

/* Settings → Connections: the broker sign-in boxes (TradeLocker, cTrader) */
.exc { display: grid; gap: var(--sp-3); padding: var(--sp-3) 0; }
.exc__steps { margin: 0; padding-left: 1.3em; display: grid; gap: 4px; font-size: var(--fs-sm); color: var(--text-2); }
.exc__btns { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.exc__found { display: grid; gap: var(--sp-2); padding: var(--sp-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); }
.exc__acct { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.exc__meta { font-size: var(--fs-xs); color: var(--text-3); }
.exc__linked { display: grid; gap: 4px; }
.exc__row { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.exc__k { min-width: 64px; color: var(--text-3); }

.fx__vegabox { display: grid; gap: 4px; padding: var(--sp-3); border: var(--border-w) solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--fs-sm); }
.fx__vegabox p { margin: 0; }
.exc__acctrow { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); }
.exc__acctrow .btn { margin-left: auto; }


/* Settings → Connections → TradeLocker: the sign-in fields */
.tlf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.tlf label { display: grid; gap: 4px; font-size: var(--fs-xs); color: var(--text-3); }
@media (max-width: 900px) { .tlf { grid-template-columns: 1fr; } }

/* Settings → Memecoins → Market wallet: create, fund, withdraw */
.mwb__row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.mwb__qr { width: 120px; height: 120px; flex: none; background: #fff; border-radius: var(--radius-sm); padding: 4px; }
.mwb__qr svg { width: 100%; height: 100%; display: block; }
.mwb__addr { display: grid; gap: 6px; min-width: 0; }
.mwb__addr b { word-break: break-all; font-size: var(--fs-sm); }
.mwb__send { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: var(--sp-2); align-items: center; }
@media (max-width: 900px) { .mwb__send { grid-template-columns: 1fr; } }

/* Settings → Connections → WLNK Cloud */
.cbx__row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: var(--fs-sm); }
.sp__cloud { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* (i) info tips: help on hover, focus or tap instead of paragraphs */
.itip { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); cursor: help; vertical-align: middle; flex: none; }
.itip:hover, .itip:focus-visible, .itip[aria-expanded='true'] { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); outline: none; }
.itip__pop { position: fixed; z-index: 10000; padding: 9px 11px; border: 1px solid var(--border-strong, var(--border)); border-radius: 8px; background: var(--surface-1, var(--surface)); color: var(--text-1, var(--text)); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-family: var(--font-sans, inherit); font-size: var(--fs-xs); font-weight: var(--fw-regular, 400); letter-spacing: normal; text-transform: none; line-height: 1.5; pointer-events: auto; }
.itip__pop[hidden] { display: none; }
.field__label > span:first-child { display: inline-flex; align-items: center; flex-wrap: wrap; }
.form-group .itip { margin-left: 8px; }
#settings .form-note.form-note--brief { display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
#settings .form-note.form-note--brief .itip { margin-left: 0; }
#settings .form-note.form-note--brief { padding: 6px 10px; }
#settings .form-note.form-note--brief::before { content: none; display: none; }

/* Settings → Memecoins: your wallets */
.mwl { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.mwl__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.mwl__row.is-active { border-color: color-mix(in srgb, var(--pos, #3ddc84) 55%, transparent); }
.mwl__main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); min-width: 0; }
.mwl__nm { font-weight: 700; }
.mwl__sol { margin-left: 4px; }
.mwl__acts { flex-wrap: wrap; }
.mwl__name { max-width: 180px; height: 28px; }
.mwl__key, .mwl__codebox, .mwl__import { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.mwl__key .input { flex: 1; min-width: 200px; }
.mwl__code { width: 110px; letter-spacing: .3em; }
.mwl__import .input { flex: 1; min-width: 160px; }

/* Dashboard → Customize: Reset and Save float at the bottom centre while scrolling */
.dtray { position: sticky; bottom: 18px; z-index: 30; display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 32px); margin: 16px auto 0; padding: 8px 10px 8px 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45); }
.dtray[hidden] { display: none; }
.dtray__label { font-size: var(--fs-xs); color: var(--text-3); margin-right: 4px; white-space: nowrap; }
.dtray .btn { border-radius: 999px; }
.dtray .dtool__add { max-width: 190px; }

/* A mode named in text (e.g. "Paper account"): the title bar's colour for that mode */
.modeword { font-weight: var(--fw-semibold); }
.modeword.is-paper { color: var(--accent); }
.modeword.is-demo { color: var(--warn); }
.modeword.is-live { color: var(--neg); }

/* A position being closed: its row dims and its Close button reads "Closing…" (dom.js Closing). */
.pcard.is-closing, .tv__row.is-closing { opacity: 0.55; transition: opacity 150ms; }
.pcard__close.is-closing { cursor: progress; }
.pcard__close.is-closing .pcard__x { animation: closing-spin 0.9s linear infinite; }
@keyframes closing-spin { to { transform: rotate(360deg); } }

/* Standby: another device trades Paper and Market (app.js renderTradeBar). */
.tradebar { position: fixed; left: 50%; top: 56px; transform: translateX(-50%); z-index: 900; display: flex; align-items: center; gap: 10px; max-width: min(720px, calc(100vw - 32px)); padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--surface-2, #1b1f29); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); font-size: var(--fs-sm); color: var(--text-2); }
.tradebar__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.tradebar__text { flex: 1; min-width: 0; }
.tradebar .btn { flex: none; }
