/* Palette shared with the landing page: pure black ground, translucent
   white surfaces, jade/violet accents. Numbers stay in IBM Plex Mono for
   tabular figures; Outfit carries the UI chrome, as on the landing. */
:root {
  --ink:     #000000;
  --panel:   #0D0F13;                      /* solid fills: inputs, avatars */
  --surface: rgba(255, 255, 255, 0.045);   /* translucent card surfaces */
  --rule:    rgba(255, 255, 255, 0.10);
  --text:    #F2F4F8;
  --muted:   #8A90A0;
  --up:      #3ECF8E;
  --down:    #FF6B85;
  --sol:     #9B7BFF;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

.mono, .big, .sub, td, th, input, .eyebrow, .tab, .btn, .metric-v, .metric-k {
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- header */

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  z-index: 10;
  flex-wrap: wrap;
}

.mark {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sol);
  display: inline-block;
}

.entry { display: flex; gap: 8px; flex: 1; min-width: 260px; max-width: 620px; }

input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--sol); }
input[type="text"]::placeholder { color: var(--muted); }

.btn {
  background: var(--sol);
  color: #14101F;
  border: 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.45; cursor: progress; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--sol);
  color: var(--sol);
}
.btn.ghost:hover { background: rgba(155, 123, 255, 0.12); filter: none; }
.btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--sol); outline-offset: 2px; }

.status {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.status.err { color: var(--down); white-space: normal; }

/* ----------------------------------------------------------------- shell */

.shell { display: flex; min-height: 100vh; align-items: stretch; }

/* Slim icon rail. Tooltips need overflow visible — nav is short, no scroll. */
.sidebar {
  width: 58px;
  flex-shrink: 0;
  border-right: 1px solid var(--rule);
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: visible;
  background: var(--ink);
  z-index: 20;
}
.mark-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 6px;
}
/* Cropped to the artwork bounds inside logo.png's padded square canvas. */
.mark-img {
  display: block;
  width: 40px;
  height: 19.3px;
  background-image: url("/static/logo.png");
  background-size: 43px 43px;
  background-position: -1.23px -9.47px;
  background-repeat: no-repeat;
}
.mark-mini:hover { opacity: 0.82; }
.nav { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nav-item {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { color: var(--text); background: rgba(155, 123, 255, 0.06); }
.nav-item.is-on { color: var(--text); background: rgba(155, 123, 255, 0.14); }
.nav-item::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--panel);
  border: 1px solid var(--rule);
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s;
  z-index: 30;
}
.nav-item:hover::after, .nav-item:focus-visible::after { opacity: 1; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}

.content main { padding: 24px; max-width: none; margin: 0; width: 100%; }
.view > section:first-child, .view > .wallethead:first-child { padding-top: 0; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: static;
    border-right: 0; border-bottom: 1px solid var(--rule);
    flex-direction: row; align-items: center; gap: 12px;
    padding: 8px 14px;
  }
  .sidebar .nav { flex-direction: row; }
  .nav-item::after { display: none; }
}

/* ------------------------------------------------------------------ hero */

.hero {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 32px;
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--rule);
}

.figures { display: flex; flex-direction: column; gap: 22px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.big {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.figure.shadow .big { font-size: 28px; color: var(--muted); }
.figure.shadow .big.pos, .figure.shadow .big.neg { opacity: 0.75; }

.big.pos { color: var(--up); }
.big.neg { color: var(--down); }

.sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.chart { margin: 0; }
#chart svg { display: block; width: 100%; height: 190px; }

/* --------------------------------------------------------------- metrics */

.strip { padding: 22px 0; border-bottom: 1px solid var(--rule); }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 20px 8px;
}

.metric-k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric-v {
  font-family: var(--mono);
  font-size: 19px;
  margin-top: 4px;
}
.metric-v.pos { color: var(--up); }
.metric-v.neg { color: var(--down); }

/* ----------------------------------------------------------------- spine */

.spine-wrap { padding: 24px 0; border-bottom: 1px solid var(--rule); }

.spine {
  display: flex;
  height: 34px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel);
}
.spine div {
  position: relative;
  min-width: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: #0C0E12;
  font-weight: 600;
}

