/* DFD design system. Tokens first, components after; dark mode redefines tokens only.
   Language: a quiet sidebar, one rounded content panel, soft cards, big numbers with dimmed cents,
   iOS system colors and the system font, sheets for anything that asks a question. */
:root {
  color-scheme: light;
  --window: #ffffff;
  --bg: #f5f5f7;
  --well: #ebebee;
  --surface: #ffffff;
  --raised: #ffffff;
  --inset: #f2f2f5;
  --ink: #1c1c1e;
  --ink-2: #48484d;
  --ink-3: #6e6e73;
  --line: rgba(60, 60, 67, 0.12);
  --line-2: rgba(60, 60, 67, 0.24);
  --phoenix: #0a7cff;
  --variational: #f2701d;
  --phoenix-wash: rgba(10, 124, 255, 0.10);
  --variational-wash: rgba(242, 112, 29, 0.10);
  --n1: #00a37a;
  --n1-wash: rgba(0, 163, 122, 0.10);
  --arcus: #7a5af8;
  --rhlighter: #e0357f;
  --popdex: #c79200;
  --jumper: #7b61ff;
  --ondo: #1a4fd6;
  --hyperliquid: #1f9e8f;
  --lightercore: #3a3a40;
  --good-ink: #1b7f37;
  --bad-ink: #d70015;
  --warn-ink: #a85b00;
  --good: #34c759;
  --bad: #ff3b30;
  --warn: #ff9f0a;
  --focus: #007aff;
  --accent: #5fd068;
  --accent-ink: #0c2e14;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.10);
  --hairline: 0 0 0 1px var(--line);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', Inter, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --window: #000000;
    --bg: #0e0e10;
    --well: #1b1b1e;
    --surface: #242427;
    --raised: #2c2c2f;
    --inset: #1b1b1e;
    --ink: #f5f5f7;
    --ink-2: #c7c7cc;
    --ink-3: #98989d;
    --line: rgba(235, 235, 245, 0.12);
    --line-2: rgba(235, 235, 245, 0.24);
    --phoenix: #409cff;
    --variational: #ff8a3d;
    --phoenix-wash: rgba(64, 156, 255, 0.16);
    --variational-wash: rgba(255, 138, 61, 0.16);
    --n1: #30d3a6;
    --n1-wash: rgba(48, 211, 166, 0.16);
    --arcus: #a08bff;
    --rhlighter: #ff5ca3;
    --popdex: #e6b93a;
    --jumper: #9d8bff;
    --ondo: #6b93ff;
    --hyperliquid: #4fd1c0;
    --lightercore: #6b6b74;
    --good-ink: #4cd964;
    --bad-ink: #ff6961;
    --warn-ink: #ffb340;
    --good: #30d158;
    --bad: #ff453a;
    --warn: #ffb340;
    --focus: #0a84ff;
    --accent: #5fd068;
    --accent-ink: #0c2e14;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --window: #000000;
  --bg: #0e0e10;
  --well: #1b1b1e;
  --surface: #242427;
  --raised: #2c2c2f;
  --inset: #1b1b1e;
  --ink: #f5f5f7;
  --ink-2: #c7c7cc;
  --ink-3: #98989d;
  --line: rgba(235, 235, 245, 0.12);
  --line-2: rgba(235, 235, 245, 0.24);
  --phoenix: #409cff;
  --variational: #ff8a3d;
  --phoenix-wash: rgba(64, 156, 255, 0.16);
  --variational-wash: rgba(255, 138, 61, 0.16);
  --n1: #30d3a6;
  --n1-wash: rgba(48, 211, 166, 0.16);
  --arcus: #a08bff;
  --rhlighter: #ff5ca3;
  --popdex: #e6b93a;
  --jumper: #9d8bff;
  --ondo: #6b93ff;
  --hyperliquid: #4fd1c0;
  --lightercore: #6b6b74;
  --good-ink: #4cd964;
  --bad-ink: #ff6961;
  --warn-ink: #ffb340;
  --good: #30d158;
  --bad: #ff453a;
  --warn: #ffb340;
  --focus: #0a84ff;
  --accent: #5fd068;
  --accent-ink: #0c2e14;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.5);
}
html:not([data-edition]) .personal-only, html[data-edition="shared"] .personal-only { display: none !important; }
html:not([data-edition="shared"]) .shared-only { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--window);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.15; }
h2 { font-size: 17px; letter-spacing: -0.012em; }
h3 { font-size: 15px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-weight: 500; }
input.mono, .addr { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); height: 100dvh; padding: 8px 8px 8px 0; background: var(--window); }
.sidebar { display: flex; flex-direction: column; gap: 14px; padding: 12px 10px 8px; min-height: 0; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 12px; border-bottom: 1px dashed var(--line-2); }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.brand-mark .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.brand-name { font-family: var(--display); font-weight: 650; font-size: 15px; letter-spacing: -0.012em; }
.tabs { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 11.5px; color: var(--ink-3); padding: 12px 10px 4px; }
.tab { appearance: none; border: none; background: transparent; color: var(--ink-2); display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; transition: background 0.15s, color 0.15s; }
.tab:hover { background: var(--inset); color: var(--ink); }
.tab.active { background: var(--well); color: var(--ink); font-weight: 600; }
.trade-nav { display: flex; flex-direction: column; gap: 2px; }
a.tab { text-decoration: none; }
.tab.trade { color: var(--ink); }
.tab.trade .venue { font-style: normal; }
.tab.trade .ico { width: 13px; height: 13px; margin-left: auto; color: var(--ink-3); }
.trade-strip { display: none; }
.nav-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.panel { background: var(--bg); border-radius: 18px; box-shadow: var(--hairline); overflow-y: auto; min-width: 0; position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 24px; min-height: 52px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.crumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); min-width: 0; white-space: nowrap; }
.crumb b { color: var(--ink); font-weight: 600; }
.crumb .ico { width: 12px; height: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.status { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.status.busy::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--focus); margin-right: 6px; animation: pulse 1s infinite ease-in-out; vertical-align: 1px; }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
.only-phone { display: none !important; }

