/* Blackbook Trading — design tokens */
:root {
  /* Accent (default electric blue) */
  --accent: oklch(0.58 0.21 254);
  --accent-soft: oklch(0.58 0.21 254 / 0.10);
  --accent-line: oklch(0.58 0.21 254 / 0.28);

  /* Neutrals — cool, low-saturation */
  --bg: oklch(0.995 0.002 240);
  --bg-elev: #ffffff;
  --bg-soft: oklch(0.975 0.003 240);
  --bg-sunken: oklch(0.965 0.004 240);
  --fg: oklch(0.20 0.012 252);
  --fg-2: oklch(0.42 0.012 252);
  --fg-3: oklch(0.58 0.010 252);
  --fg-4: oklch(0.72 0.008 252);
  --line: oklch(0.91 0.005 252);
  --line-strong: oklch(0.85 0.006 252);

  /* P&L */
  --pos: oklch(0.62 0.16 152);
  --pos-soft: oklch(0.62 0.16 152 / 0.10);
  --neg: oklch(0.58 0.21 27);
  --neg-soft: oklch(0.58 0.21 27 / 0.10);

  /* Density (tweakable) */
  --pad-1: 6px;
  --pad-2: 10px;
  --pad-3: 14px;
  --pad-4: 18px;
  --pad-5: 24px;
  --pad-6: 32px;
  --row-h: 32px;
  --card-pad: 18px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  /* Type */
  --fs-1: 11px;
  --fs-2: 12px;
  --fs-3: 13px;
  --fs-4: 14px;
  --fs-5: 16px;
  --fs-6: 20px;
  --fs-7: 28px;
  --fs-8: 44px;
  --fs-9: 64px;

  --ff-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-mono: "Geist Mono", ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace;
  --ff-serif: "Newsreader", "Source Serif 4", ui-serif, Georgia, serif;
  --ff: var(--ff-sans);

  --shadow-sm: 0 1px 0 oklch(0.85 0.005 252 / 0.6);
  --shadow-md: 0 1px 2px rgba(15, 20, 40, 0.04), 0 1px 0 oklch(0.92 0.005 252 / 0.6);
  --shadow-pop: 0 1px 2px rgba(15, 20, 40, 0.06), 0 8px 28px rgba(15, 20, 40, 0.08);
}

[data-theme="dark"] {
  --bg: oklch(0.115 0.012 235);
  --bg-elev: oklch(0.145 0.014 235);
  --bg-soft: oklch(0.18 0.016 235);
  --bg-sunken: oklch(0.095 0.012 235);
  --fg: oklch(0.94 0.006 235);
  --fg-2: oklch(0.78 0.008 235);
  --fg-3: oklch(0.64 0.010 235);
  --fg-4: oklch(0.48 0.012 235);
  --line: oklch(0.27 0.014 235);
  --line-strong: oklch(0.36 0.016 235);
  --pos-soft: oklch(0.62 0.16 152 / 0.20);
  --neg-soft: oklch(0.58 0.21 27 / 0.20);
  --shadow-sm: 0 1px 0 oklch(0.26 0.012 235 / 0.8);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.22), 0 1px 0 oklch(0.24 0.012 235 / 0.8);
  --shadow-pop: 0 16px 44px rgba(0, 0, 0, 0.36), 0 1px 0 oklch(0.30 0.014 235 / 0.7);
}

[data-density="compact"] {
  --pad-1: 4px;
  --pad-2: 7px;
  --pad-3: 10px;
  --pad-4: 13px;
  --pad-5: 17px;
  --pad-6: 22px;
  --row-h: 26px;
  --card-pad: 12px;
  --fs-2: 11px;
  --fs-3: 12px;
  --fs-4: 13px;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--ff);
  font-size: var(--fs-3);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.mono { font-family: var(--ff-mono); font-feature-settings: "tnum", "zero"; }
.tnum { font-variant-numeric: tabular-nums; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* ──────────────── App shell ──────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
[data-density="compact"] .app { grid-template-columns: 220px 1fr; }

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: var(--pad-4);
  gap: var(--pad-4);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
}
.primary-wordmark {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.primary-wordmark svg { flex-shrink: 0; }
.primary-wordmark > div {
  min-width: 0;
}
.primary-wordmark-name {
  font-family: "Newsreader", var(--ff-serif), ui-serif, Georgia, serif;
  font-weight: 300;
  font-size: 21px;
  letter-spacing: -0.022em;
  line-height: 1;
  color: var(--fg);
}
.primary-wordmark-name em { font-style: italic; }
.primary-wordmark-sub {
  font-family: var(--ff-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 5px;
  white-space: nowrap;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--fg);
  color: var(--bg-elev);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
  font-family: var(--ff-sans);
}
.brand-name { font-weight: 600; font-size: var(--fs-4); letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--fg-3); letter-spacing: 0.04em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg-2);
  cursor: pointer;
  font-size: var(--fs-3);
  user-select: none;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-sunken); color: var(--fg); }
