[hidden] { display: none !important; }

/* Night terminal, pure black. Colour is reserved for meaning: profit, loss, risk. */
:root {
  --bg: #000000;
  --surface: #0b0b0b;
  --raised: #161616;
  --line: #242424;
  --text: #f4f4f4;
  --muted: #8f8f8f;
  --accent: #ffffff;
  --profit: #3ccf8e;
  --loss: #ff5f6d;
  --warn: #f5c451;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --line-strong: #3a3a3a;
  --divider: #191919;
  --hover: rgb(255 255 255 / 0.03);
  --track: #262626;
  --on-accent: #000000;
  --accent-hover: #d9d9d9;
  --focus-ring: rgb(255 255 255 / 0.06);
  --chart-bg: #000000;
  --chart-grid: rgba(255, 255, 255, 0.04);
  --backdrop: rgb(0 0 0 / 0.72);
  color-scheme: dark;
}

/* Light theme: same structure, inverted values. Meaning colours are darkened for contrast on white. */
:root[data-theme="light"] {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --raised: #efefec;
  --line: #e2e2de;
  --line-strong: #c9c9c4;
  --divider: #ececE8;
  --hover: rgb(0 0 0 / 0.035);
  --track: #e6e6e2;
  --text: #121212;
  --muted: #6b6b6b;
  --accent: #121212;
  --on-accent: #ffffff;
  --accent-hover: #333333;
  --focus-ring: rgb(0 0 0 / 0.07);
  --profit: #0e9f62;
  --loss: #d63a4b;
  --warn: #a8700f;
  --brand: #b9772f;
  --chart-bg: #ffffff;
  --chart-grid: rgba(0, 0, 0, 0.05);
  --backdrop: rgb(20 20 20 / 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 'Golos Text', system-ui, sans-serif; font-variant-numeric: tabular-nums; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
button, input, select { font: inherit; color: inherit; }
button {
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer;
}
button:hover { border-color: var(--line-strong); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--loss); min-height: 1em; margin: 0; }
.profit { color: var(--profit); }
.loss { color: var(--loss); }

/* Layout: sidebar + content */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side {
  flex: 1 1 220px; max-width: 240px; min-width: 200px; border-right: 1px solid var(--line);
  padding: 26px 16px; display: flex; flex-direction: column; gap: 6px;
}
.brand { font-weight: 700; letter-spacing: 0.04em; font-size: 17px; padding: 0 12px 20px; }
.views { display: flex; flex-direction: column; gap: 4px; }
.views button, .side-link {
  text-align: left; border: 0; color: var(--muted); padding: 11px 12px; border-radius: var(--radius-sm); font-weight: 500;
}
.views button:hover, .side-link:hover { color: var(--text); background: var(--surface); }
.views button.on { color: var(--text); background: var(--raised); font-weight: 600; }
.brand { text-transform: lowercase; }
.side-wallets { list-style: none; margin: 0 0 0 12px; padding: 0 0 0 10px; border-left: 1px solid var(--line); display: grid; gap: 2px; }
.side-wallets button { width: 100%; text-align: left; border: 0; padding: 7px 10px; border-radius: var(--radius-sm); display: grid; gap: 1px; }
.side-wallets button:hover { background: var(--surface); }
.side-wallets .w-name { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.side-wallets .w-addr { font-size: 12px; color: var(--muted); }
.side-wallets .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--profit); flex: none; }
.side-wallets .dot.bad { background: var(--loss); }
.side-wallets .dot.wait { background: var(--muted); }
.side-wallets .empty-note { font-size: 13px; color: var(--muted); padding: 6px 10px; }

.content { flex: 999 1 640px; min-width: 0; }
.bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 24px 36px 0; }
.periods { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 4px; }
.periods button, .filters button { white-space: nowrap; border-color: transparent; color: var(--muted); }
.periods button.on { color: var(--text); background: var(--raised); font-weight: 600; }
.filters { display: flex; gap: 4px; }
.filters button.on { color: var(--text); border-color: var(--line); background: var(--raised); }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
body[data-view="arb"] .periods { visibility: hidden; }