.spinekey {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.spinekey span { display: flex; align-items: center; gap: 6px; }
.spinekey i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ----------------------------------------------------------------- table */

.tabs { display: flex; gap: 6px; padding: 20px 0 12px; align-items: center; }
.grow { flex: 1; }

.tab {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 5px;
  cursor: pointer;
}
.tab.is-on { color: var(--text); border-color: var(--sol); }

/* The sort control is a native <select> wearing the .tab skin. Give it a
   custom caret and force field colours so options stay readable on dark. */
select.tab {
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 12px center, right 7px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.tab:hover { border-color: var(--sol); }
select.tab option { background: var(--panel); color: var(--text); }

.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ledger { width: 100%; border-collapse: collapse; min-width: 560px; }
.ledger th:first-child, .ledger td:first-child { width: 34%; min-width: 150px; }
.ledger th:nth-child(2), .ledger th:nth-child(3),
.ledger th:nth-child(4) { width: 110px; }
.ledger th:nth-child(5) { width: 70px; }

.ledger th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
}
.ledger td {
  font-family: var(--mono);
  font-size: 13px;
  padding: 14px 10px;
  white-space: nowrap;
}
/* Zebra rows instead of rule lines between trades. */
.ledger tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.03); }
.ledger tbody tr:hover { background: rgba(155, 123, 255, 0.07); }
.ledger td.buy { color: var(--up); }
.ledger td.sell { color: var(--down); }
.l { text-align: left; }
.r { text-align: right; }
td.r { text-align: right; }

.tok { display: flex; align-items: center; gap: 10px; }
.tok img, .tok .ph {
  width: 52px; height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel);
  flex-shrink: 0;
}
.tok .ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted);
}
.tok b { font-weight: 500; }
.tok-name {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
  margin-left: 7px;
}
.tok small { display: block; color: var(--muted); font-size: 11px; }

.pos { color: var(--up); }
.neg { color: var(--down); }
.qty { color: var(--muted); font-size: 11px; display: block; }
.qty.pos { color: var(--up); opacity: 0.65; }
.qty.neg { color: var(--down); opacity: 0.65; }
.tok small { white-space: normal; }

.flag {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  color: var(--muted);
  margin-right: 4px;
}
.flag.open { border-color: var(--sol); color: var(--sol); }
.flag.wtag { border-style: dashed; }

/* ------------------------------------------------- saved wallets & groups */