.nav-item.active {
  background: var(--bg-elev);
  color: var(--fg);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.nav-item .ic { width: 16px; height: 16px; opacity: 0.8; flex-shrink: 0; }
.nav-item.active .ic { color: var(--accent); opacity: 1; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-4); padding: 10px 10px 4px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--bg-elev); border: 1px solid var(--line);
}
.user-chip:hover { cursor: default; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 600;
  color: white; flex-shrink: 0;
}
.avatar-sm { width: 20px; height: 20px; font-size: 9px; }
.avatar-img {
  display: block;
  object-fit: cover;
  object-position: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.user-chip .name { font-weight: 500; font-size: var(--fs-3); }
.user-chip .role { font-size: 10.5px; color: var(--fg-3); }

/* ──────────────── Main pane ──────────────── */
.main {
  overflow-y: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--pad-6);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 4;
  gap: var(--pad-4);
}
.topbar-l { display: flex; align-items: center; gap: var(--pad-3); }
.topbar-title { font-size: var(--fs-5); font-weight: 600; letter-spacing: -0.01em; }
.crumb { color: var(--fg-3); font-size: var(--fs-2); }
.topbar-r { display: flex; align-items: center; gap: var(--pad-2); }

.search-input {
  display: flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 7px; width: 260px;
  color: var(--fg-3); font-size: var(--fs-2);
}
.search-input:focus-within { border-color: var(--accent); background: var(--bg-elev); color: var(--fg); }
.search-input input { all: unset; flex: 1; }
.asset-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  margin-top: 10px;
}
.asset-results button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  font-size: var(--fs-2);
}
.asset-results button:hover { border-color: var(--accent-line); background: var(--bg-elev); }
.asset-results button span:last-child {
  color: var(--fg-3);
  font-size: var(--fs-1);
}

