/* Bazooka design system (spec §6). Tokens first, then base, controls,
   shell, page blocks, data display, legacy classes, responsive tiers. */
@font-face { font-family: Geist; src: url("/assets/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

/* ---- tokens ----
   Theme CSS (/workspace/appearance.css) and the Settings live preview
   override the literal tokens; the derived tokens below follow them. */
:root, :root.bz-theme-default {
  --bg: #0b0b0c;
  --panel: #0d0d0f;
  --card: #111113;
  --control: #141416;
  --control-active: #18181b;
  --hairline: #1b1b1e;
  --hairline-inner: #161618;
  --input-border: #26262a;
  --fg: #f5f5f6;
  --text-secondary: #a3a3ab;
  --muted: #6e6e76;
  --accent: oklch(0.74 0.19 53);
  --ok: oklch(0.80 0.16 155);
  --danger: oklch(0.72 0.18 22);
  --warning: oklch(0.84 0.13 92);
  --accent-2: oklch(0.75 0.12 300);
}
:root {
  color-scheme: dark;
  /* Derived from the tokens above (exact for the default theme). */
  --accent-pressed: oklch(from var(--accent) calc(l - 0.14) c h);
  --accent-tint: oklch(from var(--accent) calc(l + 0.08) calc(c * 0.37) calc(h + 27) / 0.14);
  --accent-link: oklch(from var(--accent) calc(l + 0.06) calc(c - 0.02) h);
  --on-accent: #0b0b0c;
  --ok-ink: #04140b;
  --danger-text: oklch(from var(--danger) calc(l + 0.08) calc(c - 0.04) h);
  --danger-solid: oklch(from var(--danger) calc(l - 0.08) calc(c + 0.03) h);
  --danger-fill: oklch(from var(--danger) calc(l - 0.02) calc(c + 0.01) h / 0.16);
  --warning-text: oklch(from var(--warning) calc(l + 0.02) calc(c - 0.01) h);
  --warning-ink: oklch(from var(--warning) calc(l + 0.06) calc(c - 0.04) h);
  --raised: color-mix(in srgb, var(--card) 67%, var(--control));          /* #121214 dialogs, drawers, row hover */
  --row-sel: color-mix(in srgb, var(--card) 75%, var(--panel));           /* #101012 selected row */
  --seg-on: color-mix(in srgb, var(--input-border) 86%, var(--control-active)); /* #242428 */
  --chip: color-mix(in srgb, var(--input-border) 29%, var(--control-active));   /* #1c1c1f badges, tiles, disabled */
  --kbd-bg: color-mix(in srgb, var(--input-border) 50%, var(--control-active)); /* #1f1f22 */
  --toast-bg: color-mix(in srgb, var(--input-border) 14%, var(--control-active)); /* #1a1a1d */
  --stroke-strong: color-mix(in srgb, var(--input-border), var(--fg) 2%);      /* #2a2a2e */
  --check-border: color-mix(in srgb, var(--muted) 28%, var(--input-border));    /* #3a3a40 */
  --faint: color-mix(in srgb, var(--muted) 50%, var(--input-border));           /* #4a4a50 placeholders */
  --dim: color-mix(in srgb, var(--text-secondary) 53%, var(--muted));           /* #8a8a92 */
  /* Legacy aliases (dashboard.js, market-chart.js and older templates read them). */
  --panel-2: var(--card);
  --border: var(--hairline);
  --input-bg: var(--panel);
  --grad-cta: var(--accent);
  --grad-hero: var(--panel);
  --grad-pnl: var(--card);
  --stat-blue: var(--accent);
  --stat-green: var(--ok);
  --stat-teal: var(--ok);
  --stat-purple: var(--accent);
  /* Type and layout. */
  --font-sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar-width: 244px;
  --sidebar-icons: 60px;
  --rail-width: 276px;
  --rail-collapsed: 44px;
  --rail-space: 0px;
  --footer-height: 0px;
  --bottom-nav: 0px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --motion: 160ms;
  /* Button style (theme CSS switches modern / classic / rounded). */
  --btn-radius: 8px;
  --btn-sec-bg: var(--control);
  --btn-sec-border: var(--control);
  --btn-buy-bg: var(--ok);
  --btn-buy-fg: var(--ok-ink);
  --btn-sell-bg: var(--danger-solid);
  --btn-sell-fg: #fff;
  --btn-tint-buy: color-mix(in srgb, var(--ok) 16%, transparent);
  --btn-tint-sell: var(--danger-fill);
}

/* ---- base ---- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 13px; -webkit-text-size-adjust: 100%; scrollbar-color: var(--stroke-strong) transparent; scrollbar-width: thin; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font: 400 13px/1.45 var(--font-sans); letter-spacing: -.005em; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:where(button, input, select, textarea) { font: inherit; letter-spacing: inherit; color: inherit; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--text-secondary); }
a.link, .link { color: var(--accent-link); }
a.link:hover, .link:hover { color: var(--fg); }
button, a, input, select, textarea, summary, label { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; line-height: 1.3; }
h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; line-height: 1.3; }
h4 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 16px 0; }
small { font-size: 11px; }
code { font: 400 12px var(--font-mono); }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; padding: 1px 5px; border-radius: 4px; background: var(--kbd-bg); color: var(--fg); font: 500 10px/1.4 var(--font-mono); letter-spacing: 0; }
.mono, .addr, code, .cell-input { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.mono { overflow-wrap: anywhere; }
p.muted, .subhead, .muted { color: var(--muted); }
p.muted, .subhead { font-size: 12px; line-height: 1.6; }
.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; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--chip); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- form controls ---- */
:where(input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=file]):not([type=range]):not([type=color]), select, textarea) {
  width: 100%; min-width: 0; min-height: 38px; padding: 8px 12px; border: 1px solid var(--input-border); border-radius: 9px; background: var(--panel); color: var(--fg); font-size: 13px; line-height: 1.4;
  transition: border-color var(--motion) var(--ease);
}
:where(select) { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e76' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
:where(select[multiple]) { background-image: none; padding-right: 12px; }
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type=file] { max-width: 100%; font-size: 12px; color: var(--text-secondary); }
input[type=file]::file-selector-button { height: 32px; padding: 0 12px; margin-right: 10px; border: 1px solid var(--btn-sec-border); border-radius: var(--btn-radius); background: var(--btn-sec-bg); color: var(--fg); font: 500 12px var(--font-sans); cursor: pointer; }
input[type=color] { width: 38px; height: 32px; padding: 2px; border: 1px solid var(--input-border); border-radius: 8px; background: var(--panel); cursor: pointer; }
input[type=range] { accent-color: var(--accent); }
/* Checkbox: 16 px, orange fill + ✓ when checked, – when indeterminate. */
input[type=checkbox] {
  appearance: none; flex: none; width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer;
  border: 1.5px solid var(--check-border); border-radius: 4px; background: transparent center / 10px 10px no-repeat;
  transition: background-color 80ms, border-color 80ms;
}
input[type=checkbox]:checked { border-color: var(--accent); background-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.6 5.2l2.2 2.2 4.6-4.8' fill='none' stroke='%230b0b0c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
input[type=checkbox]:indeterminate { border-color: var(--accent); background-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5h6' stroke='%230b0b0c' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
input[type=checkbox]:disabled { cursor: not-allowed; opacity: .45; }
input[type=radio] { appearance: none; flex: none; width: 16px; height: 16px; margin: 0; vertical-align: middle; cursor: pointer; border: 1.5px solid var(--check-border); border-radius: 50%; background: transparent; transition: box-shadow 80ms, border-color 80ms; }
input[type=radio]:checked { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 8px var(--accent); }
input[type=radio]:disabled { cursor: not-allowed; opacity: .45; }
label { display: block; margin-bottom: 6px; color: var(--text-secondary); font-size: 12px; }
:where(label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea) { margin-top: 6px; }
label:has(> input[type=checkbox], > input[type=radio]) { cursor: pointer; }
.lbl { display: block; margin: 0 0 6px; color: var(--text-secondary); font-size: 12px; font-weight: 400; }
.field { position: relative; display: flex; align-items: center; min-width: 0; }
.field > input, .field > select { flex: 1; }
.field > .field-unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; white-space: nowrap; }
.field:has(> .field-unit) > input { padding-right: 56px; }
.field.invalid > input, .field.invalid > select, .field.invalid > textarea, input.invalid { border-color: var(--danger); }
.field-error { display: block; margin-top: 6px; color: var(--danger-text); font-size: 11px; }
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search::before { content: ""; position: absolute; left: 10px; width: 13px; height: 13px; pointer-events: none; background: currentColor; color: var(--muted); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m16 16 5 5'/%3E%3C/svg%3E") center / contain no-repeat; }
.search > input, input.search { min-height: 32px; height: 32px; padding: 0 10px 0 30px; border-color: transparent; border-radius: 8px; background: var(--control); font-size: 12px; }
.search > input:focus, input.search:focus { border-color: var(--accent); }

/* ---- buttons ---- */
:where(button) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 0; padding: 6px 12px; border: 1px solid var(--btn-sec-border); border-radius: var(--btn-radius); background: var(--btn-sec-bg); color: var(--fg); font-size: 12px; font-weight: 500; line-height: 1.4; cursor: pointer; transition: background-color var(--motion) var(--ease), border-color var(--motion) var(--ease), color var(--motion) var(--ease); }
:where(button:hover:not(:disabled)) { background: var(--control-active); }
:where(button:disabled) { cursor: not-allowed; background: var(--chip); border-color: transparent; color: var(--muted); }
button.inline { width: auto; margin: 0; padding: 4px 8px; font-size: 12px; }
button.danger { background: var(--btn-tint-sell); color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 26%, transparent); }
button.ghost { background: transparent; color: var(--text-secondary); border-color: var(--hairline); }
button.ghost:hover:not(:disabled) { color: var(--fg); background: var(--control); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 32px; padding: 0 12px; border: 1px solid var(--btn-sec-border); border-radius: var(--btn-radius); background: var(--btn-sec-bg); color: var(--fg); font: 500 12px/1 var(--font-sans); white-space: nowrap; text-decoration: none; cursor: pointer; user-select: none; }
a.btn:hover { color: var(--fg); }
.btn:hover:not(:disabled):not([aria-disabled=true]) { background: var(--control-active); border-color: var(--control-active); }
.btn kbd { background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; }
.btn-secondary { background: var(--btn-sec-bg); border-color: var(--btn-sec-border); color: var(--fg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
a.btn-primary:hover { color: var(--on-accent); }
.btn-primary:hover:not(:disabled):not([aria-disabled=true]) { background: color-mix(in oklab, var(--accent) 88%, #fff); border-color: color-mix(in oklab, var(--accent) 88%, #fff); }
.btn-primary:active:not(:disabled) { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.btn-ghost { background: transparent; border-color: var(--hairline); color: var(--fg); }
.btn-ghost:hover:not(:disabled):not([aria-disabled=true]) { background: var(--control); border-color: var(--hairline); }
.btn-buy { background: var(--btn-buy-bg); border-color: var(--ok); color: var(--btn-buy-fg); font-weight: 700; }
a.btn-buy:hover { color: var(--btn-buy-fg); }
.btn-buy:hover:not(:disabled):not([aria-disabled=true]) { background: color-mix(in oklab, var(--btn-buy-bg) 88%, #fff); border-color: var(--ok); }
.btn-sell { background: var(--btn-sell-bg); border-color: var(--danger); color: var(--btn-sell-fg); font-weight: 700; }
a.btn-sell:hover { color: var(--btn-sell-fg); }
.btn-sell:hover:not(:disabled):not([aria-disabled=true]) { background: color-mix(in oklab, var(--btn-sell-bg) 88%, #fff); border-color: var(--danger); }
.btn-nuke { background: transparent; border-color: var(--danger); color: var(--danger-text); font-weight: 600; }
.btn-nuke:hover:not(:disabled):not([aria-disabled=true]) { background: var(--danger-fill); border-color: var(--danger); }
.btn-link { height: auto; padding: 0; border: 0; background: transparent; color: var(--accent-link); font-weight: 500; }
.btn-link:hover:not(:disabled) { background: transparent; border: 0; color: var(--fg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 16px; border-radius: max(var(--btn-radius), 10px); font-size: 13px; font-weight: 600; }
.btn-block { display: flex; width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { background: var(--chip); border-color: var(--chip); color: var(--muted); cursor: not-allowed; }
.btn-link:disabled { background: transparent; border: 0; }
.icon-button { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); }
.icon-button:hover:not(:disabled) { color: var(--fg); background: var(--control-active); }
.icon-button svg { width: 16px; height: 16px; }

/* ---- segmented, tabs, chips, option cards, toggle ---- */
.seg { display: inline-flex; align-items: center; gap: 0; padding: 3px; border-radius: 8px; background: var(--control); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 5px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); font: 500 12px/1.35 var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none; }
.seg-opt:hover:not(:disabled) { background: transparent; color: var(--fg); }
.seg-opt.on, .seg-opt[aria-pressed=true], .seg-opt[aria-current], .seg-opt[aria-selected=true] { background: var(--seg-on); color: var(--fg); }
.seg-opt.on:hover, .seg-opt[aria-pressed=true]:hover { background: var(--seg-on); }
.seg-count { color: var(--muted); font-size: 11px; font-weight: 500; }
.seg-opt:disabled { background: transparent; color: var(--faint); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--hairline); }
.tabs > a, .tabs > button { display: inline-flex; align-items: center; gap: 6px; height: auto; padding: 10px 12px; border: 0; border-radius: 0; background: transparent; color: var(--dim); font-size: 13px; font-weight: 500; box-shadow: none; white-space: nowrap; }
.tabs > a:hover, .tabs > button:hover:not(:disabled) { color: var(--fg); background: transparent; }
.tabs > .current, .tabs > [aria-current], .tabs > [aria-selected=true] { color: var(--fg); box-shadow: inset 0 -2px 0 var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 30px; margin: 0; padding: 0 12px; border: 1px solid var(--input-border); border-radius: 8px; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none; }
.chip:hover { color: var(--fg); border-color: var(--check-border); }
.chip > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip:has(> input:checked) { background: var(--accent); border-color: var(--fg); color: var(--on-accent); }
.chip:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip:has(> input:disabled) { opacity: .45; cursor: not-allowed; }
.opt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.opt-card { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 12px 14px; border: 1px solid var(--stroke-strong); border-radius: 11px; background: transparent; color: var(--text-secondary); cursor: pointer; user-select: none; transition: border-color var(--motion) var(--ease), background-color var(--motion) var(--ease); }
.opt-card:hover { border-color: var(--check-border); }
.opt-card > input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.opt-title { color: var(--text-secondary); font-size: 13px; font-weight: 600; line-height: 1.3; }
.opt-sub { color: var(--muted); font-size: 11px; line-height: 1.45; }
.opt-card:has(> input:checked) { background: var(--control); border-color: var(--accent); }
.opt-card:has(> input:checked) .opt-title { color: var(--fg); }
.opt-card:has(> input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-card:has(> input:disabled) { opacity: .45; cursor: not-allowed; }
.toggle { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--fg); font-size: 12px; cursor: pointer; user-select: none; }
.toggle > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.toggle .track { position: relative; flex: none; display: inline-block; width: 36px; height: 21px; padding: 2px; border-radius: 11px; background: var(--stroke-strong); transition: background-color var(--motion) var(--ease); }
.toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--fg); transition: transform var(--motion) var(--ease), background-color var(--motion) var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(15px); background: var(--on-accent); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle input:disabled + .track { opacity: .45; }

/* ---- shell ---- */
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 200; padding: 8px 12px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { top: 10px; color: var(--on-accent); }
.bz-logo { flex: none; display: block; }
.bz-logo .ring { stroke: var(--fg); }
.bz-logo .round { fill: var(--accent); }
.app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 12px; border-right: 1px solid var(--hairline); background: var(--bg); line-height: normal; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.app-sidebar::-webkit-scrollbar { display: none; }
.app-sidebar .sb-ico { display: none; }
.app-sidebar .sb-ico svg { width: 16px; height: 16px; }
.sb-brand { position: relative; display: flex; align-items: center; gap: 10px; min-height: 26px; padding: 2px 8px; }
.sb-brand .brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-weight: 600; font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.sb-brand .brand:hover { color: var(--fg); }
.sb-domain { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sb-collapse { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); opacity: 0; background: var(--bg); }
.sb-brand:hover .sb-collapse, .sb-collapse:focus-visible { opacity: 1; }
.sb-close { display: none; margin-left: auto; }
.netsw { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border: 1px solid var(--kbd-bg); border-radius: 9px; background: var(--control); }
.netsw a { display: flex; align-items: center; justify-content: center; gap: 7px; height: 32px; min-width: 0; border-radius: 7px; color: var(--dim); font-size: 13px; font-weight: 600; white-space: nowrap; }
.netsw a > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.netsw a:last-child:nth-child(odd) { grid-column: 1 / -1; }
.netsw a:hover { color: var(--fg); }
.netsw a.net-on { background: var(--seg-on); color: var(--fg); }
.netsw a.net-test:not(.net-on) { color: var(--warning-ink); }
.net-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: oklch(0.72 0.17 300); }
.net-dot.hood { background: oklch(0.80 0.16 155); }
.net-dot.elysium { background: oklch(0.78 0.13 215); }
.net-dot.elysium-testnet { background: var(--warning); }
.sb-ctas { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.sb-ctas .btn { height: 38px; border-radius: 9px; font-size: 13px; }
.sb-create { padding: 0 16px; font-weight: 600; }
.btn-primary.sb-create:hover:not(:disabled) { background: var(--fg); border-color: var(--fg); }
.sb-newtask { padding: 0 12px; font-weight: 500; }
.sb-search { display: flex; justify-content: flex-start; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--control); color: var(--muted); font-size: 13px; font-weight: 400; }
.sb-search:hover:not(:disabled) { background: var(--control-active); color: var(--muted); }
.sb-search .sb-label { flex: 1; text-align: left; }
.sb-search kbd { padding: 0; min-width: 0; background: transparent; color: var(--dim); font-size: 11px; }
.sb-nav { display: flex; flex-direction: column; gap: 14px; }
.sb-group { display: flex; flex-direction: column; gap: 1px; }
.sb-group-title { margin: 0; padding: 0 10px 4px; color: var(--muted); font-size: 11px; }
.sb-group-featured { margin: 0 -4px; padding: 7px 4px 4px; border-radius: 9px; background: color-mix(in oklch, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 22%, transparent); }
.sb-group-featured .sb-group-title { color: var(--accent); font-weight: 600; }
.sb-group-featured .sb-link:not(.current) .sb-ico { color: var(--accent); }
.sb-link { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 7px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
.sb-link .sb-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-link:hover { background: var(--control); color: var(--fg); }
.sb-link.current { background: var(--control-active); color: var(--fg); box-shadow: inset 3px 0 0 var(--accent); }
.nav-badge { padding: 1px 6px; border-radius: 10px; background: var(--chip); color: var(--text-secondary); font-size: 11px; font-weight: 500; }
.nav-badge:empty { display: none; }
.nav-badge.danger { background: var(--danger-fill); color: oklch(from var(--danger) calc(l + 0.10) calc(c - 0.05) h); }
/* The recent list is the only scroll box of the sidebar: it takes the space
   that is left, and the sidebar does not scroll while its content fits.
   position: relative makes the box the containing block of the absolute
   .sr-only status labels of its rows; else they escape the box and give the
   whole sidebar a long empty scroll. overscroll-behavior stops a scroll at
   the end of the list from moving the sidebar or the page. */
.sb-recent { position: relative; display: flex; flex-direction: column; gap: 1px; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sb-recent::-webkit-scrollbar { display: none; }
.sb-recent-head { display: flex; justify-content: space-between; padding: 0 10px 4px; color: var(--muted); font-size: 11px; }
.sb-recent-head a { color: var(--muted); }
.sb-recent-head a:hover, .sb-recent-head a.current { color: var(--fg); }
.sb-recent-head a.current { color: var(--accent); font-weight: 600; }
.sb-recent-list { display: flex; flex-direction: column; gap: 1px; }
.sidebar-launch { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px; border-radius: 7px; color: var(--fg); min-width: 0; }
.sidebar-launch:hover { background: var(--control); color: var(--fg); }
.sidebar-launch.current { background: var(--control-active); }
.launch-label { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.launch-label strong, .launch-label small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.2; }
.launch-label strong { font-size: 12px; font-weight: 500; }
.launch-label small { color: var(--muted); font-size: 11px; }
.sidebar-launch .status { gap: 0; }
.sidebar-empty { margin: 6px 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sb-foot { display: flex; align-items: center; gap: 8px; padding: 12px 4px 0; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 11px; white-space: nowrap; }
.sb-foot a { color: var(--muted); }
.sb-foot a:hover, .sb-foot a.current { color: var(--fg); }
.connection-status { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.connection-status::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--warning); }
.page { min-width: 0; min-height: 100dvh; margin-left: var(--sidebar-width); margin-right: var(--rail-space); }
.page:focus { outline: none; }
.page:has(> .page-head) { display: flex; flex-direction: column; gap: 24px; padding: 28px 36px 40px; }
.page-pad { display: flex; flex-direction: column; gap: 24px; width: 100%; max-width: 1480px; margin: 0 auto; padding: 28px 36px 40px; min-width: 0; }
.mobile-header, .mobile-bottom-nav, .workspace-header .mobile-folder-toggle, .live-bar { display: none; }
.sidebar-shade, .folder-shade { display: none; }
.app-footer { display: none; }
body.has-rail { --rail-space: var(--rail-width); }
body.has-rail.rail-collapsed { --rail-space: var(--rail-collapsed); }
.live-rail { position: fixed; top: 0; bottom: 0; right: 0; z-index: 30; width: var(--rail-width); display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--hairline); background: var(--panel); overflow-x: hidden; overflow-y: auto; }
body.rail-collapsed .live-rail { width: var(--rail-collapsed); }
body:not(.has-rail) .live-rail { display: none; }
/* Icon sidebar: 1000–1200 px, or collapsed by the user. It shows its labels
   while the pointer is over it or the focus is in it: app.js sets sb-peek
   then. A class, not :hover: the collapse button must close the sidebar at
   once, while the pointer is still over it. */
body.sb-icons { --sidebar-width: var(--sidebar-icons); }
body.sb-icons:not(.sb-peek) .app-sidebar { padding: 16px 10px 12px; }
body.sb-icons:not(.sb-peek) .app-sidebar :is(.brand-name, .sb-domain, .sb-collapse, .sb-label, .sb-search kbd, .sb-group-title, .nav-badge, .sb-recent, .sb-foot > :not(.connection-status)) { display: none; }
body.sb-icons:not(.sb-peek) .app-sidebar .sb-ico { display: inline-flex; }
body.sb-icons:not(.sb-peek) .app-sidebar :is(.sb-brand, .sb-link, .sb-search, .sb-ctas .btn) { justify-content: center; padding: 0; }
body.sb-icons:not(.sb-peek) .app-sidebar :is(.netsw, .sb-ctas) { grid-template-columns: 1fr; gap: 4px; }
body.sb-icons:not(.sb-peek) .app-sidebar .netsw a { height: 26px; }
body.sb-icons:not(.sb-peek) .app-sidebar .netsw a span { display: none; }
body.sb-icons:not(.sb-peek) .app-sidebar .sb-foot { justify-content: center; padding-left: 0; padding-right: 0; }
body.sb-icons:not(.sb-peek) .app-sidebar .connection-status { flex: none; font-size: 0; gap: 0; }
/* The icon sidebar shows only the dot of a lost event stream in its footer.
   While the stream is open the footer is empty, so its line goes too. */
body.sb-icons:not(.sb-peek) .app-sidebar .sb-foot:not(:has(.connection-status:not([hidden]))) { display: none; }
body.sb-icons:not(.sb-peek) .app-sidebar .sb-nav { gap: 8px; }
body.sb-icons.sb-peek .app-sidebar { width: var(--sidebar-width-full, 244px); box-shadow: 30px 0 80px rgba(0,0,0,.5); }
body.sb-icons.sb-peek .app-sidebar .sb-ico { display: none; }

/* ---- page blocks ---- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.page-head-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.page-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.page-sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.net-badge { display: inline-block; padding: 2px 7px; border-radius: 5px; background: var(--control-active); color: var(--text-secondary); font-size: 11px; font-weight: 400; letter-spacing: 0; vertical-align: middle; }
.net-badge.test { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning-ink); }

/* Priority fee control of an EVM action (EVMTipControl): the input in gwei and
   one chip for each preset. app.js sends its value as tip_gwei. */
.evm-tip { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.evm-tip .lbl { display: flex; align-items: center; gap: 6px; margin: 0; }
.evm-tip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.evm-tip-row .field { width: 96px; flex: none; }
.evm-tip-row input { text-align: right; }
.evm-tip-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.evm-tip-chip { height: 26px; padding: 0 9px; font-variant-numeric: tabular-nums; }
.evm-tip-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--fg); color: var(--on-accent); }
a.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
a.back:hover { color: var(--fg); }
.card { min-width: 0; max-width: 100%; margin: 0; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.card:not(:has(> .card-head, > .card-body)) { padding: 16px; }
.card.panel-lg { border-radius: 14px; }
.card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 48px; padding: 12px 14px; border-bottom: 1px solid var(--hairline); }
.card-title { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; }
.card-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.card-body { padding: 14px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 100dvh; min-width: 0; }
.split > .main { min-width: 0; }
.split > .side { min-width: 0; width: 340px; border-left: 1px solid var(--hairline); background: var(--panel); }
.kpis { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); overflow: hidden; }
.kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 14px 16px; border-right: 1px solid var(--hairline); }
.kpi:last-child { border-right: 0; }
.kpi-label { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-box { align-self: flex-start; display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 12px; padding: 10px 14px; border: 1px solid var(--hairline); border-radius: 12px; }
.hero-box.pos { background: color-mix(in srgb, var(--ok) 7%, transparent); border-color: color-mix(in srgb, var(--ok) 28%, transparent); --hero-rim: var(--ok); }
.hero-box.neg { background: color-mix(in srgb, var(--danger) 7%, transparent); border-color: color-mix(in srgb, var(--danger) 28%, transparent); --hero-rim: var(--danger); }
.hero-box.brand { background: var(--accent-tint); border-color: color-mix(in srgb, var(--accent) 28%, transparent); --hero-rim: var(--accent); }
.hero-num { color: var(--fg); font-size: clamp(30px, 2.6vw, 52px); font-weight: 600; letter-spacing: -.03em; line-height: 1; white-space: nowrap; -webkit-text-stroke: 1px var(--hero-rim, transparent); paint-order: stroke fill; }
.form-page { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 100dvh; min-width: 0; }
.form-page > .form-main { display: flex; flex-direction: column; gap: 34px; min-width: 0; padding: 28px 36px 60px; }
.form-sec { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 18px; min-width: 0; }
.sec-num { padding-top: 4px; color: var(--accent); font: 500 12px var(--font-mono); }
.sec-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sec-title { margin: 0; font-size: 15px; font-weight: 600; }
.sec-sub { margin: -11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-wrap: pretty; }
.adv-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 38px; padding: 6px 12px; border: 1px solid var(--input-border); border-radius: 9px; background: var(--panel); font-size: 12px; }
.adv-summary > .muted, .adv-summary .adv-label { color: var(--muted); }
.adv-change { margin-left: auto; height: auto; padding: 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.adv-change:hover:not(:disabled) { background: transparent; color: var(--fg); }
.adv-fields { display: flex; flex-direction: column; gap: 10px; }
ol.steps { display: flex; align-items: center; gap: 14px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; white-space: nowrap; }
ol.steps > .step + .step::before { content: "›"; margin-right: 14px; color: var(--muted); font-weight: 400; }
ol.steps > .step.current { color: var(--fg); font-weight: 600; }
ol.steps > .step.done { color: var(--text-secondary); }
.summary-col { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; height: 100dvh; min-height: 0; border-left: 1px solid var(--hairline); background: var(--panel); }
.summary-col > .summary-scroll, .summary-col > .sum-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 18px; padding: 24px 20px; }
.sum-label { color: var(--muted); font-size: 11px; }
.sum-total { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.sum-total-sub { color: var(--muted); font-size: 12px; }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.kv > .k { color: var(--text-secondary); }
.kv > .v { white-space: nowrap; text-align: right; }
.plan { display: flex; flex-direction: column; }
.plan-step { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 0 0 12px 24px; }
.plan-step::before { content: ""; position: absolute; left: 1px; top: 3px; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--check-border); }
.plan-step::after { content: ""; position: absolute; left: 6px; top: 15px; bottom: 0; width: 1px; background: var(--stroke-strong); }
.plan-step:last-child::after { display: none; }
.plan-step.done::before { background: var(--fg); box-shadow: none; }
.plan-step.current::before { box-shadow: inset 0 0 0 1.5px var(--accent); }
.plan-title { font-size: 12px; font-weight: 500; }
.plan-sub { color: var(--muted); font-size: 11px; }
.sum-note { color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.sum-cta { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--hairline); margin-top: auto; }

/* ---- data display ---- */
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status > .dot, .dot { flex: none; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.st-landed > .dot, .st-confirmed > .dot, .st-completed > .dot, .st-funded > .dot, .st-running > .dot, .st-connected > .dot { background: var(--ok); }
.st-ready > .dot, .st-holding > .dot { background: var(--fg); }
.st-pending > .dot, .st-selling > .dot, .st-buying > .dot, .st-submitted > .dot, .st-prepared > .dot { background: var(--warning); }
.st-failed > .dot, .st-panicked > .dot { background: var(--danger); }
.st-draft > .dot, .st-unfunded > .dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.st-aborted > .dot, .st-archived > .dot, .st-stopped > .dot { background: var(--muted); }
.gl-ok, .gl-fail, .gl-pend { white-space: nowrap; }
.gl-ok { color: var(--ok); }
.gl-fail { color: var(--danger); }
.gl-pend { color: var(--warning); }
.gl-ok::before { content: "✓ "; }
.gl-fail::before { content: "✕ "; }
.gl-pend::before { content: "◌ "; }
.badge, .tag { display: inline-block; padding: 2px 7px; border-radius: 5px; background: var(--chip); color: var(--text-secondary); font-size: 11px; font-weight: 500; line-height: 1.45; white-space: nowrap; }
.tag-churn, .tag.churn, .badge.churn, .tag-dev, .tag.dev, .badge.dev { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning-text); }
.tag-backmev, .tag.backmev { background: color-mix(in srgb, var(--accent-2) 15%, transparent); color: var(--accent-2); }
.tag-whale, .tag-core, .tag-cex, .tag-holder, .tag.whale, .badge.whale { background: var(--chip); color: var(--text-secondary); }
.tag.running, .badge.running { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.tag.stopped, .badge.stopped { background: var(--control-active); color: var(--text-secondary); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--hairline-inner); text-align: left; vertical-align: middle; }
th { padding-top: 8px; padding-bottom: 8px; border-bottom-color: var(--hairline); color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; text-transform: none; letter-spacing: 0; }
tbody tr:hover { background: var(--raised); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-size: 12px; }
tr.sel, tr.sel:hover { background: var(--row-sel); }
tr.archived td { opacity: .45; }
table.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); }
.card table.tbl thead th, .tbl-scroll table.tbl thead th { background: inherit; }
table.tbl td { height: 44px; padding-top: 6px; padding-bottom: 6px; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--fg); }
th[aria-sort=ascending]::after { content: " ↑"; color: var(--fg); }
th[aria-sort=descending]::after { content: " ↓"; color: var(--fg); }
.cell-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-main .meta, .meta { color: var(--muted); font: 400 11px var(--font-mono); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.tbl-scroll, .table-scroll { overflow-x: auto; min-width: 0; max-width: 100%; }
.tbl-scroll > table { min-width: 720px; }
.table-scroll table { min-width: 600px; }
.table-scroll td .pill { white-space: nowrap; }
.skel { height: 44px; }
.skel td::after, .skel > i { content: ""; display: block; height: 10px; width: 60%; border-radius: 5px; background: var(--chip); animation: bz-pulse 1.4s ease-in-out infinite; }
@keyframes bz-pulse { 50% { opacity: .45; } }
.tile { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--text-secondary); font-size: 10px; font-weight: 600; letter-spacing: 0; overflow: hidden; position: relative; }
.tile[style*="--h"] { background: oklch(0.36 0.07 var(--h)); color: var(--fg); font-weight: 700; }
.tile-sm { width: 20px; height: 20px; border-radius: 6px; font-size: 10px; }
.tile-lg { width: 44px; height: 44px; border-radius: 12px; font-size: 13px; font-weight: 700; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: inherit; }
.addr { font-size: 12px; white-space: nowrap; }
button.copy { width: auto; height: auto; padding: 0 2px; border: 0; background: transparent; color: var(--muted); font-size: 11px; line-height: 1; }
button.copy:hover:not(:disabled) { background: transparent; color: var(--fg); }
a.ext { color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
a.ext:hover { color: var(--fg); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.na { color: var(--muted); }
.est { color: var(--muted); font-size: 11px; font-weight: 400; }
.age { color: var(--muted); font-size: 11px; white-space: nowrap; }
.pnl-pos { color: var(--ok); }
.pnl-neg { color: var(--danger); }
.pnl-neutral { color: var(--muted); }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; background: var(--control); color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.banner-text { flex: 1; min-width: 0; }
.banner-action { flex: none; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: var(--chip); color: var(--fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.banner-action:hover:not(:disabled) { background: var(--seg-on); }
.banner.warn { background: color-mix(in srgb, var(--warning) 8%, transparent); border-color: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--warning-ink); }
.banner.warn::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--warning); }
.banner.danger { background: color-mix(in srgb, var(--danger) 8%, transparent); border-color: color-mix(in srgb, var(--danger) 20%, transparent); color: color-mix(in srgb, var(--danger) 18%, #c8c8cc); }
.banner.danger b, .banner.danger strong { color: var(--danger-text); }
.banner.note { background: var(--control); color: var(--text-secondary); }
.segs { display: flex; gap: 3px; min-width: 60px; }
.segs > i { flex: 1; height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--input-border) 50%, var(--control-active)); }
.segs > i.ok { background: var(--ok); }
.segs > i.ink { background: var(--fg); }
.segs > i.fail { background: var(--danger); }
.bar { height: 4px; border-radius: 2px; background: var(--chip); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--fg); transition: width 500ms var(--ease); }
.bar.ok .bar-fill { background: var(--ok); }
.bar.danger .bar-fill { background: var(--danger); }
.bar.accent .bar-fill { background: var(--accent); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.empty > p { margin: 0; max-width: 460px; line-height: 1.6; }
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); animation: bz-fade var(--motion) var(--ease); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 65; width: min(440px, 100vw); display: flex; flex-direction: column; border-left: 1px solid var(--input-border); background: var(--raised); box-shadow: -30px 0 80px rgba(0, 0, 0, .5); animation: bz-slide var(--motion) var(--ease); }
.drawer:focus { outline: none; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--kbd-bg); }
.drawer-head :is(h2, h3, .drawer-title) { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 600; }
.drawer-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--kbd-bg); }
@keyframes bz-slide { from { transform: translateX(24px); opacity: 0; } }
@keyframes bz-fade { from { opacity: 0; } }
@keyframes bz-rise { from { transform: translateY(8px); opacity: 0; } }

