:root {
  --bg: #0d1117;
  --card: #161b22;
  --line: #232a33;
  --line2: #2b333d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --pos: #3fb950;
  --neg: #f85149;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  display: flex;
  justify-content: center;
  padding: 12px;
  padding: max(12px, env(safe-area-inset-top)) 12px calc(24px + env(safe-area-inset-bottom));
}

/* mobile-first: full-width card; widens on desktop */
.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 16px;
}

h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.note { margin-top: 18px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* login / sent */
form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
input {
  width: 100%; padding: 13px 14px; background: #0d1117; border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 16px;
}
input:focus { outline: none; border-color: var(--accent); }
button {
  padding: 13px 16px; border: none; border-radius: 10px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px;
}
button:disabled { opacity: 0.6; cursor: default; }
button.link { background: none; color: var(--accent); padding: 6px 2px; font-weight: 500; min-height: 0; }
.error { color: var(--neg); margin-top: 12px; font-size: 14px; }

/* ---- statement header / hero -------------------------------------------- */
.who-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero {
  display: grid; grid-template-columns: 1fr; gap: 10px; margin: 14px 0 6px;
}
.hero-block {
  background: #0f141b; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.hero-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-value { font-size: 30px; font-weight: 700; letter-spacing: -0.5px; margin-top: 4px;
  font-variant-numeric: tabular-nums; }
.hero-value.sm { font-size: 24px; }
.hero-pct { font-size: 16px; font-weight: 600; margin-left: 4px; }
.asof { margin-top: 2px; }

/* ---- tabs --------------------------------------------------------------- */
.tabs {
  display: flex; gap: 6px; margin: 16px 0 14px; background: #0f141b;
  border: 1px solid var(--line); border-radius: 12px; padding: 4px;
  position: sticky; top: 0; z-index: 5;
}
.tab {
  flex: 1; background: none; color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 10px 8px; border-radius: 9px; min-height: 40px;
}
.tab.is-active { background: var(--accent); color: #fff; }
.tabpane { display: none; }
.tabpane.is-active { display: block; }

/* ---- overview rows ------------------------------------------------------ */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; padding: 11px 0; border-top: 1px solid var(--line); gap: 12px; }
.row span { color: var(--muted); }
.row b { font-variant-numeric: tabular-nums; text-align: right; }
.row.total { border-top: 2px solid var(--line2); margin-top: 4px; font-size: 16px; }
.row.total span { color: var(--text); }

.section-h {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  margin: 22px 0 10px; font-weight: 600; display: flex; justify-content: space-between; align-items: baseline;
}
.section-h .sort-btn { font-size: 12px; text-transform: none; letter-spacing: 0; }

/* ---- strategy summary cards --------------------------------------------- */
.strat-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.strat-card { background: #0f141b; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.strat-name { font-weight: 600; }
.strat-total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.strat-sub { margin-top: 2px; }

.mini-rows { display: flex; gap: 8px; margin-bottom: 8px; }
.mini { flex: 1; background: #0f141b; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.mini span { display: block; color: var(--muted); font-size: 12px; }
.mini b { font-size: 16px; font-variant-numeric: tabular-nums; }
.mini.total { border-color: var(--line2); }

/* ---- transaction / trade cards (mobile-first) --------------------------- */
.tx-list { display: flex; flex-direction: column; gap: 8px; }
.tx { border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #0f141b; }
.tx.opening { border-style: dashed; }
.tx-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tx-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-pct { font-size: 12px; font-weight: 600; opacity: 0.85; margin-left: 3px; }
.tx-meta { margin-top: 4px; word-break: break-word; }
.tx-when {
  display: flex; justify-content: space-between; gap: 10px; margin-top: 4px;
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tx-when > span:first-child::first-letter { text-transform: none; }
.sym { font-weight: 600; }
.side { font-size: 11px; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.side.long { background: rgba(63,185,80,0.16); color: var(--pos); }
.side.short { background: rgba(248,81,73,0.16); color: var(--neg); }
.empty { padding: 6px 2px; }

/* type + strategy chips */
.ttype { display: flex; align-items: center; gap: 6px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: #21262d; color: var(--text); }
.tag-trade { background: rgba(47,129,247,0.18); color: #6cb0ff; }
.tag-sleeve { background: rgba(163,113,247,0.18); color: #b890ff; }
.tag-deposit { background: rgba(63,185,80,0.18); color: var(--pos); }
.tag-withdrawal, .tag-fee { background: rgba(248,81,73,0.16); color: var(--neg); }
.tag-open { background: rgba(139,148,158,0.18); color: var(--muted); }
.tag-adjustment { background: rgba(210,153,34,0.18); color: #e3b341; }
.tag-funding { background: rgba(57,197,187,0.16); color: #4dd4c6; }

/* headline P&L window selector + Pool/My-share mode pill */
.winrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.winbtn { background: #161b26; border: 1px solid var(--line2); color: var(--muted);
  border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; }
.winbtn.on { background: rgba(47,129,247,0.18); border-color: #2f81f7; color: #6cb0ff; }
.tiny { font-size: 11px; margin-top: 5px; }
.mode-pill { display: inline-flex; border: 1px solid var(--line2); border-radius: 999px;
  overflow: hidden; margin-bottom: 12px; }
.mode-pill button { background: transparent; border: 0; color: var(--muted);
  padding: 7px 16px; font-size: 13px; cursor: pointer; min-height: 34px; }
.mode-pill button.on { background: rgba(47,129,247,0.18); color: #6cb0ff; font-weight: 600; }
.tx.dim { opacity: 0.55; }
.sym .chip { margin-left: 8px; }
.chip { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line2); color: var(--muted); }
.chip-trend { color: #6cb0ff; border-color: rgba(47,129,247,0.4); }
.chip-sleeve { color: #b890ff; border-color: rgba(163,113,247,0.4); }

/* ---- date filter -------------------------------------------------------- */
.txn-filter { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.txn-filter label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.txn-filter input[type="date"] { width: auto; padding: 9px; font-size: 14px; border-radius: 8px; color-scheme: dark; min-height: 40px; }
.txn-filter button { padding: 9px 14px; font-size: 13px; min-height: 40px; }
.txn-filter button.link { padding: 9px 2px; }

/* ---- desktop enhancements ----------------------------------------------- */
@media (min-width: 620px) {
  body { align-items: center; padding: 24px; }
  .card { max-width: 760px; padding: 30px 30px; }
  .hero { grid-template-columns: 1.4fr 1fr; }
  .hero-value { font-size: 34px; }
  .strat-cards { grid-template-columns: 1fr 1fr; }
}