/* ──────────────── Quant terminal ──────────────── */
.quant-terminal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.quant-header {
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.quant-market-title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}
.coin-dot {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 700;
}
.market-name {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: 0;
}
.quant-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}
.quant-metrics > div {
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.quant-metrics > div:last-child { border-right: none; }
.quant-metrics span {
  color: var(--fg-3);
  font-size: var(--fs-2);
  font-weight: 600;
}
.quant-metrics b {
  font-family: var(--ff-mono);
  font-size: var(--fs-4);
  font-weight: 600;
}
.quant-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 700px;
}
.quant-main {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--bg-elev);
}
.quant-book-rail {
  background: var(--bg-elev);
  min-width: 0;
}
.book-rail-top {
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--fg-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-3);
}
.quant-chart {
  min-height: 700px;
  position: relative;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg-elev);
  background-size: 100% 68px, 146px 100%;
}
.chart-toolbar {
  height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.chart-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--fg-2);
  font-size: var(--fs-4);
}
.chart-tabs .active { color: var(--accent); }
.chart-actions {
  display: flex;
  gap: 12px;
  color: var(--fg-3);
}
.chart-grid line { stroke: var(--line); }
.chart-labels text {
  fill: var(--fg-3);
  font-family: var(--ff-mono);
  font-size: 12px;
}
.chart-empty {
  min-height: 700px;
  display: grid;
  place-items: center;
  color: var(--fg-3);
}
@media (max-width: 1200px) {
  .quant-header { grid-template-columns: 1fr; }
  .quant-market-title { border-right: 0; border-bottom: 1px solid var(--line); }
  .quant-metrics { grid-template-columns: repeat(3, 1fr); }
  .quant-body { grid-template-columns: 1fr; }
  .quant-main { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ──────────────── Quant Hyperliquid terminal ──────────────── */
.quant-page {
  flex: 1;
  max-width: none;
  width: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.qhl-terminal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 352px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.qhl-left {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--line);
}
.qhl-strip {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  overflow: visible;
  scrollbar-width: none;
}
.qhl-strip::-webkit-scrollbar { display: none; }
.qhl-pair-search {
  position: relative;
  z-index: 60;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, auto) 24px;
  align-items: center;
  gap: 2px;
  max-width: 190px;
}
.qhl-coin,
.qhl-token-fallback,
.qhl-token-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.qhl-token-img {
  object-fit: cover;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
.qhl-coin,
.qhl-token-fallback {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-family: var(--ff-mono);
}
.qhl-pair-search > button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
}
.qhl-pair-search > button:hover { background: var(--bg-elev); color: var(--fg); }
.qhl-pair-trigger {
  max-width: 158px;
  height: 28px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 0;
  color: var(--fg);
  text-align: left;
  cursor: default;
  pointer-events: none;
}
.qhl-pair-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 19px;
  font-weight: 650;
  line-height: 1;
}
.qhl-menu-hit {
  color: var(--fg-3);
}
.qhl-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(1120px, calc(100vw - 48px));
  max-height: min(680px, calc(100vh - 140px));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  box-shadow: var(--shadow-pop);
  z-index: 1000;
}
.qhl-results-search {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 14px 10px;
  padding: 0 12px;
  height: 42px;
  border: 1px solid var(--fg-4);
  border-radius: 10px;
  background: var(--bg-soft);
  box-shadow: inset 0 0 0 1px transparent;
  color: var(--fg-3);
}
.qhl-results-search:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.qhl-results-search input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--fg);
  padding: 0;
  font-family: var(--ff-sans);
  font-size: var(--fs-4);
}
.qhl-results-search input:focus {
  box-shadow: none;
}
.qhl-result-tabs {
  position: sticky;
  top: 66px;
  z-index: 3;
  display: flex;
  gap: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.qhl-result-tabs button {
  width: auto;
  height: 38px;
  padding: 0 18px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: var(--fs-4);
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.qhl-result-tabs button.active {
  color: var(--fg);
}
.qhl-result-tabs button.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 18px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.qhl-result-table {
  min-width: 980px;
}
.qhl-result-empty {
  grid-column: 1 / -1;
  padding: 14px 20px;
  color: var(--fg-3);
  font-size: var(--fs-2);
}
.qhl-result-head {
  position: sticky;
  top: 105px;
  z-index: 2;
  display: grid;
  grid-template-columns: 2fr 1.05fr 1.45fr 1fr 1.2fr 1.2fr;
  gap: 18px;
  align-items: center;
  padding: 8px 20px;
  background: var(--bg-soft);
  color: var(--fg-3);
  font-size: var(--fs-3);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  line-height: 1;
}
.qhl-result-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 2fr 1.05fr 1.45fr 1fr 1.2fr 1.2fr;
  align-items: center;
  gap: 18px;
  padding: 5px 20px;
  font-size: var(--fs-3);
  line-height: 1;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.qhl-result-row:nth-child(even) { background: color-mix(in oklab, var(--bg-soft) 55%, transparent); }
.qhl-result-row:hover { background: var(--bg-soft); }
.qhl-result-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qhl-result-symbol {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}
.qhl-result-symbol b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ff-mono);
  font-size: var(--fs-3);
  line-height: 1;
  font-weight: 600;
  color: var(--fg);
}
.qhl-result-symbol em {
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--pos-soft);
  color: var(--pos);
  font-size: var(--fs-2);
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}
.qhl-lev {
  padding: 3px 8px;
  border-radius: 5px;
  color: var(--pos);
  background: var(--pos-soft);
  border: 1px solid var(--pos-soft);
  font-family: var(--ff-mono);
  font-size: var(--fs-2);
  font-weight: 600;
}
.qhl-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 116px;
}
.qhl-stat span {
  color: var(--fg-3);
  font-size: var(--fs-2);
  white-space: nowrap;
}
.qhl-stat b {
  font-family: var(--ff-mono);
  font-size: var(--fs-3);
  font-weight: 600;
  white-space: nowrap;
}
.qhl-left-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.qhl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--fg-2);
  font-size: var(--fs-2);
}
.qhl-toolbar-side {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.qhl-tf {
  border: 0;
  background: transparent;
  padding: 4px 9px;
  border-radius: 4px;
  color: var(--fg-2);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.qhl-tf.active {
  background: var(--bg-soft);
  color: var(--accent);
}
.qhl-icbtn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--fg-3);
}
.qhl-icbtn:hover,
.qhl-tf:hover {
  background: var(--bg-soft);
  color: var(--fg);
}
.qhl-sep {
  width: 1px;
  height: 15px;
  background: var(--line);
  margin: 0 6px;
}
.qhl-chart-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.qhl-chart {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg-elev);
  background-size: 100% 68px, 146px 100%;
}
.qhl-chart svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.qhl-tv-chart-shell {
  background: var(--bg-elev);
}
.qhl-tv-chart {
  position: absolute;
  inset: 0;
}
.qhl-tv-chart table {
  font-family: var(--ff-mono);
}
.qhl-tv-credit {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--fg-3);
  font-size: var(--fs-1);
  font-family: var(--ff-mono);
  pointer-events: none;
}
.qhl-grid line { stroke: var(--line); }
.qhl-axis text {
  fill: var(--fg-3);
  font-family: var(--ff-mono);
  font-size: 11px;
}
.qhl-ohlc {
  position: absolute;
  top: 12px;
  left: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--fg-2);
  font-family: var(--ff-mono);
  font-size: var(--fs-2);
  white-space: nowrap;
}
.qhl-ohlc .sym { color: var(--fg); }
.qhl-ohlc .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  display: inline-block;
}
.qhl-ohlc b {
  color: var(--fg);
  font-weight: 500;
}
.qhl-watermark {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  color: var(--fg-3);
  border: 1px solid var(--line);
  font-family: var(--ff-mono);
  font-size: var(--fs-2);
  font-weight: 700;
}
.qhl-chart-empty {
  display: grid;
  place-items: center;
  color: var(--fg-3);
  min-height: 460px;
}
.qhl-timerange {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--fg-2);
  font-size: var(--fs-2);
}
.qhl-range {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 4px;
}
.qhl-range.active,
.qhl-range:hover {
  color: var(--fg);
  background: var(--bg-soft);
}
.qhl-clock {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--ff-mono);
  color: var(--fg-3);
}
.qhl-clock .active { color: var(--accent); }
.qhl-metrics-panel {
  display: grid;
  grid-template-columns: 220px 1fr 1.6fr;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.qhl-metrics-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  padding: 10px;
}
.qhl-metrics-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.qhl-metrics-heading span {
  color: var(--fg-3);
  font-size: var(--fs-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.qhl-metrics-heading b {
  font-family: var(--ff-mono);
  font-size: var(--fs-5);
  font-weight: 700;
}
.qhl-bias-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--neg-soft), var(--bg-soft) 50%, var(--pos-soft));
  border: 1px solid var(--line);
}
.qhl-bias-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.qhl-bias-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: var(--fg-3);
  font-size: var(--fs-2);
}
.qhl-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.qhl-metric-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.qhl-metric-tile {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
}
.qhl-metric-tile span,
.qhl-metric-tile em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-3);
  font-size: var(--fs-1);
  font-style: normal;
}
.qhl-metric-tile b {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ff-mono);
  font-size: var(--fs-3);
  font-weight: 700;
}
.qhl-metric-tile em {
  margin-top: 3px;
  color: var(--fg-4);
}
.qhl-right {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-elev);
  font-family: var(--ff-mono);
  font-variant-numeric: tabular-nums;
}
.qhl-right::before {
  content: "";
  height: 2px;
  background: var(--accent);
  opacity: 0.35;
  animation: scan 2.4s ease-in-out infinite;
}
.qhl-ob-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-3);
}
.qhl-ob-head .tick,
.qhl-ob-head .quote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg);
}
.qhl-ob-head .quote { color: var(--fg-2); }
.qhl-ob-cols,
.qhl-ob-row,
.qhl-ob-spread {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}
.qhl-ob-cols {
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--fg-3);
  font-family: var(--ff-sans);
  font-size: var(--fs-2);
  font-weight: 600;
}
.qhl-ob-cols span:nth-child(2),
.qhl-ob-cols span:nth-child(3),
.qhl-ob-row span:nth-child(3),
.qhl-ob-row span:nth-child(4) {
  text-align: right;
}
.qhl-ob-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.qhl-ob-side {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.qhl-ob-row {
  min-height: 28px;
  align-items: center;
  padding: 0 14px;
  position: relative;
  font-size: var(--fs-3);
}
.qhl-ob-row > span {
  position: relative;
  z-index: 1;
}
.qhl-ob-row .bar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  transition: width 120ms linear;
}
.qhl-ob-row.ask .bar {
  background: var(--neg-soft);
  border-left: 1px solid var(--neg-soft);
}
.qhl-ob-row.bid .bar {
  background: var(--pos-soft);
  border-left: 1px solid var(--pos-soft);
}
.qhl-ob-row.ask .px {
  color: var(--neg);
  font-weight: 500;
}
.qhl-ob-row.bid .px {
  color: var(--pos);
  font-weight: 500;
}
.qhl-ob-row:hover { background: var(--bg-soft); }
.qhl-ob-spread {
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  font-family: var(--ff-sans);
  font-size: var(--fs-3);
  font-weight: 600;
}
.qhl-ob-spread span:nth-child(2),
.qhl-ob-spread span:nth-child(3) {
  text-align: right;
  font-family: var(--ff-mono);
}
.qhl-ob-spread span:nth-child(3) {
  color: var(--fg-3);
  font-weight: 500;
}
.qhl-ob-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--fg-4);
  font-family: var(--ff-sans);
  font-size: var(--fs-1);
}
.qhl-ob-footer .live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--pos);
  font-weight: 600;
}
.qhl-ob-footer .live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  animation: pulse 2s infinite;
}
.qhl-ob-empty {
  display: grid;
  place-items: center;
  flex: 1;
  color: var(--fg-3);
  padding: 18px;
  text-align: center;
}
@keyframes scan {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.55; }
}
@media (max-width: 1180px) {
  .qhl-terminal { grid-template-columns: 1fr; overflow: auto; }
  .qhl-left { border-right: 0; min-height: 760px; }
  .qhl-right { min-height: 520px; border-top: 1px solid var(--line); }
  .qhl-metrics-panel { grid-template-columns: 1fr; }
  .qhl-metric-grid,
  .qhl-metric-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .qhl-strip { gap: 12px; }
  .qhl-pair-search { flex-basis: 210px; }
  .qhl-pair-trigger span { font-size: 18px; }
  .qhl-chart-wrap { grid-template-columns: minmax(0, 1fr); }
  .qhl-ohlc { max-width: calc(100% - 92px); overflow: hidden; }
  .qhl-timerange { align-items: flex-start; flex-direction: column; }
  .qhl-metric-grid,
  .qhl-metric-grid.four { grid-template-columns: 1fr; }
}
.kbd {
  font-family: var(--ff-mono); font-size: 10px;
  padding: 1px 5px; border-radius: 4px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--fg-3);
}

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--bg-soft);
  border-radius: 7px; cursor: pointer; color: var(--fg-2);
}
.icon-btn:hover { background: var(--bg-elev); color: var(--fg); }
.icon-btn.active { background: var(--bg-elev); color: var(--accent); border-color: var(--accent-line); }
.topbar-action { position: relative; }
.alert-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neg);
  box-shadow: 0 0 0 2px var(--bg-soft);
}
.menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  padding: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  z-index: 20;
}
.settings-popover { width: 240px; }
.profile-popover { width: 300px; }
.menu-title {
  font-size: var(--fs-3);
  font-weight: 600;
  margin-bottom: 10px;
}
.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-2);
}
.menu-row span, .menu-note { color: var(--fg-3); }
.menu-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: var(--fs-2);
  line-height: 1.5;
}
.menu-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-2);
}
.menu-control span { color: var(--fg-3); }
.menu-control select {
  height: 28px;
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 0 8px;
}
.switch-input {
  appearance: none;
  width: 42px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-sunken);
  position: relative;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.switch-input::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: var(--fg-3);
  transition: transform 140ms ease, background 140ms ease;
}
.switch-input:checked {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.switch-input:checked::before {
  transform: translateX(18px);
  background: var(--accent);
}
.profile-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
  color: var(--fg);
}
.profile-btn:hover,
.profile-btn.active {
  border-color: var(--accent-line);
  background: var(--bg-elev);
}
.profile-btn span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  font-size: var(--fs-1);
  font-weight: 700;
  color: white;
}
.profile-btn img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}
.profile-edit-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 12px;
  border-top: 1px solid var(--line);
}
.profile-preview,
.profile-preview-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 1px solid var(--line);
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-2);
}
.profile-field span {
  color: var(--fg-3);
}
.profile-field input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 0 9px;
}
.profile-message {
  margin-top: 8px;
  font-size: var(--fs-2);
  line-height: 1.4;
}
.swatch-row { display: flex; gap: 6px; }
.swatch-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--bg-elev);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}
.swatch-btn.active { box-shadow: 0 0 0 2px var(--fg); }