/* ---- info tip (templ InfoTip) ---- */
.info-tip { display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; color: var(--muted); font-size: 11px; line-height: 1; vertical-align: baseline; cursor: help; border-radius: 4px; }
.info-tip:hover, .info-tip:focus { color: var(--fg); }
.info-tip:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
.info-tip-bubble { position: fixed; z-index: 10000; max-width: min(280px, calc(100vw - 16px)); padding: 6px 8px; border: 1px solid var(--stroke-strong); border-radius: 8px; background: var(--raised); color: var(--fg); font: 400 12px/1.4 var(--font-sans); white-space: normal; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); pointer-events: none; }

/* ---- dialogs ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
.modal-backdrop.open { display: flex; animation: bz-fade var(--motion) var(--ease); }
.modal-card { position: relative; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; padding: 20px; border: 1px solid var(--input-border); border-radius: 16px; background: var(--raised); box-shadow: 0 40px 100px rgba(0, 0, 0, .7); }
.modal-card.w720 { max-width: 720px; }
.modal-card.w1040 { max-width: 1040px; }
.modal-card > h3 { margin: -20px -20px 20px; padding: 16px 52px 16px 20px; border-bottom: 1px solid var(--kbd-bg); font-size: 15px; font-weight: 600; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.modal-close:hover:not(:disabled) { background: var(--control-active); color: var(--fg); }
.modal-card form > button { margin-top: 16px; }

/* ---- toasts ---- */
#toasts { position: fixed; left: 50%; bottom: calc(28px + var(--bottom-nav)); z-index: 9999; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
/* The stack is a manual popover (app.js) so it shows over modal dialogs;
   undo the browser's popover box. */