.wselect { position: relative; display: flex; flex: 1; gap: 6px; min-width: 0; }
.wselect input { flex: 1; }
.wpanel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 10px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.wpanel[hidden] { display: none; }
.wplist { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; }
.wrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
}
.wrow:hover { background: rgba(155, 123, 255, 0.08); }
.wp-head { display: flex; gap: 6px; }
.wtoggle {
  flex-shrink: 0;
  width: 30px;
  height: 16px;
  border-radius: 9px;
  background: var(--rule);
  position: relative;
  transition: background 0.12s;
}
.wtoggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.12s, background 0.12s;
}
.wtoggle.is-on { background: var(--sol); }
.wtoggle.is-on::after { transform: translateX(14px); background: #14101F; }
.wmain { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.wrow b { font-weight: 500; }
.wrow small { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 8px; }
.wrow.wgrp b { color: var(--sol); }
.wdel {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 3px;
}
.wdel:hover { color: var(--down); }
.wp-form { display: flex; gap: 6px; border-top: 1px solid var(--rule); padding-top: 10px; }
.wp-form input {
  flex: 1;
  min-width: 0;
  background: var(--ink);
  border: 1px solid var(--rule);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 3px;
  outline: none;
}
.wp-form input:focus { border-color: var(--sol); }

/* Notes cell: flags on the left, the per-trade hide toggle pinned right. */
.notes-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.notes-cell .flags {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
tr.is-hidden { opacity: 0.45; }

/* ------------------------------------------------------------ wallet head */

.wallethead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 28px 0 4px;
}
.idcard { display: flex; align-items: center; gap: 16px; min-width: 0; }
.avatar {
  width: 72px; height: 72px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--panel);
  flex-shrink: 0;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.idmeta { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.idname { display: flex; align-items: center; gap: 10px; }
.waddr-short { font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.agebadge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 20px;
  padding: 2px 10px;
}
.idfull { display: flex; align-items: center; gap: 8px; min-width: 0; }
.waddr-full {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copybtn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.copybtn:hover { border-color: var(--sol); color: var(--text); }
.idactions { display: flex; gap: 8px; }
.idactions .tab { text-decoration: none; padding: 4px 11px; }

.networth { text-align: right; min-width: 200px; margin-left: auto; }
.networth .big { font-size: 40px; line-height: 1.05; }
.spark { margin-top: 8px; height: 44px; }
.spark svg { width: 100%; height: 44px; display: block; }

@media (max-width: 640px) {
  .wallethead { gap: 16px; }
  .networth { text-align: left; min-width: 0; }
  .networth .big { font-size: 32px; }
  .spark svg { width: 220px; max-width: 100%; }
}

/* ------------------------------------------------------------- performance */

.perf-strip { padding: 4px 0 8px; }

.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 20px 0;
}
.chartbox svg { width: 100%; height: 150px; display: block; }
@media (max-width: 860px) { .duo { grid-template-columns: 1fr; } }
.panel {
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px;
  background: var(--surface);
}
.panel-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.32);
}
.tile-k {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.tile-v {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.tile-sub { font-size: 12px; font-weight: 400; opacity: 0.85; }

.dist { margin-top: 18px; }
.dist-labels {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.dl { display: flex; flex-direction: column; gap: 3px; }
.dl-k { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dl-n { font-family: var(--mono); font-size: 15px; color: var(--muted); }
.dist-bar {
  display: flex;
  height: 4px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--rule);
}

/* ----------------------------------------------------------------- calendar */

.cal-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 16px;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
}
.cal-total { font-family: var(--mono); font-size: 15px; color: var(--muted); }
.cal-total.pos { color: var(--up); }
.cal-total.neg { color: var(--down); }
.calbtn {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--muted);
  border-radius: 3px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.calbtn:hover { border-color: var(--sol); color: var(--text); }

/* The calendar view fills the screen; the grid stretches to whatever is
   left. :not([hidden]) so display:flex cannot defeat the hidden attribute. */
.view[data-view="calendar"]:not([hidden]) {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 140px);
}

/* Continuous grid: 1px gaps over the rule colour read as sharp gridlines.
   Always 6 week rows (42 day cells) so every month has the same shape. */
.cal {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: auto repeat(6, minmax(84px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.cal-dow {
  background: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 10px;
}
.cal-cell {
  background: var(--ink);
  min-height: 0;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
}
.cal-cell.in { cursor: pointer; }
/* Out-of-month days: dimmed prev/next month day numbers, blending in. */
.cal-cell.out { background: var(--ink); }
.cal-cell.out .cal-d { opacity: 0.35; }
.cal-d { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.cal-cell.pos .cal-d, .cal-cell.neg .cal-d { color: var(--text); }
.cal-body { display: flex; flex-direction: column; gap: 2px; }
.cal-v { font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--text); }
.cal-n { font-family: var(--mono); font-size: 11px; color: rgba(228, 231, 239, 0.62); }
.cal-sum {
  background: var(--ink);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-sum-v { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.cal-sum.pos .cal-sum-v { color: var(--up); }
.cal-sum.neg .cal-sum-v { color: var(--down); }
.cal-sum-n { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.cal-usd { font-family: var(--mono); font-size: 11px; opacity: 0.7; }

/* -------------------------------------------------------------- patterns */

.pat-head { margin-bottom: 18px; }
.pat-head .panel-title { display: flex; align-items: center; gap: 10px; }
.propill {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--sol);
  border: 1px solid var(--sol);
  border-radius: 3px;
  padding: 2px 7px;
}
.patlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.patcard {
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: 3px;
  background: var(--surface);
  padding: 14px 16px;
}
.patcard.edge { border-left-color: var(--up); }
.patcard.leak { border-left-color: var(--down); }
.pat-dim {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.pat-title { font-size: 15px; font-weight: 600; margin: 6px 0 8px; }
.pat-detail { font-family: var(--mono); font-size: 12px; }
.patcard.edge .pat-detail { color: var(--up); }
.patcard.leak .pat-detail { color: var(--down); }
.pat-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
}

/* --------------------------------------------------------------- journal */

.journal {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - 140px);
}
.jlist {
  overflow-y: auto;
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}
.jcard {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: 3px;
  padding: 14px 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.jcard:hover { border-color: var(--sol); }
.jcard.is-on { border-color: var(--sol); background: rgba(155, 123, 255, 0.08); }
.jd { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.jpnl { font-family: var(--mono); font-size: 21px; font-weight: 500; margin: 6px 0 10px; }
.jpnl.pos { color: var(--up); }
.jpnl.neg { color: var(--down); }
.jstats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
}
.js {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.js b { font-weight: 500; color: var(--text); }
.jnote-prev {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
/* Solid editor — the app backdrop does not bleed through it. */
.jeditor {
  border: 1px solid var(--rule);
  background: #0B0D11;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 130px);
  overflow: hidden;
}
.jtoolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.jtoolbar button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 5px;
  color: var(--muted); cursor: pointer; font-size: 14px;
}
.jtoolbar button:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.jtoolbar button svg { width: 16px; height: 16px; }
.jt-sep { width: 1px; height: 20px; background: var(--rule); margin: 0 6px; }

.jscroll { flex: 1; overflow-y: auto; padding: 22px 24px; }
.jdate { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; }

.jbody {
  position: relative;
  min-height: 200px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  outline: none;
}
.jbody.is-empty::before {
  content: attr(data-ph);
  position: absolute;
  color: var(--muted);
  opacity: 0.55;
  pointer-events: none;
}
.jbody:not([contenteditable="true"]) { opacity: 0.5; }
.jbody h3 { font-size: 17px; font-weight: 600; margin: 14px 0 6px; }
.jbody ul, .jbody ol { padding-left: 22px; margin: 8px 0; }
.jbody hr { border: 0; border-top: 1px solid var(--rule); margin: 16px 0; }
.jbody a { color: var(--sol); }

.jimgbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 16px; border-top: 1px solid var(--rule);
}
.jimg { position: relative; width: 88px; height: 68px; }
.jimg img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--rule);
}
.jimg-x {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--rule);
  color: var(--text); cursor: pointer; font-size: 13px; line-height: 1;
}
.jimg-x:hover { border-color: var(--down); color: var(--down); }
.jaddimg {
  width: 88px; height: 68px;
  border: 1px dashed rgba(255,255,255,0.28); border-radius: 6px;
  background: transparent; color: var(--sol); cursor: pointer;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.jaddimg:hover { border-color: var(--sol); background: rgba(155,123,255,0.06); }

.jfoot { padding: 8px 16px; border-top: 1px solid var(--rule); min-height: 15px; }
.jsaved { font-family: var(--mono); font-size: 11px; color: var(--muted); }

@media (max-width: 860px) {
  .journal { grid-template-columns: 1fr; }
  .jlist { max-height: 340px; }
}
.cal-note {
  margin-top: auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}



@media (max-width: 620px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cal { font-size: 9px; grid-template-rows: auto repeat(6, minmax(52px, 1fr)); }
  .cal-cell { padding: 5px 6px; }
  .cal-v, .cal-sum-v { font-size: 11px; }
  .cal-n, .cal-sum-n, .cal-usd, .cal-note { display: none; }
}

/* ----------------------------------------------------------------- empty */

.empty { padding: 96px 24px; text-align: center; }
.lead { font-size: 16px; color: var(--text); margin: 0 0 10px; }
.fine {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.7;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .big { font-size: 34px; }
  .content main { padding: 16px; }
  .topbar { padding: 12px 16px; gap: 12px; }
  .ledger { min-width: 560px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .spinekey { font-size: 10px; gap: 4px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 6px;
}

.tablewrap { max-width: 100%; overflow: hidden; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }

.ledger {
  table-layout: fixed;
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}
.ledger th, .ledger td { overflow: hidden; }

.ledger th:nth-child(1), .ledger td:nth-child(1) { width: auto; min-width: 0; }
.ledger th:nth-child(2), .ledger td:nth-child(2) { width: 96px; }
.ledger th:nth-child(3), .ledger td:nth-child(3) { width: 96px; }
.ledger th:nth-child(4), .ledger td:nth-child(4) { width: 96px; }
.ledger th:nth-child(5), .ledger td:nth-child(5) { width: 58px; }
.ledger th:nth-child(6), .ledger td:nth-child(6) { width: 150px; }

.tok { min-width: 0; }
.tok > div { min-width: 0; overflow: hidden; }
.tok b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tok small { white-space: nowrap; }

.ledger td .qty { white-space: nowrap; }
.ledger td:nth-child(6) { white-space: normal; }

@media (max-width: 700px) {
  .ledger { min-width: 520px; }
}

/* -------------------------------------------------------- sharp lines pass */
/* Tight, crisp radii across the app to match the reference's sharp grid. */

.panel, .tile, .btn, .tab, .copybtn, .hidebtn, .flag,
input[type="text"], select.tab, .spine, .avatar, .agebadge {
  border-radius: 3px;
}
.panel { background: var(--surface); }

/* ------------------------------------------- journal: landing-page theme */
/* Glass panels on the journal, plus one app-wide silk backdrop below. */

/* Content rides above the app backdrop. */
.shell { position: relative; z-index: 1; }

/* Solid journal cards (no glass) so the backdrop does not show through. */
.jcard { border-radius: 10px; padding: 16px 18px; background: #0B0D11; }
.jcard:hover { border-color: rgba(255, 255, 255, 0.22); }
.jcard.is-on {
  border-color: rgba(155, 123, 255, 0.55);
  background: rgba(155, 123, 255, 0.09);
}

@media (prefers-reduced-motion: reduce) {
  .asilk { animation: none !important; }
}

/* Hide the chunky native scrollbar on the journal day list. It still
   scrolls; the card cropped at the bottom edge is affordance enough, and
   the default bar clashes badly with the glass panels. */
.jlist {
  scrollbar-width: none;      /* Firefox */
  -ms-overflow-style: none;   /* legacy Edge */
}
.jlist::-webkit-scrollbar { width: 0; height: 0; }

/* ------------------------------------------------- app silk backdrop */
/* Green and monotone only. Fixed behind every view, drifting slowly.
   z-index 0 (never -1) or it would paint behind body's own background. */

.appbg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: var(--ink);
}
.asilk {
  position: absolute;
  display: block;
  width: 160%;
  left: -30%;
  border-radius: 50%;
  will-change: transform;
}
.a1 {
  top: -10%; height: 40%;
  filter: blur(70px);
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255, 255, 255, 0.13), transparent 66%);
  animation: adrift1 44s ease-in-out infinite alternate;
}
.a2 {
  top: 28%; height: 44%;
  filter: blur(78px);
  background: radial-gradient(ellipse at 50% 50%,
    rgba(62, 207, 142, 0.17), transparent 64%);
  animation: adrift2 58s ease-in-out infinite alternate;
}
.a3 {
  top: 62%; height: 42%;
  filter: blur(84px);
  background: radial-gradient(ellipse at 50% 50%,
    rgba(62, 207, 142, 0.10), transparent 68%);
  animation: adrift3 50s ease-in-out infinite alternate;
}
@keyframes adrift1 {
  from { transform: translate3d(-6%, 0, 0) rotate(-7deg); }
  to   { transform: translate3d(6%, 5%, 0) rotate(-1deg); }
}
@keyframes adrift2 {
  from { transform: translate3d(5%, 3%, 0) rotate(5deg); }
  to   { transform: translate3d(-7%, -4%, 0) rotate(0deg); }
}
@keyframes adrift3 {
  from { transform: translate3d(-5%, 4%, 0) rotate(-5deg); }
  to   { transform: translate3d(7%, -3%, 0) rotate(-11deg); }
}


/* ---------------------------------------------------------- day detail */
/* Opens over the calendar rather than replacing it, so the month stays in
   view behind and Escape returns you to exactly where you were. */

.daymodal { position: fixed; inset: 0; z-index: 60; display: flex;
            align-items: flex-start; justify-content: center; padding: 4vh 20px; }
.daymodal[hidden] { display: none; }
.dm-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72);
               backdrop-filter: blur(3px); }

.dm-panel {
  position: relative;
  width: min(1040px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: #07090C;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10),
              0 40px 120px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.dm-head {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.dm-when { flex: 1; min-width: 200px; }
.dm-when h2 { margin: 6px 0 0; font-size: 22px; font-weight: 600;
              letter-spacing: -0.02em; }
.dm-figure { text-align: right; }
.dm-figure .big { font-size: 30px; }
.dm-head .calbtn { flex-shrink: 0; font-size: 18px; }

.dm-body { overflow-y: auto; padding: 22px 24px 28px; display: flex;
           flex-direction: column; gap: 22px; }
.dm-body .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.dm-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dm-section { display: flex; flex-direction: column; gap: 10px; }
.dm-table { min-width: 480px; }
.dm-table td, .dm-table th { padding: 10px; }

#dm-note {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  padding: 14px;
  resize: vertical;
  outline: none;
}
#dm-note:focus { border-color: var(--sol); }
.dm-foot { min-height: 16px; }

@media (max-width: 760px) {
  .daymodal { padding: 0; }
  .dm-panel { max-height: 100vh; border-radius: 0; border: 0; }
  .dm-charts { grid-template-columns: 1fr; }
  .dm-figure { text-align: left; }
}


/* ------------------------------------------------------ chart scrubbing */
/* Overlay lives in pixel space over the chart, not inside the SVG: the
   curves stretch horizontally (preserveAspectRatio="none"), which would
   distort any shape drawn in viewBox coordinates. */

#chart, #dm-curve, #dm-bars { position: relative; }
#dm-bars rect { transition: opacity 0.08s; }

.cx-line, .cx-dot, .cx-tip {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.09s;
}
.cx-line {
  width: 0;
  border-left: 1px dashed rgba(255, 255, 255, 0.38);
}
.cx-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.6);
}
.cx-tip {
  transform: translateX(-50%);
  background: rgba(13, 15, 19, 0.96);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cx-tip b { font-weight: 500; font-size: 14px; }
.cx-tip .cx-usd { color: var(--muted); }
.cx-tip .cx-when { color: var(--muted); font-size: 11px; }

.dm-sechead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dm-sechead .panel-title { margin-bottom: 0; }
.dm-table td:first-child { white-space: normal; }


/* ------------------------------------------------------ share PnL card */
.iconbtn {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 22px;
  background: transparent; border: 1px solid var(--rule);
  border-radius: 4px; color: var(--muted); cursor: pointer;
  flex-shrink: 0; padding: 0;
}
.iconbtn svg { width: 13px; height: 13px; }
.iconbtn:hover { border-color: var(--sol); color: var(--text); }
.notes-actions { display: flex; gap: 4px; flex-shrink: 0; }

.sharemodal { position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.sharemodal[hidden] { display: none; }
.sm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.74);
  backdrop-filter: blur(3px); }
.sm-panel { position: relative; width: min(680px, 100%);
  display: flex; flex-direction: column; gap: 16px; }
.sm-canvaswrap {
  border: 1px solid var(--rule); border-radius: 14px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,0.7);
}
#sharecanvas { display: block; width: 100%; height: auto; }
.sm-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }


/* ----------------------------------------------------- Pattern finder gate */
.patcard.locked { position: relative; overflow: hidden; }
.pat-blur {
  filter: blur(6px);
  opacity: 0.7;
  user-select: none;
  pointer-events: none;
}
.pat-blur .pat-title { font-size: 15px; font-weight: 600; margin: 6px 0 8px; }
.pat-blur .pat-detail { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pat-blur .pat-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 8px; }
.pat-locktag {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.5); border: 1px solid var(--rule); color: var(--sol);
}
.pat-locktag svg { width: 13px; height: 13px; }