main { max-width: 1240px; padding: 24px 36px 48px; display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 24px; min-width: 0; }

/* Hero: one number, said plainly, next to the stats that explain it. */
.hero-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
.hero { display: flex; flex-direction: column; justify-content: center; }
.hero-period { margin: 0; color: var(--muted); }
.hero-pnl { margin: 2px 0 6px; font-size: clamp(44px, 6vw, 68px); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.hero-sub { margin: 0; font-size: 14px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; align-content: center; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats dt { color: var(--muted); font-size: 13px; }
.hero-stats dd { margin: 0; font-weight: 600; font-size: 18px; }

/* The memorable part: PnL split by state of mind at entry. */
.mind-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.mind-head p { margin: 0; }
.mind-chart { display: grid; gap: 12px; margin-top: 6px; }
.mind-row { display: grid; grid-template-columns: 210px 1fr 1fr 110px; align-items: center; gap: 14px; }
.mind-label { color: var(--text); }
.mind-count { color: var(--muted); font-size: 13px; }
.mind-neg, .mind-pos { height: 22px; display: flex; }
.mind-neg { justify-content: flex-end; border-right: 1px solid var(--line-strong); }
.mind-bar { height: 100%; border-radius: 4px; min-width: 2px; }
.mind-neg .mind-bar { background: var(--loss); border-radius: 4px 0 0 4px; }
.mind-pos .mind-bar { background: var(--profit); border-radius: 0 4px 4px 0; }
.mind-value { text-align: right; font-weight: 600; }
.empty { color: var(--muted); padding: 18px 0; max-width: 60ch; white-space: normal; }

.split { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.equity svg { width: 100%; height: 160px; display: block; }
.plan-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }

.table-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--divider); white-space: nowrap; vertical-align: top; }
tbody tr:hover td { background: var(--hover); }
td.num, th.num { text-align: right; }
td select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 3px 6px; font-size: 13px; }
.side-long { color: var(--profit); }
.side-short { color: var(--loss); }
.tag { color: var(--muted); font-size: 12px; }
.thesis { white-space: normal; min-width: 24ch; max-width: 40ch; color: var(--muted); font-size: 13px; }

/* Arbitrage desk */
.arb-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.arb-title { font-size: 28px; margin: 0 0 4px; }
.arb-head p { margin: 0; }
.arb-settings { display: flex; gap: 14px; flex-wrap: wrap; }
.arb-settings label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.arb-settings input { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; width: 170px; }
.arb-tabs { flex-wrap: wrap; }
#arbNote { margin: 0; max-width: 100ch; }
.leg { display: block; }
.leg a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.leg a:hover { border-color: var(--text); }