.shell { max-width: 1760px; margin: 0 auto; padding: 24px 24px 56px; display: flex; flex-direction: column; gap: 20px; }
.tab-panel { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-head p { color: var(--ink-3); font-size: 13.5px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head .sub { color: var(--ink-3); font-size: 12.5px; }

/* ---------- controls ---------- */
.btn {
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; box-shadow: var(--hairline); background: var(--surface); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 550; font-size: 13px; line-height: 1.3; white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--inset); }
.btn:active { transform: scale(0.97); }
.btn .ico { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); color: #fff; box-shadow: none; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }
.btn.link { box-shadow: none; background: none; padding: 2px 4px; color: var(--focus); font-weight: 500; }
.btn.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn { appearance: none; border: none; background: var(--well); color: var(--ink-2); width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn .ico { width: 15px; height: 15px; }
select, input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="search"], textarea {
  appearance: none; background: var(--inset); border: none; border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; min-width: 0; outline-offset: 0;
}
select {
  width: auto; padding-right: 28px; cursor: pointer; background-repeat: no-repeat; background-position: right 10px center; background-size: 10px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 4 5 1.5 7.5 4M2.5 6 5 8.5 7.5 6'/%3E%3C/svg%3E");
}
.select-wrap select { font-size: 13px; padding: 7px 28px 7px 13px; background-color: var(--surface); box-shadow: var(--hairline); border-radius: 999px; font-weight: 550; }
textarea { resize: vertical; }
.opp-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.opp-filters input[type="search"], .rates #rv-sym { width: 200px; padding: 7px 14px; font-size: 13px; background: var(--surface); box-shadow: var(--hairline); border-radius: 999px; }
.seg { display: inline-flex; background: var(--well); border-radius: 9px; padding: 2px; gap: 1px; }
.seg button { appearance: none; border: none; background: transparent; color: var(--ink-2); padding: 4px 11px; font-size: 12.5px; font-weight: 500; border-radius: 7px; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.switch { appearance: none; width: 42px; height: 26px; border-radius: 999px; background: var(--well); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.18s; box-shadow: inset 0 0 0 1px var(--line); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.18s; }
.switch:checked { background: var(--good); box-shadow: none; }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: 0.4; cursor: default; }

/* ---------- tiles: a label on a tinted well, the number on a white card inside it ---------- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.summary .hero { grid-column: span 2; }
.closed-summary { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 12px; }
.closed-summary .hero { grid-column: auto; }
.summary.vol-summary, .summary.programs, .summary.opp-tiles { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { position: relative; background: var(--well); border: none; border-radius: var(--radius-lg); padding: 8px 15px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; text-align: left; color: inherit; font: inherit; }
.tile::before { content: ''; position: absolute; inset: 33px 3px 3px; background: var(--surface); border-radius: 15px; box-shadow: var(--hairline); }
.tile > * { position: relative; }
.tile .label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; height: 25px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { margin-top: 12px; font-family: var(--display); font-size: 24px; font-weight: 650; line-height: 1.15; letter-spacing: -0.022em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .value small { font-size: 13px; color: var(--ink-3); font-weight: 450; margin-left: 3px; letter-spacing: 0; }
.tile .cents { opacity: 0.45; font-weight: 600; }
.tile .sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.tile.hero .value { font-size: 34px; letter-spacing: -0.028em; }
.tile.tappable, .tile.program { cursor: pointer; transition: transform 0.12s; }
.tile.tappable:active, .tile.program:active { transform: scale(0.985); }
.tile.program { appearance: none; border: none; }
.tile .tile-trade { align-self: flex-start; margin-top: 9px; } /* under the numbers, so it never covers them */
.tile.program.selected { background: color-mix(in srgb, var(--accent) 40%, var(--well)); }
.tile.program.off .value { color: var(--ink-3); font-size: 16px; font-weight: 550; letter-spacing: -0.01em; margin-top: 15px; }
.pos { color: var(--good-ink); }
.neg { color: var(--bad-ink); }
.warnc { color: var(--warn-ink); }

/* ---------- chips and venue marks ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 550; background: var(--inset); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.chip.neutral { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-ink); }
.chip.neutral::before { background: var(--good); }
.chip.skewed { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn-ink); }
.chip.skewed::before { background: var(--warn); }
.chip.flat { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad-ink); }
.chip.flat::before { background: var(--bad); }
.chip.loading::before { background: var(--ink-3); }
.chip.noapi { color: var(--variational); background: var(--variational-wash); }
.chip.noapi::before { display: none; }
.venue { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; }
.venue::before { content: ''; width: 18px; height: 18px; border-radius: 5.5px; background: var(--ink-3); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; letter-spacing: 0; }
.venue.phoenix::before { content: 'P'; background: var(--phoenix); }
.venue.variational::before { content: 'O'; background: var(--variational); }
.venue.n1::before { content: 'N'; background: var(--n1); }
.venue.arcus::before { content: 'A'; background: var(--arcus); }
.venue.rhlighter::before, .venue.lighter::before { content: 'L'; background: var(--rhlighter); }
.venue.popdex::before { content: 'D'; background: var(--popdex); }
.venue.jumper::before { content: 'J'; background: var(--jumper); }
.venue.ondo::before { content: 'O'; background: var(--ondo); }
.venue.hyperliquid::before { content: 'H'; background: var(--hyperliquid); }
.venue.lightercore::before { content: 'L'; background: var(--lightercore); }
.side { font-size: 11px; font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; background: var(--inset); }
.side.long { color: var(--good-ink); background: color-mix(in srgb, var(--good) 13%, transparent); }
.side.short { color: var(--bad-ink); background: color-mix(in srgb, var(--bad) 11%, transparent); }

/* ---------- strategies ---------- */
.layout { display: block; }
.strategies { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.strategy { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--hairline); overflow: hidden; }
.strategy-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.strategy-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.strategy-title h3 { font-size: 16px; }
.strategy-title .sym { color: var(--ink-3); font-weight: 500; }
.strategy-meta { font-size: 12.5px; color: var(--ink-3); }
.strategy-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.legs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0; }
.leg { padding: 14px 18px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; }
.leg:last-child { border-right: none; }
@media (max-width: 640px) { .leg { border-right: none; } }
.leg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.leg-head .acct { color: var(--ink-3); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
@media (min-width: 900px) { .kv { grid-template-columns: 1fr 1fr 1fr; } }
.kv div { display: flex; flex-direction: column; min-width: 0; }
.kv dt { font-size: 12px; color: var(--ink-3); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.kv dd small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }
.leg-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.leg-note.warn { color: var(--warn-ink); }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 14px; padding: 14px 18px; background: var(--inset); border-bottom: 1px solid var(--line); }
.totals div { display: flex; flex-direction: column; min-width: 0; }
.totals .k { font-size: 12px; color: var(--ink-3); }
.totals .v { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.totals .v small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 0; }
.chart-card.wide .chart, .rv-chart .chart { max-width: 860px; margin-inline: auto; }
.chart-card { padding: 14px 18px 12px; border-right: 1px solid var(--line); min-width: 0; }
.chart-card:last-child { border-right: none; }
.chart-card h4 { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.chart-card h4 small { color: var(--ink-3); font-weight: 400; }
.chart-card.wide { grid-column: 1 / -1; border-right: none; border-top: 1px solid var(--line); }
.strategy-notes { padding: 10px 18px 14px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); }
.recover { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.recover-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.recover-head h4 { font-size: 13px; font-weight: 600; }
.recover-head h4 small { color: var(--ink-3); font-weight: 400; }
.recover-bar { height: 8px; border-radius: 999px; background: var(--inset); overflow: hidden; }
.recover-bar span { display: block; height: 100%; border-radius: 999px; background: var(--warn); transition: width 0.3s; }
.recover-bar.done span { background: var(--good); }
.recover-text { font-size: 13px; color: var(--ink-2); }
.leg-tags, .row-tags { display: inline-flex; align-items: center; gap: 6px; }
.proj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.proj-head h4 { margin-bottom: 0; }
.proj-toggles { display: flex; gap: 8px; flex-wrap: wrap; }
.proj-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 12px; margin-top: 10px; }
.proj-rows div { display: flex; flex-direction: column; min-width: 0; }
.proj-rows .k { font-size: 12px; color: var(--ink-3); }
.proj-rows .v { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.proj-rows .v small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }

/* ---------- charts ---------- */
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .zero line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .series path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series circle { stroke: var(--surface); stroke-width: 2; }
.chart .series.phoenix path { stroke: var(--phoenix); }
.chart .series.phoenix circle { fill: var(--phoenix); }
.chart .series.variational path { stroke: var(--variational); }
.chart .series.variational circle { fill: var(--variational); }
.chart .series.n1 path { stroke: var(--n1); }
.chart .series.n1 circle { fill: var(--n1); }
.chart .series.arcus path { stroke: var(--arcus); }
.chart .series.arcus circle { fill: var(--arcus); }
.chart .series.rhlighter path { stroke: var(--rhlighter); }
.chart .series.rhlighter circle { fill: var(--rhlighter); }
.chart .series.net path { stroke: var(--ink); stroke-dasharray: 5 4; }
.chart .series.net circle { fill: var(--ink); }
.chart .series.sim-mid path { stroke: var(--ink); }
.chart .series.sim-mid circle { fill: var(--ink); }
.chart .series.sim-lo path { stroke: var(--bad); stroke-dasharray: 4 4; }
.chart .series.sim-lo circle { fill: var(--bad); }
.chart .series.sim-hi path { stroke: var(--good); stroke-dasharray: 4 4; }
.chart .series.sim-hi circle { fill: var(--good); }
.chart .endlabel { fill: var(--ink-2); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .crosshair { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid var(--line-2); pointer-events: none; }
.chart .tip { position: absolute; top: 6px; background: var(--raised); border-radius: 12px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow), var(--hairline); pointer-events: none; min-width: 150px; z-index: 5; }
.chart .tip .t { color: var(--ink-3); font-size: 11.5px; margin-bottom: 3px; }
.chart .tip .row { display: flex; align-items: center; gap: 8px; }
.chart .tip .row .key { width: 12px; height: 0; border-top: 2px solid var(--ink-3); flex: none; }
.chart .tip .row.phoenix .key { border-color: var(--phoenix); }
.chart .tip .row.variational .key { border-color: var(--variational); }
.chart .tip .row.n1 .key { border-color: var(--n1); }
.chart .tip .row.arcus .key { border-color: var(--arcus); }
.chart .tip .row.rhlighter .key { border-color: var(--rhlighter); }
.chart .tip .row.net .key { border-color: var(--ink); border-top-style: dashed; }
.chart .tip .row.sim-mid .key { border-color: var(--ink); }
.chart .tip .row.sim-lo .key { border-color: var(--bad); }
.chart .tip .row.sim-hi .key { border-color: var(--good); }
.chart .tip .row .val { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .tip .row .name { color: var(--ink-3); }
.chart-empty { padding: 32px 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; background: var(--inset); border-radius: var(--radius-sm); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; border-top: 2px solid var(--ink-3); }
.legend .phoenix i { border-color: var(--phoenix); }
.legend .variational i { border-color: var(--variational); }
.legend .n1 i { border-color: var(--n1); }
.legend .arcus i { border-color: var(--arcus); }
.legend .rhlighter i { border-color: var(--rhlighter); }
.legend .net i { border-color: var(--ink); border-top-style: dashed; }
.legend .sim-mid i { border-color: var(--ink); }
.legend .sim-lo i { border-color: var(--bad); border-top-style: dashed; }
.legend .sim-hi i { border-color: var(--good); border-top-style: dashed; }
.refreshing .chart, .refreshing .kv, .refreshing .totals { opacity: 0.75; transition: opacity 0.2s; }
.daily-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 10px; }
.daily-card { background: var(--surface); border: none !important; box-shadow: var(--hairline); border-radius: var(--radius-lg); padding: 14px 18px 10px; min-width: 0; }
.chart.bars .partial { opacity: 0.55; }
.chart .bar-note { fill: var(--ink-2); font-size: 10.5px; font-family: var(--font); font-weight: 600; }