.pat-upsell {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
  padding: 18px 22px; border-radius: 12px;
  border: 1px solid rgba(155,123,255,0.4);
  background:
    linear-gradient(100deg, rgba(62,207,142,0.10), rgba(155,123,255,0.14) 70%),
    #0B0D11;
}
.pat-upsell-txt { display: flex; flex-direction: column; gap: 3px; }
.pat-upsell-txt b { font-size: 15px; font-weight: 600; }
.pat-upsell-txt span { font-size: 13px; color: var(--muted); }
.pat-upsell .btn {
  background: linear-gradient(100deg, #3ECF8E, #5AD9C4 45%, #9B7BFF);
  color: #07120D; white-space: nowrap;
}

/* ------------------------------------------------------- TrenchSync+ modal */
.plusmodal { position: fixed; inset: 0; z-index: 75;
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.plusmodal[hidden] { display: none; }
.pm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.74);
  backdrop-filter: blur(4px); }
.pm-panel {
  position: relative; width: min(460px, 100%);
  border: 1px solid rgba(155,123,255,0.4); border-radius: 16px;
  padding: 30px 30px 24px;
  background: linear-gradient(160deg, rgba(155,123,255,0.10), transparent 55%), #0A0C10;
  box-shadow: 0 40px 120px rgba(0,0,0,0.7);
}
.pm-badge {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; padding: 4px 12px; border-radius: 999px; color: #07120D;
  background: linear-gradient(100deg, #3ECF8E, #5AD9C4 45%, #9B7BFF);
  margin-bottom: 16px;
}
.pm-h { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
.pm-lede { font-size: 14px; color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.pm-list { list-style: none; margin: 0 0 22px; padding: 0;
  display: flex; flex-direction: column; gap: 11px; }
.pm-list li { position: relative; padding-left: 26px; font-size: 14px; line-height: 1.45; }
.pm-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--up); font-weight: 700;
}
.pm-actions { display: flex; gap: 10px; align-items: center; }
.pm-actions .btn {
  background: linear-gradient(100deg, #3ECF8E, #5AD9C4 45%, #9B7BFF); color: #07120D;
}
.pm-fine { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 16px; }