.page {
  padding: var(--pad-6);
  display: flex; flex-direction: column; gap: var(--pad-5);
  max-width: 1600px;
  width: 100%;
}

/* ──────────────── Cards ──────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.card-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--card-pad) 6px;
  gap: 12px;
}
.card-h h3 {
  margin: 0; font-size: var(--fs-3); font-weight: 600;
  letter-spacing: -0.005em; color: var(--fg);
}
.card-h .card-sub { font-size: var(--fs-2); color: var(--fg-3); }
.card-b { padding: 6px var(--card-pad) var(--card-pad); display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.card-pad-full > .card-b { padding: 0; }

.tabs { display: flex; gap: 2px; background: var(--bg-soft); padding: 2px; border-radius: 7px; border: 1px solid var(--line); }
.tab { padding: 4px 10px; font-size: var(--fs-2); border-radius: 5px; cursor: pointer; color: var(--fg-3); }
.tab:hover { color: var(--fg); }
.tab.active { background: var(--bg-elev); color: var(--fg); box-shadow: var(--shadow-sm); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  font-size: var(--fs-1);
  border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--fg-2);
  font-family: var(--ff-mono); letter-spacing: 0.02em;
}
.pill.pos { background: var(--pos-soft); border-color: var(--pos); color: var(--pos); }
.pill.neg { background: var(--neg-soft); border-color: var(--neg); color: var(--neg); }
.pill.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-elev);
  padding: 0 14px; height: 32px; border-radius: 7px;
  font-size: var(--fs-3); cursor: pointer; color: var(--fg);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--bg-soft); }
.btn.primary { background: var(--fg); color: var(--bg-elev); border-color: var(--fg); }
.btn.primary:hover { background: oklch(0.30 0.012 252); }
.btn.accent { background: var(--accent); color: white; border-color: var(--accent); }
.btn.accent:hover { filter: brightness(1.05); }
.btn.danger { color: var(--neg); border-color: var(--neg); background: var(--neg-soft); }
.btn.danger:hover { background: oklch(0.58 0.21 27 / 0.16); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn.sm { height: 26px; padding: 0 10px; font-size: var(--fs-2); }

/* ──────────────── Grids ──────────────── */
.row { display: grid; gap: var(--pad-4); }
.row.r-1 { grid-template-columns: 1fr; }
.row.r-2 { grid-template-columns: 1fr 1fr; }
.row.r-3 { grid-template-columns: 1fr 1fr 1fr; }
.row.r-4 { grid-template-columns: repeat(4, 1fr); }
.row.r-23 { grid-template-columns: 2fr 1fr; }
.row.r-31 { grid-template-columns: 3fr 1fr; }
.row.r-12 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1200px) {
  .row.r-4 { grid-template-columns: 1fr 1fr; }
  .row.r-3 { grid-template-columns: 1fr 1fr; }
}