/* ---------- lists (iOS grouped inset) ---------- */
.list { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--hairline); overflow: hidden; }
.list-title { font-size: 13px; color: var(--ink-3); font-weight: 500; padding: 0 4px 6px; }
.list-group { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 58px; }
.list-row + .list-row { box-shadow: inset 0 1px 0 var(--line); }
.list-row .venue::before { width: 30px; height: 30px; border-radius: 8px; font-size: 15px; }
.list-row .venue { gap: 0; }
.list-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.list-text b { font-weight: 550; font-size: 14px; }
.list-text small { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-actions { display: flex; align-items: center; gap: 8px; flex: none; }
label.list-row { cursor: pointer; }
.conn-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 20px; align-items: start; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); font-size: 13.5px; }
.safety { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--good) 11%, transparent); color: var(--ink-2); font-size: 12.5px; }
.safety .ico { color: var(--good-ink); width: 16px; height: 16px; margin-top: 1px; }

.how { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 13px 15px; border-radius: var(--radius); background: color-mix(in srgb, var(--good) 11%, transparent); color: var(--ink-2); font-size: 13px; }
.how h3 { display: flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink); }
.how h3 .ico { width: 16px; height: 16px; color: var(--good-ink); }
.how ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.how b, .steps b { color: var(--ink); font-weight: 600; }
.how a, .steps a { color: var(--focus); font-weight: 550; text-decoration: none; }
.how a:hover, .steps a:hover { text-decoration: underline; text-underline-offset: 2px; }
#conn-body { display: flex; flex-direction: column; gap: 20px; }

