:root {
  --bg: #0b0f0d;
  --panel: #101613;
  --panel-2: #141b17;
  --line: rgba(164, 180, 170, 0.16);
  --muted: #7e8a82;
  --text: #e1e7e3;
  --soft: #abb5ae;
  --green: #8cc39b;
  --red: #d77f79;
  --amber: #c1a66f;
  --cyan: #91b7b1;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body {
  margin: 0;
  font-family: Geist, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #0b0f0d 0%, #0c1210 52%, #090d0b 100%);
  min-height: 100dvh;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.shell {
  width: min(1280px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow, .label {
  margin: 0 0 6px;
  font-family: "Geist Mono", ui-monospace, monospace;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 10px;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.04em; }
h1 { font-size: clamp(24px, 2.7vw, 36px); line-height: 1; font-weight: 620; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }

.status-pill {
  font-family: "Geist Mono", ui-monospace, monospace;
  color: var(--green);
  border: 1px solid rgba(127, 217, 154, .28);
  background: rgba(127, 217, 154, .06);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.context-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  font-family: "Geist Mono", ui-monospace, monospace;
}
.context-line span {
  color: var(--soft);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.025);
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
}

.equity-deck {
  display: grid;
  grid-template-columns: minmax(240px, .72fr) 1.28fr;
  gap: 1px;
  border: 1px solid rgba(127, 217, 154, .22);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(164, 180, 170, .14);
  margin-bottom: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
.equity-main, .equity-rail-wrap {
  background: rgba(16, 22, 19, .92);
  padding: 16px;
}
.equity-number {
  margin-top: 6px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1;
  letter-spacing: -.06em;
}
.equity-sub {
  margin-top: 9px;
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
}
.equity-rail-wrap { display: grid; align-content: center; gap: 9px; }
.rail-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 11px;
}
.rail-head strong { color: var(--soft); }
.equity-rail {
  height: 8px;
  border: 1px solid var(--line);
  background: rgba(2, 8, 6, .58);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 8px rgba(0,0,0,.36);
}
.equity-rail span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green));
  border-radius: inherit;
}
.equity-rail.lock span { background: linear-gradient(90deg, rgba(127, 217, 154, .38), var(--green)); }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr .8fr .8fr;
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--line);
  margin-bottom: 14px;
}

.metric {
  background: rgba(11, 23, 19, .88);
  padding: 13px 14px;
  min-height: 88px;
}
.metric .name { font-family: "Geist Mono", ui-monospace, monospace; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .11em; }
.metric .value { margin-top: 10px; font-family: "Geist Mono", ui-monospace, monospace; font-size: clamp(16px, 1.8vw, 24px); color: var(--text); letter-spacing: -.04em; }
.metric .sub { margin-top: 5px; color: var(--muted); font-size: 12px; }
.good { color: var(--green) !important; }
.bad { color: var(--red) !important; }
.warn { color: var(--amber) !important; }
.info { color: var(--cyan) !important; }

.split {
  display: grid;
  grid-template-columns: 1.55fr .8fr;
  gap: 14px;
  margin-bottom: 14px;
}
.lower { grid-template-columns: 1fr 1fr; }
.panel {
  border: 1px solid var(--line);
  background: rgba(11, 23, 19, .78);
  border-radius: 14px;
  padding: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.link { color: var(--green); text-decoration: none; font-family: "Geist Mono", monospace; font-size: 12px; }
.link:hover { text-decoration: underline; }

.kv-stack { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 9px 11px; background: rgba(8, 18, 15, .9); font-family: "Geist Mono", monospace; font-size: 12px; }
.kv span:first-child { color: var(--muted); }

.empty {
  padding: 18px;
  border: 1px dashed rgba(151, 186, 166, .28);
  border-radius: 12px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
}

.position, .trade, .decision, .asset-row {
  border-top: 1px solid var(--line);
  padding: 11px 0;
}
.position:first-child, .trade:first-child, .decision:first-child, .asset-row:first-child { border-top: 0; padding-top: 0; }
.row-main { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.symbol { font-family: "Geist Mono", monospace; font-weight: 650; letter-spacing: -.02em; font-size: 13px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; font-family: "Geist Mono", monospace; }
.reason { color: var(--soft); margin-top: 6px; line-height: 1.45; font-size: 12px; }
.reason.preview { max-width: 92ch; color: var(--muted); }
.trade-details {
  margin-top: 10px;
  border-top: 1px solid rgba(151, 186, 166, .12);
  padding-top: 9px;
}
.trade-details summary {
  cursor: pointer;
  width: fit-content;
  color: var(--soft);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  list-style-position: inside;
}
.trade-details summary:hover { color: var(--green); }
.trade-explain {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 10px;
}
.trade-explain .label { margin-bottom: 6px; }
.trade-explain ul { margin: 8px 0 0; padding-left: 18px; color: var(--soft); }
.trade-explain li { margin-top: 6px; }
.operator-note {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid rgba(127, 217, 154, .42);
  color: var(--muted);
  background: rgba(127, 217, 154, .035);
  font-size: 12px;
  font-family: "Geist Mono", monospace;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-family: "Geist Mono", monospace; font-size: 10px; color: var(--soft); border: 1px solid var(--line); padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.022); }

.trade-list, .decision-list { display: grid; gap: 0; }
.trade.closed { opacity: .94; }
.trade.open { background: rgba(127, 217, 154, .025); margin: 0 -15px; padding-left: 15px; padding-right: 15px; }

.market-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.asset-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; font-family: "Geist Mono", monospace; font-size: 12px; }
.bar { height: 3px; background: rgba(151, 186, 166, .14); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); transform-origin: left; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  padding-top: 22px;
}

@media (max-width: 1050px) {
  .equity-deck { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .split, .lower { grid-template-columns: 1fr; }
  .trade-explain { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .shell { width: min(100vw - 20px, 1480px); padding-top: 18px; }
  .topbar { grid-template-columns: 1fr; align-items: start; }
  .equity-deck { grid-template-columns: 1fr; }
  .equity-main, .equity-rail-wrap { padding: 18px; }
  .summary-grid { grid-template-columns: 1fr; }
  .row-main { display: grid; gap: 8px; }
  .trade-explain { grid-template-columns: 1fr; }
  .market-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
}