/* ──────────────── Stat tiles ──────────────── */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: var(--fs-2); color: var(--fg-3); letter-spacing: 0; }
.stat-value { font-size: var(--fs-7); font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-value.big { font-size: var(--fs-8); }
.stat-value.huge { font-size: var(--fs-9); letter-spacing: -0.04em; }
.stat-sub { font-size: var(--fs-2); color: var(--fg-3); display: flex; align-items: center; gap: 8px; }
.stat-delta { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }

/* ──────────────── Tables ──────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-2); font-variant-numeric: tabular-nums; }
.tbl th {
  text-align: left; padding: 8px var(--card-pad);
  font-weight: 500; color: var(--fg-3); font-size: var(--fs-1);
  letter-spacing: 0.04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); background: var(--bg-soft);
}
.tbl td { padding: 9px var(--card-pad); border-bottom: 1px solid var(--line); color: var(--fg); }
.tbl tr:last-child td { border-bottom: none; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--ff-mono); }
.tbl tr:hover td { background: var(--bg-soft); }

/* ──────────────── Calendar ──────────────── */
.calendar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-title-row .icon-btn {
  width: 28px;
  height: 28px;
}
.calendar-title-row .icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-h { font-size: 10px; color: var(--fg-4); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; padding-bottom: 4px; }
.cal-cell {
  appearance: none;
  aspect-ratio: 1.4 / 1;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: var(--fs-2); position: relative;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
  text-align: center;
}
.cal-cell .d {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 10px;
  color: var(--fg-4);
  font-weight: 500;
}
.cal-cell .v {
  font-family: var(--ff-mono);
  font-size: clamp(16px, 1.35vw, 24px);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}
.cal-cell.empty { background: var(--bg-soft); border-color: var(--line); }
.cal-cell.empty .v { color: var(--fg-4); }
.cal-cell.today { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.cal-cell:hover { transform: translateY(-1px); }
.cal-cell.future { background: repeating-linear-gradient(45deg, var(--bg-soft), var(--bg-soft) 5px, transparent 5px, transparent 10px); border-color: var(--line); }
.cal-cell.future .v { color: transparent; }
.cal-cell.empty, .cal-cell.future { cursor: default; }

/* ──────────────── Allocation treemap ──────────────── */
.treemap { display: grid; gap: 3px; height: 240px; width: 100%; }
.treemap .blk {
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: white; position: relative; overflow: hidden;
  cursor: default;
}
.treemap .blk:hover { filter: brightness(1.05); }
.treemap .blk .sym { font-weight: 600; font-size: var(--fs-4); letter-spacing: -0.01em; }
.treemap .blk .pct { font-family: var(--ff-mono); font-size: 10.5px; opacity: 0.85; }
.treemap .blk .val { font-family: var(--ff-mono); font-size: var(--fs-2); font-weight: 500; }

/* ──────────────── Orderbook ──────────────── */
.ob-ladder {
  font-family: var(--ff-mono);
  font-size: var(--fs-4);
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  color: var(--fg);
  overflow: hidden;
}
.ob-head,
.ob-level {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  position: relative;
}
.ob-head {
  color: var(--fg-3);
  font-family: var(--ff-sans);
  font-size: var(--fs-3);
  font-weight: 600;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.ob-head span:nth-child(2),
.ob-head span:nth-child(3),
.ob-level span:nth-child(3),
.ob-level span:nth-child(4) {
  text-align: right;
}
.ob-level {
  isolation: isolate;
  border-top: 1px solid var(--line);
}
.ob-level .bar {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  pointer-events: none;
  transition: width 120ms linear;
}
.ob-level.ask .bar { background: var(--neg-soft); }
.ob-level.bid .bar { background: var(--pos-soft); }
.ob-level.ask .px { color: var(--neg); }
.ob-level.bid .px { color: var(--pos); }
.ob-level:hover { background: var(--bg-soft); }
.ob-ladder-spread {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  background: var(--bg-sunken);
  color: var(--fg);
  font-family: var(--ff-sans);
  font-size: var(--fs-4);
  font-weight: 600;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ob-ladder-spread b {
  font-family: var(--ff-mono);
  text-align: center;
  font-weight: 600;
}
.ob-ladder-spread span:last-child { text-align: right; }
/* ──────────────── Activity feed ──────────────── */
.feed { display: flex; flex-direction: column; }
.feed-row {
  display: grid; grid-template-columns: 70px 1fr auto;
  align-items: center; padding: 8px var(--card-pad);
  border-bottom: 1px solid var(--line); gap: 12px; font-size: var(--fs-2);
}
.feed-row:last-child { border-bottom: none; }
.feed-row .t { font-family: var(--ff-mono); color: var(--fg-3); }
.feed-row .desc { color: var(--fg); }
.feed-row .desc b { font-weight: 600; }
.feed-row .v { font-family: var(--ff-mono); font-variant-numeric: tabular-nums; }

/* ──────────────── Member status (logged today) ──────────────── */
.mstatus { display: flex; flex-direction: column; gap: 8px; padding: var(--card-pad); }
.mstatus-row {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.mstatus-row .name { font-size: var(--fs-3); font-weight: 500; }
.mstatus-row .meta { font-size: var(--fs-1); color: var(--fg-3); }
.mstatus-row .val { font-family: var(--ff-mono); font-size: var(--fs-3); }

.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.ok { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.dot.miss { background: var(--neg); }
.dot.idle { background: var(--fg-4); }

/* ──────────────── Wallet summary ──────────────── */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.wallet-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.wallet-grid span {
  color: var(--fg-3);
  font-size: var(--fs-2);
}
.wallet-grid b {
  font-size: var(--fs-5);
}
@media (max-width: 900px) {
  .wallet-grid { grid-template-columns: 1fr 1fr; }
}

/* ──────────────── Holdings ──────────────── */
.holdings-page {
  padding-bottom: 330px;
}
.holdings-stat-card {
  padding: 16px 18px;
  gap: 6px;
}
.holdings-stat-card span {
  color: var(--fg-3);
  font-size: var(--fs-2);
}
.holdings-stat-card b {
  font-size: var(--fs-6);
  font-weight: 600;
}
.holdings-main > div,
.holdings-side {
  min-width: 0;
}
.holdings-side {
  display: flex;
  flex-direction: column;
  gap: var(--pad-4);
}
.holdings-positions .card-b {
  padding: 0;
  overflow: auto;
}
.holdings-table tr {
  cursor: pointer;
}
.holdings-table tr.selected td {
  background: var(--accent-soft);
}
.holdings-empty {
  padding: 18px;
  color: var(--fg-3);
  font-size: var(--fs-3);
  line-height: 1.5;
}
.holdings-empty.compact {
  padding: 10px;
  font-size: var(--fs-2);
}
.holdings-risk-list {
  gap: 0;
  padding-top: 0;
}
.holdings-risk-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.holdings-risk-list > div:last-child { border-bottom: 0; }
.holdings-risk-list span {
  color: var(--fg-3);
}
.holdings-risk-list b {
  font-family: var(--ff-mono);
  font-weight: 500;
  text-align: right;
}
.holdings-comments .card-b {
  gap: 12px;
}
.comment-list {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.comment-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.comment-row:last-child { border-bottom: 0; }
.comment-row > div,
.chat-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--fg-3);
  font-size: var(--fs-1);
}
.comment-row b,
.chat-row b {
  color: var(--fg);
  font-size: var(--fs-2);
  font-weight: 600;
}
.comment-row p,
.chat-row p {
  margin: 5px 0 0;
  color: var(--fg-2);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.comment-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-compose textarea {
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 9px 10px;
  outline: 0;
}
.comment-compose textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.holdings-chat {
  position: fixed;
  left: 272px;
  bottom: 24px;
  z-index: 18;
  width: min(390px, calc(100vw - 304px));
  max-height: 300px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow-pop);
}
[data-density="compact"] .holdings-chat { left: 248px; }
.holdings-chat-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.holdings-chat-h > div {
  display: flex;
  align-items: center;
  gap: 7px;
}
.holdings-chat-h span {
  color: var(--fg-3);
  font-family: var(--ff-mono);
  font-size: var(--fs-1);
}
.holdings-chat-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.holdings-chat-actions .icon-btn {
  width: 24px;
  height: 24px;
}
.holdings-chat-toggle {
  position: fixed;
  left: 272px;
  bottom: 24px;
  z-index: 18;
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg);
  padding: 0 11px;
  box-shadow: var(--shadow-pop);
  cursor: pointer;
}
[data-density="compact"] .holdings-chat-toggle { left: 248px; }
.holdings-chat-toggle span {
  font-weight: 600;
  font-size: var(--fs-2);
}
.holdings-chat-toggle b {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--ff-mono);
  font-size: var(--fs-1);
  font-weight: 600;
}
.holdings-chat-messages {
  min-height: 120px;
  overflow: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.chat-row {
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.chat-row.mine {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.holdings-chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 7px;
  padding: 9px;
  border-top: 1px solid var(--line);
}
.holdings-chat-compose input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--fg);
  padding: 0 9px;
  outline: 0;
}
.holdings-chat-compose input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
@media (max-width: 980px) {
  .holdings-main { grid-template-columns: 1fr; }
  .holdings-chat {
    left: 18px;
    width: min(390px, calc(100vw - 36px));
  }
  .holdings-chat-toggle {
    left: 18px;
  }
}

/* ──────────────── Allocation hover ──────────────── */
.allocation-donut {
  position: relative;
  flex-shrink: 0;
}
.donut-slice {
  cursor: pointer;
  transition: opacity 150ms ease, stroke 150ms ease;
}
.donut-slice:hover {
  opacity: 1;
}
.donut-slice.muted {
  opacity: 0.22;
  stroke: var(--line);
}
.allocation-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.allocation-legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto auto;
  gap: 10px;
  align-items: center;
  font-size: var(--fs-2);
  transition: opacity 150ms ease, color 150ms ease;
}
.allocation-legend-row.muted {
  opacity: 0.38;
  color: var(--fg-4);
}
.allocation-popover {
  position: absolute;
  left: 128px;
  top: 14px;
  z-index: 8;
  width: 190px;
  padding: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}
.allocation-popover-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-3);
  margin-bottom: 4px;
}
.allocation-popover-title span {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}
.allocation-popover-kind {
  color: var(--fg-3);
  font-size: var(--fs-1);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.allocation-popover-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 5px;
  font-size: var(--fs-2);
}
.allocation-popover-row span { color: var(--fg-3); }
.allocation-popover-row b {
  font-family: var(--ff-mono);
  font-weight: 500;
}