/* ---------- accounts ---------- */
.accounts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.account-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.account { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.account .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account .addr { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .facts { font-size: 12.5px; color: var(--ink-3); display: flex; flex-direction: column; gap: 2px; }
.account .facts b { color: var(--ink-2); font-weight: 550; }
.account .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- empty states ---------- */
.empty { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.empty ol { margin: 0; padding-left: 20px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.empty .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.connect-hero { align-items: center; text-align: center; padding: 44px 24px; }
.connect-hero p { color: var(--ink-3); max-width: 46ch; }

/* ---------- tables ---------- */
.table-wrap, .opps .table-wrap { overflow-x: auto; background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius-lg); padding: 6px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { font-size: 12px; color: var(--ink-2); font-weight: 550; background: var(--inset); }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
th:first-child, td:first-child { text-align: left; }
th.l, td.l { text-align: left; }
tbody tr:hover td { background: var(--inset); }
tbody tr:last-child td { border-bottom: none; }
.foot, .opps .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px 6px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.opps .sub { font-size: 12.5px; color: var(--ink-3); }
.opps tr.flipped td { color: var(--ink-3); }
.opps td .venue { font-size: 13px; }
.opps tr.sim-row { cursor: pointer; }
.closed td { vertical-align: top; }
.closed tr.review td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.closed tr.notes-row td { padding-top: 0; }
.closed tr.notes-row:hover td { background: none; }
.closed tr.notes-row textarea { width: 100%; font-size: 13px; background: var(--inset); color: var(--ink-2); padding: 7px 10px; }
.closed tr.notes-row textarea:focus { color: var(--ink); }
.actions-cell { white-space: nowrap; }

/* ---------- sheets ---------- */
.dialog { border: none; border-radius: 22px; background: var(--bg); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog.wide { width: min(780px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog[open] { animation: sheet-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes sheet-in { from { transform: translateY(14px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-size: 19px; font-weight: 650; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog select, .dialog input[type="text"], .dialog input[type="password"], .dialog input[type="number"], .dialog input[type="datetime-local"], .dialog textarea { background: var(--surface); box-shadow: var(--hairline); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field > span small { color: var(--ink-3); font-weight: 400; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }
.hint { font-size: 12.5px; color: var(--ink-3); }
.form-error { font-size: 13px; color: var(--bad-ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.venue-pick { border: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.venue-pick legend { font-size: 12.5px; color: var(--ink-2); font-weight: 500; margin-bottom: 5px; }
.venue-option { display: flex; align-items: center; gap: 8px; background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius-sm); padding: 9px 11px; cursor: pointer; }
.venue-option input { position: absolute; opacity: 0; pointer-events: none; }
.venue-option:has(input:checked) { box-shadow: 0 0 0 2px var(--good); }
.venue-option strong { font-weight: 550; display: flex; align-items: center; gap: 6px; }
.venue-option small { display: block; color: var(--ink-3); font-size: 11.5px; }
.venue-option strong::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--ink-3); }
.venue-option.venue-phoenix strong::before { background: var(--phoenix); }
.venue-option.venue-variational strong::before { background: var(--variational); }
.venue-option.venue-n1 strong::before { background: var(--n1); }
.venue-option.venue-arcus strong::before { background: var(--arcus); }
.venue-option.venue-rhlighter strong::before { background: var(--rhlighter); }
.venue-option.venue-popdex strong::before { background: var(--popdex); }
.advanced summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); }
.advanced .field { margin-top: 8px; }
.legs-head { display: flex; align-items: center; justify-content: space-between; }
.leg-rows { display: flex; flex-direction: column; gap: 10px; }
.leg-row { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 10px; }
.leg-row .manual { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 560px) { .leg-row, .leg-row .manual { grid-template-columns: 1fr; } }
.leg-row .leg-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.leg-row select, .leg-row input, .leg-row textarea { width: 100%; background: var(--inset); box-shadow: none !important; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.close-legs { overflow-x: auto; }
.close-table { font-size: 13px; }
.close-table th, .close-table td { text-align: left; vertical-align: top; white-space: normal; }
.close-table input { width: 110px; padding: 6px 8px; font-size: 13px; }
.close-at { max-width: 260px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--raised); border-radius: 16px; padding: 11px 16px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow), var(--hairline); animation: sheet-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); pointer-events: auto; display: flex; align-items: center; gap: 9px; }
.toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.toast.ok::before { background: var(--good); }
.toast.err::before { background: var(--bad); }
.toast.warn::before { background: var(--warn); }

/* ---------- entry equalizer ---------- */
.eq-legs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.eq-leg { border: none; box-shadow: var(--hairline); border-radius: var(--radius); padding: 10px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; background: var(--surface); min-width: 0; }
.eq-leg legend { font-size: 12.5px; font-weight: 600; padding: 0; float: left; width: 100%; margin-bottom: 2px; }
.eq-leg.long legend { color: var(--good-ink); }
.eq-leg.short legend { color: var(--bad-ink); }
.eq-mode { border: none; box-shadow: var(--hairline); background: var(--surface); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.eq-mode legend { font-size: 12.5px; color: var(--ink-2); font-weight: 500; padding: 0; float: left; width: 100%; }
.eq-mode label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.eq-mode small { color: var(--ink-3); }
.eq-leg input, .eq-mode input[type="number"] { background: var(--inset); box-shadow: none; }
.eq-result { display: flex; flex-direction: column; gap: 10px; }
.eq-now { font-size: 13.5px; color: var(--ink-2); }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 12px; padding: 12px 14px; background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius); }
.eq-grid div { display: flex; flex-direction: column; min-width: 0; }
.eq-grid .k { font-size: 12px; color: var(--ink-3); }
.eq-grid .v { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.eq-grid .v small { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 400; }
.eq-partial { font-size: 13px; color: var(--ink-2); padding: 10px 12px; background: color-mix(in srgb, var(--warn) 13%, transparent); border-radius: var(--radius-sm); }
.eq-table { overflow-x: auto; background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius); padding: 6px; }
.eq-table table { font-size: 13px; }
.eq-table td small { color: var(--ink-3); }
.eq-table .hint { padding: 6px 10px 8px; }
@media (max-width: 560px) { .eq-legs { grid-template-columns: 1fr; } }

/* ---------- Rates ---------- */
.rv-notional { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.rv-notional input { width: 110px; padding: 7px 12px; font-size: 13px; background: var(--surface); box-shadow: var(--hairline); border-radius: 999px; }
.rv-best { font-size: 13.5px; color: var(--ink-2); background: color-mix(in srgb, var(--good) 11%, transparent); border-radius: var(--radius); padding: 11px 14px; }
.rv-chart { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius-lg); }
#rv-body { display: flex; flex-direction: column; gap: 14px; }

/* ---------- simulator ---------- */
.sim-inputs { display: grid; grid-template-columns: 1fr 120px auto; gap: 12px; align-items: end; }
@media (max-width: 640px) { .sim-inputs { grid-template-columns: 1fr 1fr; } }
.sim-body { display: flex; flex-direction: column; gap: 12px; }
.sim-table tr.sel td { background: var(--inset); font-weight: 600; }
.sim-note { font-size: 13px; }

/* ---------- liquidation ---------- */
.banner { border-radius: var(--radius); padding: 11px 14px; font-size: 13.5px; line-height: 1.5; }
.liq-banner { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--ink); }
.head-tools { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.liq-warn { font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.liq-warn input { width: 56px; padding: 4px 8px; font-size: 12.5px; background: var(--surface); box-shadow: var(--hairline); }
.liq-badge { font-size: 12px; font-weight: 550; padding: 2px 8px; border-radius: 999px; color: var(--ink-2); background: var(--inset); white-space: nowrap; font-variant-numeric: tabular-nums; }
.liq-badge.danger, .chip.liq.danger { color: var(--bad-ink); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.chip.liq::before { background: var(--ink-3); }
.chip.liq.danger::before { background: var(--bad); }

/* ---------- Volume ---------- */
.volume #vol-body { display: flex; flex-direction: column; gap: 14px; }
.vol-card { display: flex; flex-direction: column; gap: 14px; }
.vol-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; }
.vol-head h3 { font-size: 17px; font-weight: 650; }
.vol-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
a.btn { text-decoration: none; }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.vol-cycle { font-size: 12.5px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.vol-cycle select { padding: 4px 24px 4px 10px; font-size: 12.5px; background-color: var(--well); border-radius: 8px; }
.vol-card tr.sel td { background: color-mix(in srgb, var(--accent) 13%, transparent); }
.bar-cell { width: 28%; min-width: 80px; }
.vbar { display: block; height: 8px; border-radius: 999px; background: var(--focus); opacity: 0.8; }
.vol-sources { display: flex; flex-direction: column; gap: 10px; }
.vol-config { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius); }
.vol-config > summary { list-style: none; cursor: pointer; font-size: 14px; font-weight: 550; color: var(--ink); padding: 13px 16px; display: flex; align-items: center; gap: 6px; }
.vol-config > summary::-webkit-details-marker { display: none; }
.vol-config > summary small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vol-config > summary::after { content: ''; margin-left: auto; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); transition: transform 0.18s; }
.vol-config[open] > summary::after { transform: rotate(45deg); }
.vol-config[open] { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.vol-config[open] > :not(summary) { margin-inline: 12px; }
.vol-config .table-wrap { box-shadow: none; padding: 0; border-radius: 0; background: none; }
.vol-config input, .vol-config select { font-size: 13px; padding: 5px 10px; width: auto; background-color: var(--inset); }
.vol-config select { padding-right: 24px; }
.ondo-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vol-card tr.week-row, .vol-card tr.day-row { cursor: pointer; }
.vol-card tr.week-row.open td { background: var(--inset); font-weight: 600; }
.vol-card tr.week-detail > td { padding: 8px 10px 12px 26px; background: var(--inset); white-space: normal; text-align: left; }
.vol-card table.days { background: var(--surface); border-radius: var(--radius-sm); }
.vol-card table.days td { white-space: normal; }
.vol-card tr.day-row.open td { background: var(--raised); }
.vol-card tr.fills-row > td { padding: 4px 8px 10px 22px; background: var(--raised); }
.vol-card table.fills { font-size: 12.5px; }
.caret { display: inline-block; width: 13px; color: var(--ink-3); }
.pair { display: inline-block; font-size: 12px; padding: 2px 8px; margin: 1px 2px; border-radius: 999px; background: var(--inset); }
.vol-summary.pts .tile .value { font-size: 22px; }
.pts-table td, .pts-table th { font-size: 12.5px; padding-inline: 9px; }
.pts-table th { white-space: normal; min-width: 52px; vertical-align: bottom; line-height: 1.2; }
.pts-table td small { font-size: 11.5px; }
.pts-table tr.open-trade td { background: color-mix(in srgb, var(--good) 8%, transparent); }
.pts-table tr.earn-now td { background: color-mix(in srgb, var(--good) 10%, transparent); }
.pts-table tr.earn-next td { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.pts-head { margin: 6px 0 -4px; }
input.xp-input[type="number"] { width: 92px; padding: 5px 9px; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; background: var(--inset); }
.xp-input::-webkit-outer-spin-button, .xp-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.xp-input { -moz-appearance: textfield; appearance: textfield; }
.analysis-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }

/* ---------- shared Dashboard ---------- */
html[data-edition="shared"] .n-home { order: 0; }
html[data-edition="shared"] .n-points { order: 1; }
html[data-edition="shared"] .n-markets { order: 2; }
html[data-edition="shared"] .trade-nav { order: 3; }
.welcome { background: var(--surface); box-shadow: var(--hairline); border-radius: var(--radius-lg); padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.welcome h2 { font-size: 21px; font-weight: 650; }
.welcome > div > p { color: var(--ink-3); margin-top: 5px; max-width: 62ch; }
.welcome-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; counter-reset: step; }
.welcome-steps li { counter-increment: step; background: var(--inset); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.welcome-steps li::before { content: counter(step); width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px; display: grid; place-items: center; margin-bottom: 4px; }
.welcome-steps b { font-size: 14.5px; }
.welcome-steps span { color: var(--ink-3); font-size: 13px; flex: 1; }
.welcome-steps li > div { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.prog-row { display: grid; grid-template-columns: minmax(170px, 1.2fr) repeat(4, minmax(100px, 1fr)) auto; align-items: center; gap: 12px 16px; padding: 14px 16px; }
.prog-row + .prog-row { box-shadow: inset 0 1px 0 var(--line); }
.prog-row.off { grid-template-columns: minmax(170px, 1.2fr) 1fr auto; }
.prog-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.prog-name .venue { gap: 0; }
.prog-name .venue::before { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.prog-name b { display: block; font-weight: 600; font-size: 14.5px; }
.prog-name small, .prog-hint { color: var(--ink-3); font-size: 12.5px; }
.prog-row .k { display: block; font-size: 12px; color: var(--ink-3); }
.prog-row .v { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.prog-row .v small { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.prog-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 1180px) {
  .prog-row, .prog-row.off { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prog-name, .prog-actions, .prog-hint { grid-column: 1 / -1; }
  .prog-actions { justify-content: flex-start; }
}
#home-conn { display: flex; flex-direction: column; gap: 20px; }

/* ---------- demo view ---------- */
.demo-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer; margin-right: 4px; }
.demo-toggle .switch { width: 36px; height: 22px; }
.demo-toggle .switch::after { width: 18px; height: 18px; }
.demo-toggle .switch:checked::after { transform: translateX(14px); }
/* the first time: the switch is lit up with a tip under it */
.demo-toggle { position: relative; }
.demo-toggle.coach .switch { box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 35%, transparent); }
@media (prefers-reduced-motion: no-preference) { .demo-toggle.coach .switch { animation: coach-pulse 1.6s ease-in-out infinite; } }
@keyframes coach-pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--focus) 12%, transparent); } }
.coach-tip { position: absolute; top: calc(100% + 12px); right: -6px; z-index: 30; white-space: nowrap; background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 600; padding: 7px 11px; border-radius: 10px; box-shadow: var(--shadow); pointer-events: none; }
.coach-tip::before { content: ''; position: absolute; bottom: 100%; right: 16px; border: 6px solid transparent; border-bottom-color: var(--ink); }
.toast.info::before { background: var(--focus); }
.toasts.low { top: 106px; }
.demo-banner:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; background: color-mix(in srgb, var(--focus) 10%, var(--surface)); color: var(--ink); }

/* ---------- visitors (admin) ---------- */
.admin-page { background: var(--bg); }
.admin-page .shell { padding-top: 32px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
  .admin-page .hide-sm { display: none; }
}

/* ---------- skeleton loading ---------- */
.vol-skeleton { display: flex; flex-direction: column; gap: 14px; }
.sk { display: inline-block; max-width: 100%; border-radius: 6px; vertical-align: middle; background: linear-gradient(90deg, color-mix(in srgb, var(--ink) 7%, transparent) 25%, color-mix(in srgb, var(--ink) 14%, transparent) 37%, color-mix(in srgb, var(--ink) 7%, transparent) 63%); background-size: 400% 100%; animation: sk-shimmer 1.5s ease infinite; }
@keyframes sk-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
.tile .value .sk, .tile .sub .sk { display: block; }
.sk-bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-bottom: 6px; }
.sk-bars .sk { flex: 1; border-radius: 3px 3px 0 0; }

/* ---------- narrower windows: icon rail ---------- */
@media (max-width: 1100px) and (min-width: 821px) {
  .app { grid-template-columns: 64px minmax(0, 1fr); }
  .sidebar { padding-inline: 8px; align-items: stretch; }
  .brand { padding-inline: 6px; justify-content: center; }
  .brand-name, .nav-label, .tab span, .tab.trade .ico { display: none; }
  .tab { justify-content: center; padding: 10px 0; }
}

/* ---------- phones: a large title, a blurred bar on top and an iOS tab bar at the bottom ---------- */
@media (max-width: 820px) {
  html, body { height: auto; }
  body { background: var(--bg); }
  .app { display: block; height: auto; padding: 0; }
  .panel { border-radius: 0; box-shadow: none; overflow: visible; padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); }
  .shell { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
  .crumb > :not(b), .crumb .ico, #refresh-status, .select-wrap { display: none; }
  .only-phone { display: inline-grid !important; }
  .sidebar {
    position: fixed; inset: auto 0 0 0; z-index: 30; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 0; overflow: visible;
    background: color-mix(in srgb, var(--window) 78%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
    border-top: 1px solid var(--line);
  }
  .brand, .nav-label, .nav-foot, .trade-nav { display: none; }
  .trade-strip { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .trade-strip-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); margin-right: 2px; }
  .tabs { flex-direction: row; justify-content: space-around; gap: 0; }
  .tab { flex: 1; flex-direction: column; gap: 2px; padding: 4px 2px; font-size: 10.5px; font-weight: 500; text-align: center; background: none !important; color: var(--ink-3); border-radius: 0; }
  .tab .ico { width: 23px; height: 23px; }
  .tab.active { color: var(--good-ink); font-weight: 600; }
  h1 { font-size: 30px; }
  .summary, .summary.vol-summary, .summary.programs, .summary.opp-tiles { grid-template-columns: 1fr 1fr; }
  .summary .hero, .summary.programs .tile, .summary.pts .tile:first-child { grid-column: 1 / -1; }
  .tile .value { font-size: 21px; }
  .tile.hero .value { font-size: 32px; }
  .daily-grid, .conn-groups, .account-list { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
  .list-row { flex-wrap: wrap; }
  .list-text { flex-basis: 60%; }
  .list-actions { width: 100%; justify-content: flex-end; }
  .opps td .venue + small { display: none; }
  .opps td .venue { gap: 5px; }
  .opps .table-wrap th, .opps .table-wrap td { padding-inline: 8px; }
  .opp-filters, .opp-filters input[type="search"], .rates #rv-sym { width: 100%; }
  .opp-filters .select-wrap { display: block; }
  .opp-filters select { width: 100%; }
  .dialog, .dialog.wide { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .dialog[open] { animation: sheet-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1); }
  .dialog form { padding: 20px 16px; }
  .dialog-actions { position: sticky; bottom: 0; }
  .dialog-actions .btn { flex: 1; padding-block: 11px; }
  select, input[type="text"], input[type="password"], input[type="number"], input[type="search"], textarea { font-size: 16px; } /* iOS zooms into smaller fields */
  .toasts { top: calc(10px + env(safe-area-inset-top, 0px)); }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