#toasts[popover] { inset: auto auto calc(28px + var(--bottom-nav)) 50%; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
#toasts[popover]:not(:popover-open) { display: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: min(640px, calc(100vw - 24px)); padding: 10px 14px 10px 12px; border: 1px solid var(--stroke-strong); border-radius: 12px; background: var(--toast-bg); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); color: var(--fg); font-size: 13px; cursor: default; animation: bz-rise var(--motion) var(--ease); }
.toast::before { content: ""; flex: none; align-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.toast.success::before { background: var(--ok); }
.toast.warn::before { background: var(--warning); }
.toast.err::before { background: var(--danger); }
.toast .t-title { flex: none; font-weight: 500; white-space: nowrap; }
.toast .t-body { min-width: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--motion) var(--ease), transform var(--motion) var(--ease); }

/* ---- legacy classes (restyled; new markup uses the classes above) ---- */
.workspace-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 0; padding: 28px 36px 20px; border-bottom: 1px solid var(--hairline); }
.workspace-header h1, .workspace-header h2, .workspace-header h3 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.workspace-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.workspace-body { min-width: 0; padding: 20px 36px 40px; }
.workspace-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; margin-bottom: 12px; }
.workspace-toolbar input:not([type=checkbox]):not([type=radio]), .workspace-toolbar select { width: auto; max-width: 100%; min-height: 32px; height: 32px; padding: 0 10px; border-color: transparent; border-radius: 8px; background-color: var(--control); font-size: 12px; }
.workspace-toolbar select { padding-right: 28px; }
.workspace-toolbar input:focus, .workspace-toolbar select:focus { border-color: var(--accent); }
.workspace-toolbar button, .workspace-toolbar .pill { width: auto; margin: 0; }
.workspace-toolbar .spacer, .workspace-header .spacer { flex: 1; }
.card-page, .panel { min-width: 0; max-width: 100%; margin: 0 0 16px; padding: 18px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.card > h3, .card-page h3, .panel h3 { font-size: 15px; font-weight: 600; }
.card-page label { margin-top: 12px; }
.page > h2, .page > .subhead { margin: 28px 36px 8px; }
.page > h2 { font-size: 22px; letter-spacing: -.02em; }
.page > .card, .page > .card-page, .page > .panel, .page > .flash, .page > .error, .page > .stats-strip { margin: 16px 36px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; min-width: 0; }
.row > * { flex: 1 1 180px; min-width: 0; }
.row > button, .row > .pill, .row > a, .row > .btn { flex: 0 0 auto; }
.row button { width: auto; margin-top: 0; }
form.inline { display: inline; }
form.inline > button { width: auto; margin: 0; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; margin: 0; padding: 6px 12px; border: 1px solid var(--btn-sec-border); border-radius: var(--btn-radius); background: var(--btn-sec-bg); color: var(--fg); font-size: 12px; font-weight: 500; line-height: 1.4; text-decoration: none; white-space: nowrap; vertical-align: middle; cursor: pointer; }
.pill:not(.tag):hover:not(:disabled) { background: var(--control-active); border-color: var(--control-active); color: var(--fg); }
.pill:disabled, .pill[aria-disabled=true] { background: var(--chip); border-color: var(--chip); color: var(--muted); cursor: not-allowed; }
.pill:not(.tag):is(.primary, .gradient) { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.pill:not(.tag):is(.primary, .gradient):hover:not(:disabled) { background: color-mix(in oklab, var(--accent) 88%, #fff); border-color: color-mix(in oklab, var(--accent) 88%, #fff); color: var(--on-accent); }
.pill:not(.tag).primary:active:not(:disabled) { background: var(--accent-pressed); border-color: var(--accent-pressed); }
.pill:not(.tag):is(.outline, .ghost) { background: transparent; border-color: var(--hairline); color: var(--fg); }
.pill:not(.tag):is(.outline, .ghost):hover:not(:disabled) { background: var(--control); border-color: var(--hairline); }
.pill:not(.tag).active, .pill:not(.tag).active:hover:not(:disabled) { background: var(--seg-on); border-color: var(--seg-on); color: var(--fg); }
.pill:not(.tag).buy { background: var(--btn-tint-buy); border-color: var(--ok); color: var(--ok); font-weight: 700; }
.pill:not(.tag):is(.sell, .danger) { background: var(--btn-tint-sell); border-color: var(--danger); color: var(--danger-text); font-weight: 700; }
.pill:not(.tag).buy:hover:not(:disabled) { background: color-mix(in srgb, var(--ok) 26%, transparent); border-color: var(--ok); color: var(--ok); }
.pill:not(.tag):is(.sell, .danger):hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 28%, transparent); border-color: var(--danger); color: var(--danger-text); }
.pill:not(.tag):is(:disabled, [aria-disabled=true]) { background: var(--chip); border-color: var(--chip); color: var(--muted); font-weight: 500; }
/* Read-only status pills (PillTag): kinds from the page helpers. */
.pill.tag { padding: 2px 7px; border: 0; border-radius: 5px; background: var(--chip); color: var(--text-secondary); font-size: 11px; font-weight: 500; cursor: default; }
.pill.tag:is(.running, .profit, .ok, .live, .buy) { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.pill.tag:is(.loss, .sell, .bad, .danger) { background: var(--danger-fill); color: var(--danger-text); }
.pill.tag:is(.warn, .dev) { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning-text); }
.pill.tag:is(.primary, .active) { background: var(--seg-on); color: var(--fg); }
.pill.tag:is(.stopped, .idle) { background: var(--control-active); color: var(--text-secondary); }
.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin-bottom: 16px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--hairline); overflow: hidden; }
.card.stat { display: flex; align-items: center; margin: 0; padding: 12px 14px; border: 0; border-radius: 0; background: var(--panel); }
.stat-label { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.stat-value { font-size: 18px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 2px; color: var(--muted); font-size: 11px; }
.metric-grid { display: flex; flex-wrap: wrap; gap: 0 56px; padding: 4px 36px 20px; border-bottom: 1px solid var(--hairline); }
.metric { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 0; border: 0; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tabs a.current { color: var(--fg); }
.cell-input { vertical-align: middle; }
input.cell-input.sol { width: 95px; min-height: 30px; padding: 4px 8px; }
input.cell-input.pct { width: 62px; min-height: 30px; padding: 4px 8px; }
.addr-copy { color: var(--muted); font: 400 11px var(--font-mono); cursor: pointer; overflow-wrap: anywhere; }
.addr-copy:hover { color: var(--fg); }
.curve-track { height: 4px; margin: 8px 0 10px; border-radius: 2px; background: var(--chip); overflow: hidden; }
.curve-fill { height: 100%; background: var(--fg); }
.curve-label { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.curve-label .num { color: var(--fg); font-weight: 500; }
.wallet-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: calc(100dvh - 90px); }
.folder-sidebar { min-width: 0; padding: 16px; border-right: 1px solid var(--hairline); background: var(--bg); }
.folder-link { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; border-radius: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.folder-link.current, .folder-link:hover { background: var(--control-active); color: var(--fg); }
.folder-link svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.folder-link.current svg { color: var(--accent); }
.folder-link small { margin-left: auto; color: var(--muted); }
.wallet-content { position: relative; min-width: 0; padding: 20px 24px; }
.wallet-content .stats-strip { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.wallet-content .card.stat { padding: 10px 12px; }
.wallet-content .stat-value { font-size: 16px; }
.wallet-content td { padding: 8px 8px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 10px; }
.group-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.gc-top, .gc-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gc-actions { display: inline-flex; align-items: center; gap: 8px; }
.folder-icon { color: var(--muted); }
.group-name { font-size: 14px; font-weight: 600; }
.group-sol { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.group-meta { color: var(--muted); font-size: 11px; }
.btn-add { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border-radius: var(--btn-radius); background: var(--control); color: var(--fg); font-size: 18px; cursor: pointer; }
.collapsible { min-width: 0; margin-bottom: 12px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.collapsible > summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; list-style: none; font-size: 13px; font-weight: 500; cursor: pointer; }
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary:hover { color: var(--fg); }
.collapsible > summary .chev { display: inline-flex; width: 12px; height: 12px; align-items: center; justify-content: center; color: var(--muted); transition: transform var(--motion) var(--ease); }
.collapsible[open] > summary .chev { transform: rotate(90deg); }
.collapsible > summary .header-spacer { flex: 1; }
.collapsible > summary .head-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.collapsible > .body { padding: 0 14px 14px; overflow-x: auto; }
.action-menu { position: relative; display: inline-block; }
.action-menu > summary { list-style: none; cursor: pointer; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu .menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 200px; padding: 4px; border: 1px solid var(--input-border); border-radius: 10px; background: var(--raised); box-shadow: 0 20px 50px rgba(0, 0, 0, .55); }
.action-menu .menu button, .action-menu .menu a { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; height: auto; margin: 0; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 500; text-align: left; }
.action-menu .menu button:hover:not(:disabled), .action-menu .menu a:hover { background: var(--control-active); color: var(--fg); }
.action-menu .menu .danger, .action-menu .menu button.danger { color: var(--danger-text); }
.action-menu .ico { display: inline-flex; width: 16px; color: var(--muted); }
.flash, .error { margin-bottom: 16px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--ok) 8%, transparent); color: var(--ok); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.flash.err, .error { border-color: color-mix(in srgb, var(--danger) 25%, transparent); background: color-mix(in srgb, var(--danger) 8%, transparent); color: var(--danger-text); }
.flash.warn { border-color: color-mix(in srgb, var(--warning) 25%, transparent); background: color-mix(in srgb, var(--warning) 8%, transparent); color: var(--warning-ink); }
.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-state p { margin: 0 0 12px; }
.composer { max-width: 800px; min-width: 0; margin: 0 auto; border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline); }
.composer-heading { padding: 28px 32px; border-bottom: 1px solid var(--hairline); }
.composer-heading h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.composer-heading p { max-width: 600px; margin: 0; color: var(--muted); font-size: 13px; }
.composer-section { padding: 24px 32px; border-bottom: 1px solid var(--hairline); }
.composer .card, .composer .card-page { margin: 0; padding: 24px 32px; border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; background: transparent; }
.composer-steps { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; min-height: 56px; padding: 12px 15px; border-bottom: 1px solid var(--hairline); color: var(--muted); font-size: 12px; }
.composer-steps a { color: var(--muted); }
.composer-steps a:hover { color: var(--fg); }
.composer-steps .current { padding: 4px 9px; border-radius: 6px; background: var(--seg-on); color: var(--fg); font-weight: 600; }
.composer-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; padding: 20px 32px; border-top: 1px solid var(--hairline); }
.composer-section + .composer-actions { border-top: 0; }
.composer-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; }
.composer-main { min-width: 0; }
.composer-aside { padding: 24px 20px; border-left: 1px solid var(--hairline); background: var(--panel); }
.terminal { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-width: 0; }
.terminal-header { grid-column: 1 / -1; min-width: 0; border-bottom: 1px solid var(--hairline); }
.terminal-main { min-width: 0; }
.terminal-controls { min-width: 0; padding: 16px; border-left: 1px solid var(--hairline); background: var(--panel); }
.terminal-controls .row { align-items: stretch; }
.terminal-controls .row > * { flex-basis: 100%; }
.terminal-controls .pill { padding: 7px 10px; }
.terminal-controls .card, .terminal-controls .card-page { padding: 0; border: 0; background: transparent; }
.terminal-controls h3 { margin-bottom: 14px; font-size: 13px; }
.terminal-controls form { margin-bottom: 12px; }
.terminal .table-scroll { border-top: 1px solid var(--hairline); }
.sparkline { display: block; width: 100%; height: 80px; margin-top: 8px; }
.sparkline polyline { fill: none; stroke: var(--fg); stroke-width: 1.4; }
.center { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.center > .card { width: 100%; max-width: 380px; }
.footer { margin-top: 16px; color: var(--muted); font-size: 11px; text-align: center; }
.report-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.report-heading h3 { margin: 0; }
.token-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--chip); color: var(--text-secondary); font-size: 10px; font-weight: 600; overflow: hidden; }
.group-drawer-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 60px; padding: 16px 20px; border-bottom: 1px solid var(--kbd-bg); }
.group-drawer-header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.group-drawer-content { min-width: 0; padding: 20px; }
.group-drawer-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-top: 16px; }
.group-drawer-section { min-width: 0; padding: 16px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--card); }
.group-drawer-section h3 { margin-bottom: 14px; font-size: 13px; }
.group-drawer-section form { margin-bottom: 12px; }
.group-drawer-section form:last-child { margin-bottom: 0; }