/* ──────────────── Sign in ──────────────── */
.signin-page {
  display: grid; grid-template-columns: 1fr 1fr;
  height: 100vh; background: var(--bg);
}
.signin-left {
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.signin-right {
  display: grid; place-items: center; padding: 48px;
}
.signin-form { width: 320px; display: flex; flex-direction: column; gap: 18px; }
.signin-form h1 { font-size: var(--fs-7); margin: 0; font-weight: 600; letter-spacing: -0.025em; }
.signin-form p.sub { margin: 0; color: var(--fg-3); font-size: var(--fs-3); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-2); color: var(--fg-2); font-weight: 500; }
.field input {
  height: 36px; padding: 0 12px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 7px; font-size: var(--fs-3); outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.signin-members { display: flex; flex-direction: column; gap: 6px; }
.signin-member {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-elev); cursor: pointer;
}
.signin-member:hover { border-color: var(--accent); background: var(--accent-soft); }
.signin-member .name { font-size: var(--fs-3); font-weight: 500; }
.signin-member .sub { font-size: var(--fs-1); color: var(--fg-3); }
.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }
.signin-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 12, 18, 0.48);
}
.signin-modal {
  position: relative;
  min-width: 220px;
  padding: 28px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: var(--shadow-pop);
  text-align: center;
  font-size: var(--fs-5);
  font-weight: 600;
}
.signin-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.signin-modal-close:hover {
  background: var(--bg-soft);
  color: var(--fg);
}