/* Wallets dialog */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-lg); width: min(560px, 94vw); padding: 24px; }
dialog::backdrop { background: var(--backdrop); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.dialog-head h2 { margin: 0; }
.dialog-head p { margin: 4px 0 0; word-break: break-all; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions form { margin: 0; }
.wallet-form { border-top: 1px solid var(--line); padding-top: 16px; }
.wallet-form h3 { margin: 0; font-size: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
dialog.wallet-pnl { width: min(720px, 94vw); }
.wp-period { margin: 0; }
.wp-value { margin: 2px 0 16px; font-size: 44px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.wp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.wp-venues { display: grid; gap: 0; margin-bottom: 18px; }
.wp-venues .plan-row span:first-child { color: var(--text); }
.wallet-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.wallet-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.wallet-list .venue-status { display: block; font-size: 12px; color: var(--muted); }
.wallet-list .venue-status.bad { color: var(--loss); }
.wallet-form { display: grid; gap: 12px; }
.wallet-form label { display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.wallet-form input { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
fieldset label, .wallet-form fieldset label { display: flex; flex-direction: row; gap: 6px; align-items: center; color: var(--text); font-size: 14px; }
input[type="checkbox"] { accent-color: var(--accent); }

@media (max-width: 860px) {
  .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .brand { padding: 0 12px 0 0; }
  .views { flex-direction: row; }
  .side-wallets { margin: 0; border-left: 0; padding: 0; display: flex; flex-wrap: wrap; }
  .wp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar { padding: 16px 16px 0; }
  .periods { overflow-x: auto; max-width: 100%; }
  .bar-actions { margin-left: 0; }
  main { padding: 16px; }
  .hero-row, .split { grid-template-columns: 1fr; }
  .mind-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .mind-neg, .mind-pos { grid-column: 1 / -1; grid-row: 2; border: 0; justify-content: flex-start; height: 10px; }
  .mind-neg:empty, .mind-pos:empty { display: none; }
  .mind-neg .mind-bar, .mind-pos .mind-bar { border-radius: 4px; }
}
@media (prefers-reduced-motion: no-preference) {
  .mind-bar { transition: width 0.4s ease-out; }
}

/* Connection guide */
.form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.link-btn { border: 0; padding: 0; background: none; color: var(--text); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.link-btn:hover { color: var(--text); text-decoration-thickness: 2px; }
.field-head { display: flex; justify-content: space-between; gap: 12px; }
dialog.guide { width: min(720px, 94vw); max-height: 86vh; }
.guide-lead { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raised); }
.guide-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.guide-nav a { color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.guide-nav a:hover { border-color: var(--line-strong); }
.guide-step { border-top: 1px solid var(--line); padding: 18px 0 6px; scroll-margin-top: 8px; }
.guide-step h3 { margin: 0 0 4px; font-size: 17px; }
.guide-need { margin: 0 0 10px; color: var(--muted); }
.guide-step ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.guide-step li { line-height: 1.5; }
.guide-step code { background: var(--raised); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 13px; }
.guide-note { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

/* DEX ⇄ CEX switch, top-left */
.side-top { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 0 0 20px 12px; }
.side-top .brand { padding: 0; }
.desk-switch { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.desk-switch button { border: 0; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); background: none; }
.desk-switch button.on { background: var(--accent); color: var(--on-accent); }
.desk-switch button:not(.on):hover { color: var(--text); }

/* Liquidity: DEX vs CEX */
.liq { padding: 20px 24px; }
.lq-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.lq-head h2 { margin: 0; }
.lq-table { display: grid; }
.lq-row { display: grid; grid-template-columns: minmax(170px, 1.3fr) 110px minmax(120px, 2fr) 44px 110px; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.lq-cols { padding: 0 0 6px; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; border-bottom: 1px solid var(--line); }
.lq-label { color: var(--muted); font-size: 14px; }
.lq-val { font-weight: 600; color: var(--muted); white-space: nowrap; }
.lq-val.cur { color: var(--text); }
.lq-right { text-align: right; }
.lq-bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.lq-dex { display: block; height: 100%; background: var(--text); border-radius: 4px 0 0 4px; }
.lq-share { font-size: 13px; color: var(--muted); text-align: right; }
.lq-market { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 14px 0 0; }
.lq-market div { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.lq-market dt { color: var(--muted); }
.lq-market dd { margin: 0; font-weight: 600; white-space: nowrap; }
.lq-venues { margin-top: 16px; }
.lq-venues h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.lq-venues ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 240px)); gap: 2px 36px; }
.lq-venues li { display: grid; grid-template-columns: 1fr auto 36px; gap: 10px; font-size: 14px; padding: 4px 0; }
.lq-venues li span:last-child { text-align: right; }
.lq-sources { margin-top: 14px; font-size: 13px; color: var(--muted); }
.lq-sources summary { cursor: pointer; width: fit-content; }
.lq-sources summary:hover { color: var(--text); }
.lq-sources p { margin: 8px 0 0; max-width: 90ch; }
.lq-sources b { color: var(--text); font-weight: 500; }

/* Sidebar: tools block (the scanner is a bonus, kept apart from the journal) */
.side-tools { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.side-caption { margin: 0 0 6px 12px; font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.side-badge { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin-left: 6px; font-weight: 500; }
.views button.on .side-badge { color: var(--text); }
.cex-only { display: none; }
body[data-desk="cex"] .cex-only { display: inline; }
body[data-desk="cex"] .dex-only { display: none; }
.add-actions { display: flex; gap: 8px; margin-bottom: 4px; }
.add-actions button { flex: 1; }
.exchange-picker label.soon { color: var(--muted); }

/* Clickable rows → terminal */
tr.row-link { cursor: pointer; }
tr.row-link:focus-visible td { background: var(--hover); }
td.go { color: var(--muted); text-align: right; padding-left: 0; font-size: 18px; line-height: 1; }
tr.row-link:hover td.go { color: var(--text); }
.tag { display: inline-block; }

/* Trade terminal (DexScreener-like: chart left, facts right) */
dialog.terminal { width: min(1480px, 97vw); height: min(920px, 94vh); max-width: none; max-height: none; padding: 0; display: none; flex-direction: column; overflow: hidden; }
dialog.terminal[open] { display: flex; }
.tm-head { display: flex; align-items: center; gap: 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tm-head form { margin: 0 0 0 auto; }
.tm-title h2 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-title p { margin: 2px 0 0; font-size: 13px; }
.tm-badge { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.tm-kpis { display: flex; gap: 22px; margin: 0; flex-wrap: wrap; }
.tm-kpis div { display: grid; }
.tm-kpis dt { font-size: 12px; color: var(--muted); }
.tm-kpis dd { margin: 0; font-size: 17px; font-weight: 600; white-space: nowrap; }
.tm-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.tm-chart { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.tm-tabs { padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tm-frame { flex: 1; min-height: 280px; position: relative; display: flex; flex-direction: column; background: var(--chart-bg); }
.tm-frame .tradingview-widget-container, .tm-frame iframe { flex: 1; width: 100%; min-height: 0; border: 0; }
.tm-frame .tradingview-widget-container__widget { height: 100%; }
.tm-frame-note { margin: 0; padding: 6px 12px; border-top: 1px solid var(--line); }
.tm-empty { padding: 24px; }
.tm-spread { border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.tm-spread-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tm-spread h3, .tm-block h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.tm-spread-chart svg { width: 100%; height: 120px; display: block; }
.tm-spread-chart .zero { stroke: var(--line-strong); stroke-dasharray: 3 4; }
.tm-spread-chart .line { fill: none; stroke-width: 2; }
.tm-spread-chart .line.up { stroke: var(--profit); }
.tm-spread-chart .line.down { stroke: var(--loss); }
.tm-spread-chart .area { fill: var(--hover); }
.tm-axis { display: flex; justify-content: space-between; }
.tm-side { overflow-y: auto; min-height: 0; }
.tm-block { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tm-leg { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.tm-leg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.tm-role { font-size: 12px; font-weight: 600; border-radius: 4px; padding: 1px 6px; background: var(--raised); }
.tm-role.long, .tm-role.buy { color: var(--profit); }
.tm-role.short, .tm-role.sell { color: var(--loss); }
.tm-facts { margin: 0; display: grid; gap: 3px; }
.tm-facts div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.tm-facts dt { color: var(--muted); }
.tm-facts dd { margin: 0; text-align: right; }
.tm-go { display: block; margin-top: 8px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px; color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; }
.tm-go:hover { border-color: var(--text); }
.tm-transfer { font-size: 13px; margin: 4px 0 0; }
.tm-transfer.open { color: var(--profit); }
.tm-transfer.closed { color: var(--loss); }
.tm-transfer.unknown { color: var(--warn); }
.tm-warn { color: var(--warn); font-size: 13px; margin: 0 0 8px; }
.tm-contracts { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.tm-contracts li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; border-bottom: 1px solid var(--divider); padding-bottom: 8px; }
.tm-chain { font-weight: 600; }
.tm-contracts code { font-size: 12px; color: var(--muted); justify-self: end; }
.tm-actions { grid-column: 1 / -1; display: flex; gap: 12px; }
.tm-actions a { color: var(--text); font-size: 13px; }
.tm-contracts .tag { grid-column: 1 / -1; }
.tm-block a { color: var(--text); }
.tm-score { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.tm-score b { font-size: 30px; line-height: 1; }
.tm-score span { color: var(--muted); font-size: 13px; }
.tm-score.good b { color: var(--profit); }
.tm-score.mid b { color: var(--warn); }
.tm-score.bad b { color: var(--loss); }
.tm-checks, .tm-risks { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 3px; font-size: 13px; }
.tm-checks .ok { color: var(--muted); }
.tm-checks .no { color: var(--warn); }
.tm-risks li { color: var(--loss); }
.tm-var { font-size: 13px; }
.tm-var td { padding: 7px 4px; white-space: normal; }
.tm-var tr { cursor: pointer; }
.tm-var tr.cur td { background: var(--raised); }
.tm-var tr:hover td { background: var(--hover); }

@media (max-width: 1100px) {
  .tm-body { grid-template-columns: 1fr; overflow-y: auto; }
  .tm-chart { border-right: 0; min-height: 560px; }
  .tm-side { overflow: visible; }
}
@media (max-width: 860px) {
  .side-top { padding: 0 12px 0 0; }
  .lq-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .lq-cols { display: none; }
  .lq-label { grid-column: 1 / -1; }
  .lq-bar { grid-column: 1 / -1; grid-row: 3; }
  .lq-share { display: none; }
  .lq-venues ol { grid-template-columns: 1fr; }
  .side-tools { margin-top: 0; padding-top: 0; border-top: 0; }
  .side-caption { display: none; }
  dialog.terminal { width: 100vw; height: 100vh; border-radius: 0; }
  .tm-kpis { gap: 14px; }
}

.tm-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 14px; background: var(--chart-bg); z-index: 1; }
.tm-spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--text); border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) { .tm-spinner { animation: tm-spin 0.8s linear infinite; } }
@keyframes tm-spin { to { transform: rotate(360deg); } }

td .tag { margin-left: 5px; }
.side-tools .views button { white-space: nowrap; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.side-badge { margin-left: 0; }

/* Desk-specific controls */
.cex-only-block { display: none; }
body[data-desk="cex"] .cex-only-block { display: block; }
body[data-desk="cex"] .dex-only-block { display: none; }
.views-arb { margin-top: 6px; }

/* Journal extras: ideas, deals, news */
.extras { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; }
.extras h3 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 6px; }
.idea-list, .deal-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 2px; }
.idea-list li, .deal-list li { border-bottom: 1px solid var(--divider); padding: 9px 0; }
.idea-list li:last-child, .deal-list li:last-child { border-bottom: 0; }
.idea-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.idea-text { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.deal-list button { width: 100%; border: 0; padding: 0; background: none; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; }
.deal-list button:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.deal-route { color: var(--muted); font-size: 13px; }
.deal-value { text-align: right; font-weight: 600; }
.news { list-style: none; margin: 0; padding: 0; display: grid; }
.news li { padding: 9px 0; border-bottom: 1px solid var(--divider); }
.news li:last-child { border-bottom: 0; }
.news a { color: var(--text); text-decoration: none; line-height: 1.4; }
.news a:hover { text-decoration: underline; text-underline-offset: 3px; }
.news-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 3px; }
.coin { font-size: 11px; font-weight: 600; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--text); }
.coin.mine { border-color: var(--text); }
.diag { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12px; }
.diag li.no { color: var(--loss); }
@media (max-width: 1100px) { .extras { grid-template-columns: 1fr; } }
.wallet-list .diag li { border: 0; padding: 1px 0; display: block; border-radius: 0; }
.wallet-list li > div:first-child { min-width: 0; }
.tm-own { flex: 1; min-height: 0; position: relative; }
.tm-svg { width: 100%; height: 100%; display: block; }

/* ───────────────────────── Motion & polish ─────────────────────────
   Quiet by default: 120–360 ms, one easing curve, no bounce. Colour still
   means profit, loss or risk; the warm accent only marks "where you are". */
:root {
  --brand: #f0c08a;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t1: 120ms; --t2: 220ms; --t3: 360ms;
}
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
::selection { background: rgb(240 192 138 / 0.28); }
button, a, input, select, .tag, tr, td { transition: background-color var(--t2) var(--ease), border-color var(--t2) var(--ease), color var(--t2) var(--ease), opacity var(--t2) var(--ease), transform var(--t1) var(--ease); }
button:active:not(:disabled) { transform: scale(0.98); }
input:focus, select:focus { border-color: var(--line-strong); outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.card { transition: border-color var(--t3) var(--ease); }
.card:hover { border-color: var(--line-strong); }

/* Sliding indicators (tabs, filters, DEX/CEX switch, sidebar) */
.has-indicator { position: relative; isolation: isolate; }
.has-indicator > .indicator {
  position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; border-radius: var(--radius-sm);
  background: var(--raised); border: 1px solid var(--line);
  transition: transform var(--t3) var(--ease), width var(--t3) var(--ease), height var(--t3) var(--ease), opacity var(--t2) var(--ease);
}
.has-indicator > button.on { background: transparent; border-color: transparent; }
.desk-switch.has-indicator > .indicator { background: var(--accent); border: 0; border-radius: 999px; }
.desk-switch.has-indicator > button.on { color: var(--on-accent); }
.views.has-indicator > .indicator { border: 0; }
.views.has-indicator > .indicator::before { content: ''; position: absolute; left: -10px; top: 25%; bottom: 25%; width: 2px; border-radius: 2px; background: var(--brand); }

/* Entrance: cards rise in, staggered */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.enter { animation: rise var(--t3) var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* View transitions between Journal / Arbitrage and DEX / CEX */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 260ms; animation-timing-function: var(--ease); }
::view-transition-old(root) { animation-name: vt-out; }
::view-transition-new(root) { animation-name: vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

/* Dialogs open and close smoothly */
dialog { opacity: 0; transform: translateY(10px) scale(0.985); transition: opacity var(--t2) var(--ease), transform var(--t3) var(--ease), overlay var(--t3) allow-discrete, display var(--t3) allow-discrete; }
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateY(10px) scale(0.985); } }
dialog::backdrop { background: rgb(0 0 0 / 0); backdrop-filter: blur(0); transition: background-color var(--t3) var(--ease), backdrop-filter var(--t3) var(--ease), overlay var(--t3) allow-discrete, display var(--t3) allow-discrete; }
dialog[open]::backdrop { background: var(--backdrop); backdrop-filter: blur(6px); }
@starting-style { dialog[open]::backdrop { background: rgb(0 0 0 / 0); backdrop-filter: blur(0); } }

/* Tables: calm hover, changed numbers flash once */
tbody tr:hover td { background: var(--hover); }
@keyframes flash-up { from { background: rgb(60 207 142 / 0.16); } to { background: transparent; } }
@keyframes flash-down { from { background: rgb(255 95 109 / 0.16); } to { background: transparent; } }
td.flash-up { animation: flash-up 900ms var(--ease); }
td.flash-down { animation: flash-down 900ms var(--ease); }

/* Open positions: a live dot, live price */
.open-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 rgb(240 192 138 / 0.5); animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(240 192 138 / 0.45); } 70% { box-shadow: 0 0 0 7px rgb(240 192 138 / 0); } 100% { box-shadow: 0 0 0 0 rgb(240 192 138 / 0); } }
tr.is-open td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
.title-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.title-line h2 { margin: 0; }

/* Loading: shimmer instead of jumping text */
@keyframes shimmer { from { background-position: -200% 0; } to { background-position: 200% 0; } }
.skeleton { border-radius: 6px; background: linear-gradient(90deg, var(--raised) 0%, var(--hover) 50%, var(--raised) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; color: transparent !important; }
.tm-spinner { border-top-color: var(--brand); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

/* Header strip: best spreads, static, one line */
.ticker { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
.ticker-label { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; margin-right: 2px; flex: none; }
.tick { flex: none; display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; border-color: var(--line); background: var(--surface); font-size: 13px; }
.tick:hover { border-color: var(--line-strong); background: var(--raised); }
.tick-sym { font-weight: 600; }
.tick-val { color: var(--profit); }
@keyframes tick-glow { from { box-shadow: 0 0 0 1px rgb(60 207 142 / 0.6); } to { box-shadow: 0 0 0 1px rgb(60 207 142 / 0); } }
.tick-changed { animation: tick-glow 900ms var(--ease); }

/* Journal: main column + quiet right rail */
main.with-rail { max-width: 1600px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 22px; }
.journal-col { display: grid; gap: 18px; min-width: 0; }
.rail { position: sticky; top: 20px; display: grid; gap: 14px; max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: thin; }
.rail-block { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; background: var(--surface); }
.rail-block h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.rail-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; }
.rail-list > li { border-top: 1px solid var(--divider); }
.rail-list > li:first-child { border-top: 0; }
.rail-item { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border: 0; border-radius: 0; background: none; text-align: left; font-size: 13px; }
button.rail-item:hover .ri-main { text-decoration: underline; text-underline-offset: 3px; }
.ri-main { display: grid; min-width: 0; }
.ri-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item > span:last-child { white-space: nowrap; font-weight: 600; }
.rail .news li { padding: 8px 0; }
.rail .news a { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rail .news-meta { font-size: 11px; margin-top: 2px; }

@media (max-width: 1279px) {
  main.with-rail { grid-template-columns: 1fr; max-width: 1240px; }
  .rail { position: static; max-height: none; overflow: visible; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 860px) {
  .ticker { order: 3; flex-basis: 100%; }
}

/* News: height matched to the deals card, the rest behind a button */
.extras { align-items: start; }
.news li[hidden] { display: none; }
.more-news { width: 100%; margin-top: 10px; color: var(--muted); }
.more-news:hover { color: var(--text); }
.upsell { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 16px; display: grid; gap: 10px; justify-items: start; }
.upsell p { margin: 0; color: var(--muted); }

:root[data-theme="light"] { --brand: #b9772f; }

/* ── Account, settings, plans ── */
.side-account { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; min-width: 0; }
.side-user .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-chip { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
body[data-plan="pro"] .plan-chip { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.pro-lock { display: none; margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 45%, transparent); border-radius: 999px; padding: 0 7px; }
body[data-plan="basic"] .pro-lock { display: inline-block; }
body[data-plan="basic"] .pro-period { opacity: 0.45; }
body[data-plan="basic"] .pro-period::after { content: ' · Pro'; font-size: 11px; color: var(--brand); }

dialog.settings { width: min(560px, 94vw); }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--divider); }
.set-row h3 { margin: 0; font-size: 15px; font-weight: 600; }
.set-row p { margin: 2px 0 0; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); flex: none; }
.segmented button { border: 0; padding: 6px 14px; color: var(--muted); }
.segmented button.on { color: var(--text); font-weight: 600; }
.segmented:not(.has-indicator) button.on { background: var(--raised); }

dialog.plans-dialog { width: min(880px, 96vw); padding: 28px; }
.plans-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.plans-head h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -0.01em; }
.plans-lead { margin: 0; color: var(--muted); max-width: 60ch; }
.plans-close { border: 0; font-size: 18px; color: var(--muted); padding: 4px 8px; }
.plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; background: var(--bg); transition: border-color var(--t2) var(--ease), transform var(--t3) var(--ease); }
.plan:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.plan-pro { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: radial-gradient(120% 80% at 100% 0%, color-mix(in srgb, var(--brand) 9%, transparent), transparent 60%), var(--bg); }
.plan.current { outline: 2px solid var(--text); outline-offset: -1px; }
.plan h3 { margin: 0; font-size: 18px; }
.plan-price { margin: 6px 0 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-price b { font-size: 34px; letter-spacing: -0.02em; }
.plan-price span { color: var(--muted); font-size: 13px; }
.plan-desc { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.plan-badge { position: absolute; top: 18px; right: 18px; font-size: 11px; font-weight: 600; color: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 50%, transparent); border-radius: 999px; padding: 2px 9px; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; flex: 1; }
.plan-list li { display: flex; gap: 10px; }
.plan-list li span { color: var(--profit); width: 14px; flex: none; }
.plan-list li.off { color: var(--muted); }
.plan-list li.off span { color: var(--muted); }
.plan-cta { width: 100%; padding: 11px; font-weight: 600; }
.plans-note { margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.plans-error { color: var(--loss); margin: 6px 0 0; min-height: 0; }
@media (max-width: 720px) { .plans-grid { grid-template-columns: 1fr; } .set-row { flex-wrap: wrap; } }

/* ── Admin ── */
.admin-only { display: none; }
body[data-role="admin"] .admin-only { display: flex; }
.admin-head h1 { margin: 0 0 4px; }
.admin-head p { margin: 0; max-width: 80ch; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.admin-tile { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface); display: grid; gap: 4px; }
.admin-tile span { font-size: 12px; color: var(--muted); }
.admin-tile b { font-size: 22px; }
.admin-tile.wide { grid-column: 1 / -1; }
.admin-tile .small-b { font-size: 14px; font-weight: 500; }
.admin-search { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); min-width: 220px; }
#adminUsers select { padding: 5px 8px; }
#adminUsers td { vertical-align: middle; }
.admin-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
tr.is-blocked td { opacity: 0.6; }
.admin-audit { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
button.danger { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 40%, var(--line)); }
button.danger:hover { background: color-mix(in srgb, var(--loss) 10%, transparent); }
.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-like { display: inline-flex; align-items: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 14px; }
.btn-like:hover { background: var(--hover); }
.delete-form { border: 1px solid color-mix(in srgb, var(--loss) 40%, var(--line)); border-radius: var(--radius-sm); padding: 14px; margin-top: 6px; display: grid; gap: 10px; }
.delete-form p { margin: 0; font-size: 14px; }
.delete-form input { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
.set-actions { flex: none; flex-wrap: nowrap; } .set-actions > * { white-space: nowrap; }

/* Toast: payment status after returning from Heleket */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  box-shadow: 0 12px 40px rgba(0,0,0,.35); font-size: 14px; line-height: 1.45; animation: toast-in .35s cubic-bezier(.2,.8,.2,1); transition: opacity .5s, transform .5s; }
.toast.out { opacity: 0; transform: translate(-50%, 8px); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.plans-note a { color: var(--brand); }
.admin-pay .status-paid { color: var(--profit, #3fb68b); }

/* Wordmark: the product name everywhere (sidebar, landing, terms). One colour, Unbounded ExtraBold. */
.wordmark { font-family: "Unbounded", "Golos Text", "Arial Black", sans-serif; font-weight: 800; letter-spacing: -0.02em; text-transform: none; color: var(--text); }
.brand.wordmark { font-size: 18px; }
.lp-logo.wordmark { font-size: 21px; letter-spacing: -0.02em; }
@media (max-width: 640px) { .lp-logo.wordmark { font-size: 17px; } }
