:root {
  color-scheme: dark;
  --page: #070A08;
  --bg: #0C110E;
  --panel: #101511;
  --head: #141B16;
  --line: #2C3A30;
  --line-soft: #1D2721;
  --ink: #F2EFE4;
  --muted: #9DB0A4;
  --green: #35DE4C;
  --paper: #8FC79B;
  --red: #FF4D4D;
  --amber: #F5B23B;
  --row-hit: #18211B;
  --sans: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; background: var(--page); color: var(--ink); }
body { font-family: var(--sans); font-size: 13px; min-height: 100vh; }
a { color: var(--green); text-decoration: none; }
a:hover { color: #8CF19B; }
::selection { background: #12994A; color: var(--ink); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

@keyframes pulsedot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.app {
  width: min(1480px, calc(100vw - 24px));
  margin: 12px auto 40px;
  background: var(--bg);
  border: 1px solid var(--line);
}

/* ---------- shared atoms ---------- */

.klabel { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; color: var(--muted); text-transform: uppercase; }
.klabel.light { color: var(--ink); }
.sub { font-family: var(--mono); font-size: 10px; color: var(--muted); line-height: 1.5; }
.footnote { font-family: var(--mono); font-size: 9.5px; color: var(--muted); line-height: 1.6; }
.good { color: var(--green); }
.bad { color: var(--red); }
.amber { color: var(--amber); }
.paper { color: var(--paper); }
.muted { color: var(--muted); }
.b { font-weight: 600; }
.r { text-align: right; }
.mono { font-family: var(--mono); }
.small { font-size: 9.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px;
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--line); color: var(--ink); background: transparent;
  white-space: nowrap;
}
.chip.small { font-size: 9px; padding: 1px 6px; }
.chip.ghost { color: var(--ink); }
.chip.muted { color: var(--muted); }
.chip.pill { border-radius: 999px; padding: 3px 10px; }
.chip.green { border-color: rgba(53,222,76,0.5); background: rgba(53,222,76,0.08); color: var(--green); }
.chip.red { border-color: rgba(255,77,77,0.5); background: rgba(255,77,77,0.08); color: var(--red); }
.chip.amber { border-color: rgba(245,178,59,0.5); background: rgba(245,178,59,0.08); color: var(--amber); }
.chip.dashed { border-style: dashed; color: var(--muted); }
.chip.dashed.amber { border-color: rgba(245,178,59,0.55); color: var(--amber); }
.chip.green-soft { border-color: rgba(53,222,76,0.4); background: rgba(53,222,76,0.06); color: var(--green); }
.chip.toggle { cursor: pointer; }
.chip.toggle.on { border-color: rgba(53,222,76,0.4); background: rgba(53,222,76,0.06); color: var(--green); }

.paper-tag {
  font-family: var(--mono); font-size: 8.5px; padding: 0 4px;
  border: 1px dashed var(--paper); border-radius: 3px; color: var(--paper);
}

.act {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line);
  background: transparent; color: var(--ink); text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
.act:hover { border-color: #47584c; }
.act.solid { background: var(--green); color: #0C110E; border-color: var(--green); }
.act.solid:hover { background: #4ef065; }
.act.red { border-color: rgba(255,77,77,0.5); color: var(--red); }
.act.amber { border-color: rgba(245,178,59,0.5); color: var(--amber); }
.act.ghost { color: var(--muted); }
.act.dashed { border-style: dashed; color: var(--muted); }
.act.small { padding: 1px 6px; font-size: 9px; font-weight: 500; }

.dot {
  width: 9px; height: 9px; border-radius: 999px; background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245,178,59,.12); flex: 0 0 auto;
}
.dot.live { background: var(--green); box-shadow: 0 0 0 4px rgba(53,222,76,.12); animation: pulsedot 2s ease-in-out infinite; }
.dot.stale { background: var(--red); box-shadow: 0 0 0 4px rgba(255,77,77,.12); }
.dot.inline { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: var(--green); box-shadow: none; animation: pulsedot 2s ease-in-out infinite; }

/* ---------- chrome ---------- */

.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 10px 20px; background: var(--head); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.logo { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.brand { font-size: 14px; font-weight: 700; letter-spacing: 0.12em; }
.term-tabs { display: flex; gap: 2px; font-family: var(--mono); font-size: 11px; }
.term-tab { padding: 4px 10px; border-radius: 4px; color: var(--muted); cursor: default; }
.term-tab.linked { cursor: pointer; }
.term-tab.linked:hover { background: #18211B; color: var(--green); }
.term-tab.active { background: #1D2721; border: 1px solid var(--line); color: var(--green); font-weight: 600; }
.topbar-right .sub { font-size: 11px; }

.network-tabs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 20px; border-bottom: 1px solid var(--line); background: #0E130F;
}
.network-tab {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 4px;
  color: var(--muted); background: transparent;
}
.network-tab:hover { border-color: #47584c; color: var(--ink); }
.network-tab.active { border-color: var(--green); background: rgba(53,222,76,0.08); color: var(--green); }
body[data-network="stable"] .network-tab.active { border-color: #5ed7d3; background: rgba(94,215,211,0.08); color: #78e6e2; }

.wallet-lookup {
  display: grid; grid-template-columns: auto minmax(260px, 1fr) auto auto;
  align-items: center; gap: 10px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); background: #0A0F0C;
}
.wallet-input {
  width: 100%; min-width: 0; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--panel); color: var(--ink); outline: none;
}
.wallet-input:focus { border-color: rgba(53,222,76,0.7); box-shadow: 0 0 0 2px rgba(53,222,76,0.08); }
#wallet-search-error:empty { display: none; }

.walletstrip {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}

.verify-wallet { margin-left: 4px; }
.verify-note { max-width: 260px; }
.ws-left, .ws-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.statusline { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; color: var(--muted); }

.stale-banner {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 20px 0; padding: 9px 12px;
  background: rgba(245,178,59,0.08); border: 1px solid rgba(245,178,59,0.45); border-radius: 6px;
  font-family: var(--mono); font-size: 10.5px;
}

/* ---------- summary cards ---------- */

.summary {
  display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; min-height: 150px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.split-hero { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.split-big, .split-mid { display: flex; flex-direction: column; gap: 2px; }
.num { font-family: var(--mono); font-weight: 500; }
.split-big .num { font-size: 30px; font-weight: 600; }
.split-mid .num { font-size: 19px; }
.num.big { font-size: 25px; font-weight: 600; }
.num.mid { font-size: 15px; }
.small { font-size: 11px; }
.split-bar {
  display: flex; height: 14px; border-radius: 3px; overflow: hidden;
  border: 1px solid var(--line);
}
.seg-banked { background: var(--green); }
.seg-paper { background: repeating-linear-gradient(135deg, rgba(53,222,76,0.45) 0 5px, rgba(53,222,76,0.12) 5px 10px); }
.seg-lost { background: var(--red); opacity: 0.8; }
.split-legend { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.split-legend i { font-style: normal; }
.v-stack { display: flex; flex-direction: column; gap: 2px; }
.bench { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 11.5px; }
.bench-row { display: flex; justify-content: space-between; gap: 8px; }
.bench-row.top-line { border-top: 1px solid var(--line-soft); padding-top: 6px; }

/* ---------- queue ---------- */

.queue { display: flex; flex-direction: column; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #0E130F; }
.queue-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.queue-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.queue-empty { padding: 6px 0; }
.qcard {
  display: flex; flex-direction: column; gap: 7px;
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
  cursor: default;
}
.qcard.green { border-color: rgba(53,222,76,0.4); background: rgba(53,222,76,0.05); }
.qcard.amber { border-color: rgba(245,178,59,0.45); background: rgba(245,178,59,0.05); }
.qcard.red { border-color: rgba(255,77,77,0.45); background: rgba(255,77,77,0.05); }
.qcard .chip { align-self: flex-start; }
.qbody { font-size: 12.5px; line-height: 1.45; }
.qcard .act { margin-top: auto; }
.qcard.wide { cursor: default; }
.qrowhead { display: flex; justify-content: space-between; align-items: center; }
.qacts { display: flex; gap: 8px; flex-wrap: wrap; }
.qacts .act:first-child { flex: 1; }
.log-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }

/* ---------- controls + tabs ---------- */

.controls {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  font-family: var(--mono); font-size: 11px;
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 4px;
  background: transparent; color: var(--ink);
}
.tab.active { background: var(--green); color: #0C110E; font-weight: 600; border-color: var(--green); }
.controls-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sel {
  font-family: var(--mono); font-size: 10px; margin-left: 6px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px;
}

/* ---------- positions table ---------- */

.table-wrap { overflow-x: auto; }
.prow {
  display: grid;
  grid-template-columns: minmax(168px, 1.3fr) 112px 98px 130px 130px 152px 168px 136px 98px 118px;
  gap: 12px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft);
  min-width: 1360px;
}
.prow:not(.phead) { cursor: pointer; }
.prow:not(.phead):hover { background: rgba(53,222,76,0.03); }
.prow.phead {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--muted);
  padding: 8px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 2;
}
.phead > .r { text-align: right; }
.sort-head {
  appearance: none; border: 0; padding: 0; background: transparent;
  color: inherit; font: inherit; letter-spacing: inherit; cursor: pointer;
}
.sort-head:hover, .sort-head.active { color: var(--green); }
.sort-head:focus-visible { outline: 1px solid var(--green); outline-offset: 3px; }
.market-sort-head { white-space: nowrap; }
.prow.acc-green { background: var(--row-hit); border-left: 3px solid var(--green); padding-left: 13px; }
.prow.acc-red { background: rgba(255,77,77,0.04); border-left: 3px solid var(--red); padding-left: 13px; }
.cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cell.r { text-align: right; align-items: flex-end; }
.cell.acts { gap: 4px; align-items: stretch; text-align: center; }
.cell .sub, .cell .numcell, .cell .sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.sym { font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.sym.big { font-size: 20px; }
.numcell { font-family: var(--mono); font-size: 12px; }
.dexlink { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.dexlink:hover { color: var(--green); }

.lviz { display: inline-flex; gap: 3px; }
.lseg { height: 8px; display: inline-block; }
.lseg.taken { background: var(--green); }
.lseg.hit { border: 1px solid var(--amber); background: rgba(245,178,59,0.25); }
.lseg.armed { border: 1px solid var(--line); }
.lseg.moon { border: 1px dashed var(--line); }
.lseg.moon.breach { border-color: var(--red); background: rgba(255,77,77,0.15); }

.empty { padding: 22px 20px; }
.table-foot { display: flex; justify-content: space-between; padding: 10px 20px; border-top: 1px solid var(--line-soft); }
.page-foot { padding: 10px 20px 16px; text-align: center; }
.tab-note { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); font-size: 11px; flex-wrap: wrap; }

/* secondary data tables */
.dt { width: 100%; border-collapse: collapse; min-width: 1000px; }
.dt th {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
}
.dt th:first-child, .dt td:first-child { text-align: left; }
.dt td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); text-align: right; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.dt td .sym { display: block; font-family: var(--sans); }
.dt td .sub { display: block; }
.dt tr:hover td { background: rgba(53,222,76,0.02); }

/* ---------- drawer / panel ---------- */

.drawer-wrap { position: fixed; inset: 0; z-index: 50; pointer-events: none; visibility: hidden; }
.drawer-wrap.open { pointer-events: auto; visibility: visible; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(2,4,3,0.6); opacity: 0; transition: opacity .15s; }
.drawer-wrap.open .drawer-scrim { opacity: 1; }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(580px, 96vw);
  background: var(--bg); border-left: 1px solid var(--line);
  overflow-y: auto; transform: translateX(100%); transition: transform .18s ease-out;
}
.drawer-wrap.open .drawer { transform: translateX(0); }

.dhead {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 14px 20px; background: var(--head); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 3;
}
.dtitle { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; flex-wrap: wrap; }
.dsec { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dsec.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dsec.two-col > div { display: flex; flex-direction: column; gap: 7px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-family: var(--mono); font-size: 11.5px; flex-wrap: wrap; }
.kv.top-line { border-top: 1px solid var(--line-soft); padding-top: 6px; }
.stub-list { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 10.5px; }

.chart { display: block; width: 100%; height: auto; }
.chart .priceline { fill: none; stroke: var(--green); stroke-width: 1.5; }
.chart .ref { stroke-dasharray: 4 4; stroke-width: 1; }
.chart .ref-entry { stroke: var(--ink); opacity: 0.5; }
.chart .ref-step { stroke: var(--green); opacity: 0.6; }
.chart .ref-trail { stroke: var(--red); opacity: 0.7; }
.chart .dot-peak { fill: #0C110E; stroke: var(--amber); stroke-width: 1.5; }
.chart .dot-now { fill: var(--green); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; }
.chart-empty { padding: 30px 0; text-align: center; }

.lhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lrow {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
.lrow.hit { border-color: rgba(245,178,59,0.5); background: rgba(245,178,59,0.06); }
.lrow.taken { border-color: rgba(53,222,76,0.35); background: rgba(53,222,76,0.04); }
.lnum { font-family: var(--mono); font-size: 11px; color: var(--muted); width: 14px; }
.lmain { display: flex; flex-direction: column; gap: 3px; flex: 1; font-family: var(--mono); font-size: 11.5px; }
.lin {
  width: 52px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px;
  font-family: var(--mono); font-size: 11px; text-align: right;
}
.lfoot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.lfoot > span:last-child { display: inline-flex; gap: 8px; }

.dcta { display: flex; flex-direction: column; gap: 8px; padding: 14px 20px 18px; background: var(--panel); position: sticky; bottom: 0; }
.cta-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.cta-grid .act { padding: 11px 6px; border-radius: 6px; }
.dcta .footnote { text-align: center; }

.qpanel { width: min(500px, 96vw); }
.panel-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px;
  background: var(--head); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 3;
}
.ptitle { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; flex: 1; }
.panel-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.panel-foot { display: flex; flex-direction: column; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); background: var(--panel); }

/* ---------- fullscreen chart ---------- */

.asset-workspace {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 4px; padding: 8px 16px;
  background: var(--head); border-bottom: 1px solid var(--line);
}
.asset-tab {
  appearance: none; border: 1px solid var(--line); border-radius: 4px;
  background: transparent; color: var(--muted); padding: 6px 10px;
  font: 10px var(--mono); letter-spacing: .08em; cursor: pointer;
}
.asset-tab:hover, .asset-tab.active { color: var(--green); border-color: rgba(53,222,76,.45); background: rgba(53,222,76,.07); }
.asset-tab-panel.hidden { display: none; }
.asset-symbol, .asset-contract {
  appearance: none; border: 0; padding: 0; background: transparent;
  color: inherit; font: inherit; cursor: pointer; text-align: left;
}
.asset-symbol:hover, .asset-contract:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.asset-trades-host { min-height: 180px; border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; }
.trades-state { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
.asset-trades-list { display: flex; flex-direction: column; max-height: 420px; overflow: auto; }
.asset-trade {
  display: grid; grid-template-columns: 90px 60px 1fr 1fr 1fr auto;
  gap: 10px; align-items: center; padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft); font: 10px var(--mono);
}
.asset-trade:last-child { border-bottom: 0; }
.chart-state { padding: 24px 0; text-align: center; }

.chart-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.chart-top {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; background: var(--head); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ct-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ct-left .sym { font-size: 16px; }
.ct-price { font-size: 12px; }
.ct-tf, .ct-ind { display: flex; gap: 4px; flex-wrap: wrap; }
.tf-btn, .ind-btn { padding: 4px 9px; font-size: 10px; }
.tf-btn.on, .ind-btn.on {
  border-color: rgba(53,222,76,0.5); background: rgba(53,222,76,0.08); color: var(--green);
}
.ct-close { margin-left: auto; }
.chart-body { position: relative; flex: 1; min-height: 0; }
.chart-host { position: absolute; inset: 0; }
.chart-lines { position: absolute; inset: 0; pointer-events: none; }
.cline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.cline.entry { border-top-style: dashed; border-top-color: rgba(242,239,228,0.5); }
.cline.armed { border-top-color: rgba(157,176,164,0.7); }
.cline.hit { border-top-color: var(--amber); }
.cline.taken { border-top-color: rgba(53,222,76,0.7); }
.cline.trail { border-top-style: dashed; border-top-color: rgba(255,77,77,0.8); }
.cline-label {
  position: absolute; right: 64px; transform: translateY(-50%);
  font-family: var(--mono); font-size: 9.5px; white-space: nowrap;
  padding: 2px 7px; border-radius: 3px;
  background: #1b241e; border: 1px solid var(--line); color: var(--ink);
}
.cline.entry .cline-label { color: var(--muted); }
.cline.hit .cline-label { border-color: rgba(245,178,59,0.6); color: var(--amber); }
.cline.taken .cline-label { border-color: rgba(53,222,76,0.5); color: var(--green); }
.cline.trail .cline-label { border-color: rgba(255,77,77,0.6); color: var(--red); }
.cline.editable .cline-label { pointer-events: auto; cursor: ns-resize; touch-action: none; }
.cline.editable .cline-label:hover { background: #26332d; }
.chart-empty-note { position: absolute; inset: 0; display: grid; place-items: center; }
.chart-foot { padding: 7px 16px; border-top: 1px solid var(--line); text-align: center; }
.drawer-chart-wrap { position: relative; border: 1px solid var(--line-soft); border-radius: 6px; overflow: hidden; }
.drawer-chart-host { height: 250px; }
.drawer-chart-state { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(12,17,14,.78); }
.lhead-acts { display: inline-flex; align-items: center; gap: 8px; }

@media (max-width: 700px) {
  .asset-workspace { overflow-x: auto; padding: 8px 10px; }
  .asset-tab { flex: 0 0 auto; }
  .asset-trade { grid-template-columns: 70px 52px 1fr; }
  .asset-trade > :nth-child(4), .asset-trade > :nth-child(5) { display: none; }
  .chart-top { gap: 8px; padding: 8px 10px; }
  .ct-ind { display: none; } /* 1f: monitor mode — no indicator tools on mobile */
  .cline-label { right: 52px; }
}

/* ---------- mobile monitor components (design 1f) ---------- */

.monitor-strip {
  display: flex; justify-content: center;
  padding: 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; color: var(--green);
}

.msummary {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.msum-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.msum-l, .msum-r { display: flex; flex-direction: column; gap: 2px; }
.msum-r { align-items: flex-end; }
.msum-big { font-size: 24px; font-weight: 600; }
.msum-mid { font-size: 15px; }
.split-bar.thin { height: 9px; border-radius: 2px; }

.mlist-head { padding: 10px 16px 4px; }
.mrow {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer;
}
.mrow:hover { background: rgba(53,222,76,0.03); }
.mrow.danger { background: rgba(255,77,77,0.04); }
.mrow-l, .mrow-r { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mrow-r { align-items: flex-end; flex-shrink: 0; }
.mrow .sym { font-size: 14px; }
.mrow .sub, .mrow .numcell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.mkill {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--panel);
}
.mkill .act { width: 100%; padding: 13px 0; font-size: 13px; border-radius: 8px; border-width: 1.5px; }
.mkill .footnote { text-align: center; }

/* ---------- responsive ---------- */

/* .only-mobile/.only-desktop carry their own display types; media queries only veto. */
@media (min-width: 701px) {
  .only-mobile { display: none !important; }
}

@media (max-width: 1100px) {
  .summary { grid-template-columns: 1fr; }
  .split-big .num { font-size: 24px; }
}

@media (max-width: 700px) {
  .only-desktop { display: none !important; }
  body { font-size: 12px; }
  .app { width: 100vw; margin: 0; border: 0; }
  .topbar, .controls { padding: 8px 12px; }
  .wallet-lookup { grid-template-columns: 1fr auto; padding: 10px 12px; }
  .wallet-lookup .klabel, .wallet-lookup .sub { grid-column: 1 / -1; }
  .queue { padding: 12px; }
  /* 1f chrome: logo + brand + active tab + LIVE; the rest lives elsewhere */
  .walletstrip { display: none; }
  .topbar-left .chip.ghost { display: none; }
  .term-tab:not(.active):not(.linked) { display: none; }
  .topbar-right .chip.pill, .topbar-right .act.red { display: none; }
  .blockinfo { display: none; }
  .stale-banner { margin: 10px 12px 0; }
  .queue-strip { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .queue-strip .qcard { min-width: 210px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .tab { flex: 0 0 auto; }
  .controls-right { display: none; }
  .table-foot, .page-foot { display: none; }
  .drawer { width: 100vw; }
  .cta-grid { grid-template-columns: 1fr; }
  .dsec.two-col { grid-template-columns: 1fr; }
}

/* ================= PnL Share composer ================= */

.share-wrap { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 18px; }
.share-scrim { position: absolute; inset: 0; background: rgba(7, 10, 8, 0.78); }
.share-modal {
  position: relative; width: min(1040px, 100%); max-height: 94vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.share-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--head); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2;
}
.share-title { font-weight: 700; letter-spacing: 0.06em; font-size: 14px; }
.share-head .chip { max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.share-head button { margin-left: auto; }
.share-body { display: grid; grid-template-columns: 360px 1fr; }
.share-controls { display: flex; flex-direction: column; gap: 16px; padding: 16px; border-right: 1px solid var(--line); }
.share-block { display: flex; flex-direction: column; gap: 8px; }
.share-note { font-family: var(--mono); font-size: 9.5px; line-height: 1.6; color: var(--muted); }
.share-note.center { text-align: center; }
.share-auto { font-family: var(--mono); font-size: 9.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 1px 7px; margin-left: 8px; }

.share-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.share-toggle {
  font-family: var(--mono); font-size: 10.5px; padding: 4px 10px; cursor: pointer;
  border: 1px dashed var(--line); border-radius: 4px; background: none; color: var(--muted);
}
.share-toggle.on { border: 1px solid rgba(53, 222, 76, 0.5); background: rgba(53, 222, 76, 0.08); color: var(--green); }

.share-moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-mood {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 6px 8px; cursor: pointer; background: none;
  border: 1px solid var(--line); border-radius: 6px;
}
.share-mood.on { border-color: var(--green); background: rgba(53, 222, 76, 0.07); }
.share-mood canvas { width: 54px; height: 54px; }
.share-mood span { font-family: var(--mono); font-size: 9.5px; color: var(--muted); }

.share-caption {
  font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: 16px;
  color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 12px; width: 100%;
}
.share-caption:focus { outline: none; border-color: var(--green); }
.share-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.share-preset {
  font-family: var(--mono); font-size: 10px; padding: 3px 9px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted);
}
.share-preset:hover { color: var(--ink); border-color: var(--green); }

.share-formats { display: flex; flex-wrap: wrap; gap: 6px; }
.share-format {
  font-family: var(--mono); font-size: 10.5px; padding: 5px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: none; color: var(--ink);
}
.share-format.on { background: var(--green); border-color: var(--green); color: var(--bg); font-weight: 600; }

.share-preview { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: #0E130F; }
.share-canvas-box { display: flex; justify-content: center; }
.share-canvas-box canvas { max-width: 100%; max-height: 56vh; border: 1px solid var(--line); }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.nowrap { white-space: nowrap; }

@media (max-width: 900px) {
  .share-body { grid-template-columns: 1fr; }
  .share-controls { border-right: none; border-bottom: 1px solid var(--line); }
}
body.route-public .legacy-execution { display: none !important; }

/* ---------- Ethereum / FWA protocol portfolio ---------- */

body[data-network="ethereum"] .controls { display: none; }
body[data-network="ethereum"] .table-wrap { overflow: visible; }
body[data-network="ethereum"] .page-foot::first-letter { text-transform: uppercase; }

.fwa-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 24px;
  background:
    radial-gradient(circle at 100% 0, rgba(53, 222, 76, 0.055), transparent 34rem),
    var(--bg);
}

.fwa-hero,
.fwa-panel,
.fwa-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.fwa-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 22px;
}

.fwa-hero h2 {
  margin: 6px 0 8px;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  letter-spacing: -0.035em;
}

.fwa-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.fwa-price {
  display: flex;
  min-width: 180px;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-family: var(--mono);
}

.fwa-price strong { font-size: 20px; font-weight: 500; }

.fwa-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.fwa-metrics article {
  display: flex;
  min-height: 112px;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0E130F;
}

.fwa-metrics b {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
}

.fwa-metrics small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.35;
}

.fwa-capital-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.fwa-capital-metrics article {
  display: flex;
  min-height: 116px;
  flex-direction: column;
  justify-content: space-between;
  gap: 9px;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
  background: #0E130F;
}

.fwa-capital-metrics article:last-child { border-right: 0; }
.fwa-capital-metrics b {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 500;
}
.fwa-capital-metrics small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.4;
}

.fwa-capital-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fwa-capital-breakdown > div {
  padding: 16px;
  border-right: 1px solid var(--line);
}

.fwa-capital-breakdown > div:last-child { border-right: 0; }
.fwa-capital-breakdown .klabel {
  display: block;
  margin-bottom: 10px;
}
.fwa-capital-breakdown .bench-row { min-height: 25px; }
.fwa-capital-caveat {
  margin: 10px 0 0;
  line-height: 1.45;
}

.fwa-panel { overflow: hidden; }

.fwa-keeper {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}

.fwa-keeper-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.fwa-keeper-grid article {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.fwa-keeper-grid article:last-child { border-right: 0; }

.fwa-keeper-grid b {
  overflow-wrap: anywhere;
  font-family: var(--mono);
}

.fwa-keeper-grid label {
  display: flex;
  min-height: 86px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-right: 1px solid var(--line);
}

.fwa-keeper-grid label input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
}

.fwa-keeper-grid label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.fwa-keeper-grid > .act {
  align-self: center;
  margin: 12px 18px;
}

.fwa-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fwa-period-grid article {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.fwa-period-grid article:last-child { border-right: 0; }
.fwa-period-grid b {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
}
.fwa-period-grid small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}

.fwa-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.fwa-panel-head p { margin: 4px 0 0; }
.fwa-table-wrap { overflow-x: auto; }
.fwa-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.fwa-table th,
.fwa-table td {
  padding: 11px 13px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  font-size: 11px;
}
.fwa-table th {
  color: var(--muted);
  background: #0E130F;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.055em;
}
.fwa-table tr:last-child td { border-bottom: 0; }
.fwa-table .r { text-align: right; }
.fwa-ledger-table { min-width: 1380px; }
.fwa-value-input {
  display: grid;
  grid-template-columns: auto 72px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}
.fwa-value-input input {
  width: 72px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
}
.fwa-value-input input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(53, 222, 76, 0.2);
}
.block { display: block; margin-top: 3px; }

.fwa-wins { display: flex; flex-direction: column; }
.fwa-win {
  display: grid;
  grid-template-columns: minmax(230px, 1.5fr) minmax(120px, 0.7fr) 0.7fr 0.7fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}
.fwa-win:last-child { border-bottom: 0; }

.fwa-note {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  padding: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.fwa-note b { color: var(--ink); font-family: var(--mono); font-weight: 500; }

@media (max-width: 1100px) {
  .fwa-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fwa-capital-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fwa-capital-metrics article:nth-child(3) { border-right: 0; }
  .fwa-capital-metrics article:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
  .fwa-win { grid-template-columns: minmax(220px, 1fr) auto auto; }
  .fwa-win > :nth-child(4) { display: none; }
}

@media (max-width: 700px) {
  .fwa-shell { padding: 12px; }
  .fwa-hero { grid-template-columns: 1fr; align-items: start; }
  .fwa-price { align-items: flex-start; }
  .fwa-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fwa-metrics article:last-child { grid-column: 1 / -1; }
  .fwa-capital-metrics,
  .fwa-capital-breakdown { grid-template-columns: 1fr; }
  .fwa-capital-metrics article {
    min-height: 102px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .fwa-capital-metrics article:last-child { border-bottom: 0; }
  .fwa-capital-breakdown > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .fwa-capital-breakdown > div:last-child { border-bottom: 0; }
  .fwa-panel-head { align-items: flex-start; flex-direction: column; }
  .fwa-keeper-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fwa-keeper-grid article:nth-child(2) { border-right: 0; }
  .fwa-keeper-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .fwa-period-grid { grid-template-columns: 1fr; }
  .fwa-period-grid article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .fwa-period-grid article:last-child { border-bottom: 0; }
  .fwa-win { grid-template-columns: 1fr auto; }
  .fwa-win > :nth-child(3),
  .fwa-win > :nth-child(4) { display: none; }
  .fwa-note { grid-template-columns: 1fr; gap: 6px; }
}