/* ──────────────── Misc ──────────────── */
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.spinner { width: 12px; height: 12px; border: 1.5px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: var(--fs-1); color: var(--fg-3); }
.legend .sw { display: inline-flex; align-items: center; gap: 5px; }
.legend .sw::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--bg-soft); }

/* SVG common */
svg .axis text { fill: var(--fg-4); font-family: var(--ff-mono); font-size: 9.5px; }
svg .axis line, svg .axis path { stroke: var(--line); }
svg .grid line { stroke: var(--line); stroke-dasharray: 2 3; }
svg .area-pos { fill: var(--pos); fill-opacity: 0.08; }
svg .line-pos { stroke: var(--pos); fill: none; stroke-width: 1.5; }
svg .line-accent { stroke: var(--accent); fill: none; stroke-width: 1.5; }

.tt {
  position: absolute; pointer-events: none;
  background: var(--fg); color: var(--bg-elev);
  border-radius: 6px; padding: 6px 8px;
  font-size: var(--fs-1); font-family: var(--ff-mono);
  white-space: nowrap; z-index: 50;
  box-shadow: var(--shadow-pop);
  transform: translate(-50%, -120%);
}

/* ──────────────── Modal ──────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 16, 28, 0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(520px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.modal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.modal-h h3 {
  margin: 0;
  font-size: var(--fs-4);
  font-weight: 600;
}
.modal-b {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
}
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-2);
}
.mini-row:last-child { border-bottom: none; }
.mini-empty {
  padding: 12px;
  color: var(--fg-3);
  font-size: var(--fs-2);
}
.form-error {
  padding: 10px 12px;
  border: 1px solid var(--neg);
  background: var(--neg-soft);
  border-radius: 7px;
  color: var(--neg);
  font-size: var(--fs-2);
}