/* ---- responsive tiers ----
   ≥1440 full · 1200–1440 rail collapses (JS, <1360) · 1000–1200 icon
   sidebar, tables scroll · <1000 single column, mobile header, off-canvas
   sidebar, live bar · ≤720 bottom nav. */
@media (max-width: 1439.98px) {
  .terminal { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (min-width: 1000px) and (max-width: 1199.98px) {
  .wallet-workspace { grid-template-columns: 210px minmax(0, 1fr); }
  .form-page { grid-template-columns: minmax(0, 1fr) 300px; }
  .split { grid-template-columns: minmax(0, 1fr) 320px; }
  .split > .side { width: 320px; }
  .page:has(> .page-head), .page-pad { padding: 24px 28px 36px; }
  .workspace-header { padding: 24px 28px 18px; }
  .workspace-body { padding: 18px 28px 36px; }
  .metric-grid { padding: 4px 28px 18px; gap: 0 36px; }
  .page > .card, .page > .card-page, .page > .panel, .page > .flash, .page > .error, .page > .stats-strip { margin: 16px 28px; }
  table { min-width: 0; }
  .card > table, .wallet-content table, .workspace-body > table { display: block; overflow-x: auto; }
}
@media (max-width: 999.98px) {
  :root { --sidebar-width: 0px; }
  body.has-rail, body.has-rail.rail-collapsed { --rail-space: 0px; }
  body.sb-icons { --sidebar-width: 0px; }
  .live-rail { display: none !important; }
  .app-sidebar { width: 300px; padding: 16px 12px; background: var(--panel); transform: translateX(-100%); visibility: hidden; transition: transform var(--motion) var(--ease), visibility 0s linear var(--motion); }
  body.sidebar-open .app-sidebar { transform: none; visibility: visible; transition: transform var(--motion) var(--ease); box-shadow: 30px 0 80px rgba(0, 0, 0, .5); }
  body.sidebar-open .sidebar-shade { display: block; position: fixed; inset: 0; z-index: 35; padding: 0; border: 0; border-radius: 0; background: rgba(0, 0, 0, .55); }
  .sb-domain, .sb-collapse { display: none; }
  .sb-close { display: inline-flex; }
  .sb-link { height: 40px; border-radius: 8px; }
  .mobile-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--hairline); background: var(--bg); }
  .mh-menu { width: 28px; height: 28px; border-radius: 8px; background: var(--control); color: var(--fg); }
  .mh-logo { display: inline-flex; }
  .mh-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .mh-net { width: auto; min-height: 0; height: 24px; padding: 0 22px 0 8px; border: 0; border-radius: 6px; background-color: var(--control); background-position: right 7px center; color: var(--text-secondary); font-size: 11px; }
  .page { min-height: calc(100dvh - 48px); }
  body:has(#live-bar:not(:empty)) .page { padding-bottom: 48px; }
  .live-bar { position: fixed; left: 0; right: 0; bottom: var(--bottom-nav); z-index: 44; display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--hairline); background: var(--panel); font-size: 12px; }
  .live-bar:empty { display: none; }
  .page:has(> .page-head), .page-pad { padding: 20px 20px 32px; gap: 20px; }
  .workspace-header { padding: 20px 20px 16px; }
  .workspace-body { padding: 16px 20px 32px; }
  .metric-grid { padding: 4px 20px 16px; gap: 12px 32px; }
  .page > h2, .page > .subhead { margin: 20px 20px 8px; }
  .page > .card, .page > .card-page, .page > .panel, .page > .flash, .page > .error, .page > .stats-strip { margin: 12px 20px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .split, .form-page { display: flex; flex-direction: column; min-height: 0; }
  .split > .side { width: auto; border-left: 0; border-top: 1px solid var(--hairline); }
  .form-page > .form-main { padding: 20px 20px 32px; gap: 28px; }
  .summary-col { position: static; height: auto; border-left: 0; border-top: 1px solid var(--hairline); }
  .kpis { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-bottom: 1px solid var(--hairline); }
  .wallet-workspace { min-height: 0; grid-template-columns: 200px minmax(0, 1fr); }
  .composer-grid { grid-template-columns: 1fr; }
  .composer-aside { border-left: 0; border-top: 1px solid var(--hairline); }
  .terminal { grid-template-columns: minmax(0, 1fr) 280px; }
  table { min-width: 0; }
  .card > table, .wallet-content table, .workspace-body > table { display: block; overflow-x: auto; }
}
@media (max-width: 720px) {
  :root { --bottom-nav: calc(64px + env(safe-area-inset-bottom, 0px)); --footer-height: var(--bottom-nav); }
  .page { min-height: calc(100dvh - 48px); padding-bottom: var(--bottom-nav); }
  body:has(#live-bar:not(:empty)) .page { padding-bottom: calc(var(--bottom-nav) + 48px); }
  .mobile-bottom-nav { position: fixed; inset: auto 0 0; z-index: 45; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: var(--bottom-nav); padding: 8px 0 env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--hairline); background: var(--bg); }
  .app-sidebar { bottom: var(--bottom-nav); }
  body.sidebar-open .sidebar-shade { bottom: var(--bottom-nav); }
  .mobile-bottom-nav a, .mobile-bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: auto; margin: 0; padding: 4px 2px; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 500; }
  .mobile-bottom-nav a:hover, .mobile-bottom-nav button:hover:not(:disabled) { background: transparent; color: var(--fg); }
  .mobile-bottom-nav svg { width: 20px; height: 20px; }
  .mobile-bottom-nav .current { color: var(--fg); }
  .mobile-bottom-nav .current svg { color: var(--accent); }
  .workspace-header .mobile-folder-toggle { display: inline-flex; }
  .wallets-header h2, .wallets-header > .spacer, .wallets-header .sol-header-view, .wallets-header .evm-header-view { display: none; }
  .wallet-workspace > .folder-sidebar { display: none; position: fixed; inset: 0 auto var(--bottom-nav) 0; z-index: 42; width: min(310px, 90vw); overflow-y: auto; border-right: 1px solid var(--hairline); background: var(--panel); }
  body.folders-open .wallet-workspace > .folder-sidebar { display: block; }
  body.folders-open .folder-shade { display: block; position: fixed; inset: 0; z-index: 41; padding: 0; border: 0; border-radius: 0; background: rgba(0, 0, 0, .55); }
  .page:has(> .page-head), .page-pad { padding: 16px 16px 24px; gap: 16px; }
  .page-title, .workspace-header h1, .workspace-header h2, .workspace-header h3 { font-size: 20px; }
  .workspace-header { padding: 16px; }
  .workspace-body, .wallet-content { padding: 12px 16px; }
  .metric-grid { padding: 4px 16px 14px; gap: 12px 24px; }
  .metric-value { font-size: 20px; }
  .page > h2, .page > .subhead { margin: 16px 16px 8px; }
  .page > .card, .page > .card-page, .page > .panel, .page > .flash, .page > .error, .page > .stats-strip { margin: 12px 16px; }
  .wallet-workspace, .terminal { display: flex; flex-direction: column; }
  .folder-sidebar { padding: 12px; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .terminal-header { order: -2; }
  .terminal-controls { order: -1; padding: 14px; border-left: 0; border-bottom: 1px solid var(--hairline); }
  .terminal-controls .row { flex-direction: row; }
  .terminal-controls .row > * { flex-basis: 140px; }
  .stats-strip, .wallet-content .stats-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-page, .panel { padding: 14px; }
  .composer { border: 0; }
  .composer-heading, .composer-section, .composer .card, .composer .card-page { padding: 20px 16px; }
  .composer-steps { gap: 10px; min-height: 48px; font-size: 11px; }
  .composer-actions { padding: 16px; }
  .row > * { flex-basis: 100%; }
  .row > button, .row > .pill, .row > a, .row > .btn { flex-basis: auto; }
  .form-sec { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal-card { max-height: calc(100dvh - 24px); padding: 18px; border-radius: 20px; }
  .modal-card > h3 { margin: -18px -18px 18px; }
  .action-menu .menu { max-width: calc(100vw - 40px); }
  .drawer { width: 100vw; border-left: 0; }
  .group-drawer-header { min-height: 52px; padding: 14px 16px; }
  .group-drawer-content { padding: 12px; }
  #toasts, #toasts[popover] { bottom: calc(16px + var(--bottom-nav)); }
  .toast { flex-wrap: wrap; row-gap: 2px; }
  .toast .t-title { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
/* custom pairs: TradeExits */
.tk-conversions:empty { display: none; }
.tk-conversions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tk-conversions .banner { gap: 12px; padding: 12px 14px; }
.tk-conv-wrap > table { min-width: 560px; }
.tk-conv-tbl td.meta { max-width: 280px; }
/* custom pairs: the pump.fun launch currency (SOL, USDC and Custom cards,
   the Custom dialog), its creator fee, and the review and estimate lines */
.tl-pair { display: flex; flex-direction: column; min-width: 0; }
.tl-cur { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tl-cur-card { justify-content: flex-start; gap: 10px; min-width: 0; padding: 12px 14px; border: 1px solid var(--stroke-strong); border-radius: 11px; background: transparent; color: var(--text-secondary); text-align: left; }
/* Hover styles only a card that is not selected. After a tap on a phone the
   hover state stays on the tapped card, so the selected card must keep its
   own look. */
.tl-cur-card:hover:not(:disabled):not([aria-checked=true]) { border-color: var(--check-border); background: transparent; }
.tl-cur-card[aria-checked=true] { border-color: var(--accent); background: var(--control); color: var(--fg); }
.tl-cur-card:disabled { border-color: var(--stroke-strong); background: transparent; color: var(--text-secondary); opacity: .45; }
.tl-cur-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tl-cur-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.tl-cur-logo { display: block; width: 28px; height: 28px; border-radius: 50%; }
.tl-cur-logo-sol { padding: 5px; background: #000; }
.tl-cur-icon > .tl-cur-tile { width: 28px; height: 28px; border-radius: 50%; font-size: 10px; }
.tl-cur-plus { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--chip); color: var(--text-secondary); font-size: 16px; line-height: 1; }
.tl-cur-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tl-cur-name, .tl-cur-sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-cur-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.tl-cur-sym { color: var(--muted); font-size: 11px; font-weight: 500; }
.tl-cur-flag { flex: none; margin-left: auto; color: var(--muted); font-size: 11px; }
.tl-cur-warn { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning-ink); font-size: 10px; font-weight: 700; }
.modal-card.tl-cur-modal { display: flex; flex-direction: column; gap: 10px; max-width: 440px; max-height: 80vh; overflow: hidden; }
.tl-cur-modal > h3 { flex: none; margin-bottom: 4px; }
.tl-cur-search > input { width: 100%; }
.tl-cur-scroll { display: flex; flex-direction: column; gap: 6px; min-height: 0; margin: 0 -6px; padding: 0 6px 2px; overflow-y: auto; }
.tl-cur-check, .tl-cur-list { display: flex; flex-direction: column; gap: 6px; }
.tl-cur-check:empty { display: none; }
.tl-cur-row { width: 100%; padding: 9px 12px; }
.tl-cur-group { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.tl-cur-error { margin: 0; color: var(--danger-text); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.tl-pair-warn > .btn { margin-left: 6px; }
.tl-pair-fee { display: flex; flex-direction: column; max-width: 220px; }
.tl-pair-fee > .tl-hint { margin-top: 6px; }
@media (max-width: 640px) { .tl-cur { grid-template-columns: 1fr; } }
.tl-pair-facts { margin: 0 0 10px; }
.tl-route { max-width: 280px; text-align: right; white-space: normal; }
.tl-est-pair { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-est-routes, .tl-est-notes { margin: 0; padding-left: 16px; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }

/* Coin logos (TokenLogo): the official logo file in a disc, or the letters
   of a coin that has no file. */
.tk-logo { display: inline-grid; place-items: center; flex: none; overflow: hidden; border-radius: 50%; background: #000; vertical-align: middle; }
.tk-logo img { display: block; width: 100%; height: 100%; }
.tk-logo img[src*="/tokens/sol.svg"] { width: 62%; height: 62%; }
.tk-logo-16 { width: 16px; height: 16px; }
.tk-logo-20 { width: 20px; height: 20px; }
.tk-logo-24 { width: 24px; height: 24px; }
.tk-logo-32 { width: 32px; height: 32px; }
.tk-logo-text { background: var(--chip); color: var(--text-secondary); font: 700 10px var(--font-mono); letter-spacing: -.02em; }
.tk-logo-text.tk-logo-16, .tk-logo-text.tk-logo-20 { font-size: 7px; }

/* ---- Phones --------------------------------------------------------------
   The page never pans sideways: nothing may make the document wider than the
   screen. clip keeps position: sticky working (hidden would not on body). */
@media (max-width: 999.98px) {
  html { overflow-x: hidden; overscroll-behavior-x: none; }
  body { max-width: 100vw; overscroll-behavior-x: none; }
  @supports (overflow: clip) {
    html, body { overflow-x: clip; }
  }
}
/* No double-tap zoom and no tap delay on controls. */
a, button, label, summary, select, input, [role="button"], [role="tab"], [role="radio"] { touch-action: manipulation; }
/* A short cross-fade between pages, where the browser supports it. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* Mobile steps (mobile-steps.js): one section of a long form at a time. */
.msteps-head, .msteps-foot { display: none; }
@media (max-width: 720px) {
  /* iOS zooms the page into a field whose text is smaller than 16px. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { font-size: 16px !important; }

  .msteps-on .mstep-off, [data-msteps-intro].mstep-off { display: none !important; }
  .msteps-head { position: sticky; top: 48px; z-index: 20; display: flex; align-items: center; gap: 12px; margin: 0 -16px; padding: 4px 16px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .msteps-line { flex: none; display: flex; align-items: baseline; gap: 8px; }
  .msteps-count { color: var(--text-secondary); font: 500 12px var(--font-mono); white-space: nowrap; }
  .msteps-title { display: none; }
  .msteps-dots { flex: 1; display: flex; gap: 4px; }
  .msteps-dot { position: relative; flex: 1; height: 28px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
  .msteps-dot::after { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 4px; border-radius: 2px; background: var(--hairline); transition: background var(--motion) var(--ease); }
  .msteps-dot.done::after { background: color-mix(in srgb, var(--accent) 50%, var(--hairline)); }
  .msteps-dot.on::after { background: var(--accent); }
  .msteps-foot { position: fixed; left: 0; right: 0; bottom: var(--bottom-nav); z-index: 44; display: flex; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--hairline); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .msteps-foot .btn { flex: 1; height: 48px; margin: 0; font-size: 15px; }
  .msteps-foot .msteps-back { flex: 0 0 96px; }
  .msteps-foot .btn[hidden] { display: none; }
  body.msteps-active .page { padding-bottom: calc(var(--bottom-nav) + 84px); }
  /* The live bar of a running task sits between the steps bar and the page. */
  body:has(#live-bar:not(:empty)) .msteps-foot { bottom: calc(var(--bottom-nav) + 48px); }
  body.msteps-active:has(#live-bar:not(:empty)) .page { padding-bottom: calc(var(--bottom-nav) + 132px); }
  .msteps-on .mstep-on { animation: mstep-in 200ms var(--ease); }
  /* The bar at the bottom does the action of the last step. */
  .msteps-on [data-mstep-cta] { display: none !important; }
}
/* The step slides in; it never starts invisible, so a browser that holds
   animations back (a background tab) still shows the step. */
@keyframes mstep-in { from { transform: translateX(10px); } to { transform: none; } }
@media (max-width: 720px) {
  /* A form page in steps: one column, no step number column, and the page's
     own pinned button gives way to the bar of the steps. */
  .msteps-on .form-sec { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .msteps-on .form-sec > .sec-num { display: none; }
  .msteps-on.form-page > .form-main { padding: 16px 16px 8px; gap: 14px; }
  .msteps-on.form-page .summary-col { border-top: 0; }
  .msteps-on.form-page .sum-cta { position: static !important; padding: 12px 20px 16px; background: none; }
}

/* ---- Confirmation dialog (confirm.js) -------------------------------------
   The app's own box in place of the browser's confirm box: a question, an
   optional detail line, Cancel and Confirm. A red Confirm marks an action
   that stops or removes something. On a phone it is a sheet from the bottom. */
.cf { box-sizing: border-box; width: min(400px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); margin: auto; padding: 20px; overflow-y: auto; border: 1px solid var(--input-border); border-radius: 16px; background: var(--raised); color: var(--fg); box-shadow: 0 40px 100px rgba(0, 0, 0, .7); }
.cf::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.cf[open] { animation: cf-in var(--motion) var(--ease); }
.cf-title { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.cf-detail { margin: 6px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.cf-detail[hidden] { display: none; }
.cf-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.cf-actions .btn { height: 36px; margin: 0; padding: 0 14px; font-size: 13px; }
.cf.danger .cf-yes { background: var(--danger); border-color: var(--danger); color: var(--on-accent); }
.cf.danger .cf-yes:hover:not(:disabled) { background: color-mix(in oklab, var(--danger) 88%, #fff); border-color: color-mix(in oklab, var(--danger) 88%, #fff); }
@keyframes cf-in { from { transform: translateY(8px) scale(.98); } }
@keyframes cf-sheet { from { transform: translateY(24px); } }
@media (max-width: 720px) {
  .cf { width: 100%; max-height: 85vh; margin: auto 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom, 0px)); border-width: 1px 0 0; border-radius: 20px 20px 0 0; box-shadow: none; }
  .cf[open] { animation-name: cf-sheet; }
  .cf::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto 14px; border-radius: 2px; background: var(--input-border); }
  .cf-title { font-size: 16px; }
  .cf-detail { font-size: 14px; }
  .cf-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cf-actions .btn { height: 46px; font-size: 15px; }
  .cf kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cf[open] { animation: none; }
}

/* Phone (720 px and narrower): the button row of a dialog stays at the
   bottom of the screen while the dialog scrolls, so Done, Save or Confirm
   is always in reach. The shadow and clip carry the background to the card
   edges (18 px padding) without covering the content above the row. */
@media (max-width: 720px) {
  .modal-backdrop .modal-card :is(.tl-pick-foot, .tl-nb-actions, .trk-modal-actions, .wl-modal-actions, .wp-modal-actions, .wsp-dlg-actions, .aw-dialog-actions, .tv-add-foot, .wd-foot, .hb-actions) {
    position: sticky;
    bottom: -18px;
    z-index: 3;
    margin-bottom: -18px;
    padding-top: 12px;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--kbd-bg);
    background: var(--raised);
    box-shadow: 0 0 0 18px var(--raised);
    clip-path: inset(0 -18px -18px -18px);
  }
}
