/* Visual language follows exchange.papertrade.xyz (cream page, 8px panels on a 3px grid,
   11px uppercase panel titles, dense 10.5px tables). Values were read from its computed styles. */
:root {
  --ink: rgb(42, 37, 32); --ink-2: rgb(79, 71, 61); --ink-muted: rgb(122, 112, 96); --ink-label: rgb(117, 108, 97); --ink-faint: rgb(153, 140, 118);
  --page: rgb(237, 229, 208); --panel: rgb(244, 236, 216); --raised: rgb(250, 246, 237); --sunken: #e8dec8;
  --border: rgb(212, 203, 186); --row: rgba(212, 203, 186, .4); --row-head: rgba(212, 203, 186, .7);
  --pos: rgb(45, 95, 58); --neg: rgb(139, 32, 32); --warm: rgb(122, 98, 53);
  --hover: rgba(42, 37, 32, .06); --active: rgba(42, 37, 32, .08);
  --sans: Inter, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 13px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font-family: var(--sans); }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 20px; border-bottom: 1px solid var(--border); background: var(--page); }
.brand { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.views { display: flex; gap: 2px; margin-left: 14px; }
.views a { font-size: 12px; font-weight: 500; color: var(--ink-muted); padding: 2px 12px 4px; border-bottom: 2px solid transparent; }
.views a:hover { color: var(--ink); }
.views a.on { font-weight: 600; color: var(--ink); border-bottom-color: var(--ink); }
[hidden] { display: none !important; }
.updated { margin-left: auto; font-size: 10px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-faint); }

/* panels */
.board { display: grid; gap: 3px; padding: 3px; max-width: 1600px; margin: 0 auto; }
.panel { background: var(--panel); border-radius: 8px; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
h2 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .65px; text-transform: uppercase; }
.sub { font-size: 10px; font-weight: 500; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-faint); }

/* overview */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1040px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-right: 1px solid var(--row); border-bottom: 1px solid var(--row); min-width: 0; }
.kpi span { font-size: 11px; font-weight: 500; color: var(--ink-label); }
.kpi b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* history */
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart { margin: 0; padding: 10px 14px 6px; border-right: 1px solid var(--row); border-bottom: 1px solid var(--row); min-width: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.chart figcaption span { font-size: 11px; font-weight: 500; color: var(--ink-label); }
.chart figcaption b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart svg { display: block; max-width: 100%; }
.chart .grid { stroke: var(--row); stroke-width: 1; }
.chart .tick { font-size: 9.5px; fill: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--pos); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .dot { fill: var(--pos); stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.charts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart .line2 { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .mark { fill: var(--neg); stroke: var(--panel); stroke-width: 2; }
.chart .pt { fill: var(--pos); }
@media (max-width: 1040px) { .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .charts { grid-template-columns: minmax(0, 1fr); } }

/* controls */
.controls { row-gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { all: unset; cursor: pointer; font-size: 11px; font-weight: 600; padding: 4px 10px; color: var(--ink-muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button.on { background: var(--active); color: var(--pos); }
.minpaper { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--ink-label); white-space: nowrap; }
.minpaper select { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
#q { width: 240px; max-width: 100%; font-size: 12px; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; outline: none; }
#q::placeholder { color: var(--ink-faint); }
#q:focus { border-color: var(--ink-muted); }
.hint { margin-left: auto; white-space: nowrap; }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 4px 14px; text-align: left; white-space: nowrap; }
th { height: 26px; font-size: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-muted); border-bottom: 1px solid var(--row-head); }
td { height: 25px; font-size: 10.5px; border-bottom: 1px solid var(--row); }
tbody tr:hover td { background: var(--hover); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-weight: 700; }
td.rank { font-weight: 500; color: var(--ink-faint); }
tbody tr:nth-child(-n+3) td.rank { color: var(--warm); font-weight: 700; }
th button { all: unset; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
th button:hover { color: var(--ink); }
th button.on { color: var(--ink); }
th button.on::after { content: " ↓"; }
th button.on.asc::after { content: " ↑"; }
.addr a { font-weight: 500; font-variant-numeric: tabular-nums; }
.addr a:hover, .ent a:hover { text-decoration: underline; }
.name { margin-left: 8px; font-weight: 600; color: var(--ink-2); }
.name.hl { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); background: var(--active); border-radius: 4px; padding: 2px 6px; }
.ent { font-weight: 600; }
.ent a { cursor: pointer; }
.ent .n { margin-left: 8px; font-weight: 500; color: var(--ink-faint); }
.dim { color: var(--ink-faint); font-weight: 500 !important; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
td.num a.tx { border-bottom: 1px dotted var(--ink-faint); }
td.num a.tx:hover { color: var(--ink); border-bottom-style: solid; }
.empty { margin: 0; padding: 28px 0; text-align: center; color: var(--ink-faint); font-size: 11px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 0 12px; font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.pager button { all: unset; cursor: pointer; padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--raised); color: var(--ink); }
.pager button:hover { background: var(--hover); }
.pager button:disabled { cursor: default; color: var(--ink-faint); background: transparent; }

.foot { padding: 10px 16px 14px; font-size: 11px; line-height: 1.8; color: var(--ink-label); }
.foot a { border-bottom: 1px dotted var(--ink-faint); }
.foot a:hover { color: var(--ink); }
.foot code { font-size: 10.5px; }

/* Columns: 1 # · 2 wallet · 3 balance · 4 paper · 5 share · 6 trade pnl · 7 net pnl · 8 $/paper · 9 rewards
   · 10 deposited · 11 withdrawn · 12 deposits · 13 largest · 14 first · 15 last */
@media (max-width: 1500px) {
  th:nth-child(13), td:nth-child(13), th:nth-child(14), td:nth-child(14) { display: none; }
}
@media (max-width: 1240px) {
  th:nth-child(11), td:nth-child(11), th:nth-child(12), td:nth-child(12) { display: none; }
}
@media (max-width: 1040px) {
  th:nth-child(10), td:nth-child(10), th:nth-child(15), td:nth-child(15) { display: none; }
}
@media (max-width: 860px) {
  th:nth-child(9), td:nth-child(9), th:nth-child(6), td:nth-child(6) { display: none; }
  .hint { display: none; }
}
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-right: 1px solid var(--row); border-bottom: 1px solid var(--row); min-width: 0; }
.kpi span { font-size: 11px; font-weight: 500; color: var(--ink-label); }
.kpi b { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* history */
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chart { margin: 0; padding: 10px 14px 6px; border-right: 1px solid var(--row); border-bottom: 1px solid var(--row); min-width: 0; }
.chart figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.chart figcaption span { font-size: 11px; font-weight: 500; color: var(--ink-label); }
.chart figcaption b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart svg { display: block; max-width: 100%; }
.chart .grid { stroke: var(--row); stroke-width: 1; }
.chart .tick { font-size: 9.5px; fill: var(--ink-faint); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--pos); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .cross { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .dot { fill: var(--pos); stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.charts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart .line2 { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .mark { fill: var(--neg); stroke: var(--panel); stroke-width: 2; }
.chart .pt { fill: var(--pos); }
@media (max-width: 1040px) { .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .charts { grid-template-columns: minmax(0, 1fr); } }

/* controls */
.controls { row-gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { all: unset; cursor: pointer; font-size: 11px; font-weight: 600; padding: 4px 10px; color: var(--ink-muted); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button.on { background: var(--active); color: var(--pos); }
.minpaper { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--ink-label); white-space: nowrap; }
.minpaper select { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
#q { width: 240px; max-width: 100%; font-size: 12px; color: var(--ink); background: var(--raised); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; outline: none; }
#q::placeholder { color: var(--ink-faint); }
#q:focus { border-color: var(--ink-muted); }
.hint { margin-left: auto; white-space: nowrap; }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 4px 14px; text-align: left; white-space: nowrap; }
th { height: 26px; font-size: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-muted); border-bottom: 1px solid var(--row-head); }
td { height: 25px; font-size: 10.5px; border-bottom: 1px solid var(--row); }
tbody tr:hover td { background: var(--hover); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { font-weight: 700; }
td.rank { font-weight: 500; color: var(--ink-faint); }
tbody tr:nth-child(-n+3) td.rank { color: var(--warm); font-weight: 700; }
th button { all: unset; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
th button:hover { color: var(--ink); }
th button.on { color: var(--ink); }
th button.on::after { content: " ↓"; }
th button.on.asc::after { content: " ↑"; }
.addr a { font-weight: 500; font-variant-numeric: tabular-nums; }
.addr a:hover, .ent a:hover { text-decoration: underline; }
.name { margin-left: 8px; font-weight: 600; color: var(--ink-2); }
.name.hl { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--ink-muted); background: var(--active); border-radius: 4px; padding: 2px 6px; }
.ent { font-weight: 600; }
.ent a { cursor: pointer; }
.ent .n { margin-left: 8px; font-weight: 500; color: var(--ink-faint); }
.dim { color: var(--ink-faint); font-weight: 500 !important; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }
td.num a.tx { border-bottom: 1px dotted var(--ink-faint); }
td.num a.tx:hover { color: var(--ink); border-bottom-style: solid; }
.empty { margin: 0; padding: 28px 0; text-align: center; color: var(--ink-faint); font-size: 11px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 0 12px; font-size: 11px; font-weight: 600; color: var(--ink-muted); }
.pager button { all: unset; cursor: pointer; padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--raised); color: var(--ink); }
.pager button:hover { background: var(--hover); }
.pager button:disabled { cursor: default; color: var(--ink-faint); background: transparent; }

.foot { padding: 10px 16px 14px; font-size: 11px; line-height: 1.8; color: var(--ink-label); }
.foot a { border-bottom: 1px dotted var(--ink-faint); }
.foot a:hover { color: var(--ink); }
.foot code { font-size: 10.5px; }

/* Columns: 1 # · 2 wallet · 3 balance · 4 paper · 5 share · 6 pnl · 7 $/paper · 8 rewards
   · 9 deposited · 10 withdrawn · 11 deposits · 12 largest · 13 first · 14 last */
@media (max-width: 1500px) {
  th:nth-child(12), td:nth-child(12), th:nth-child(13), td:nth-child(13) { display: none; }
}
@media (max-width: 1240px) {
  th:nth-child(10), td:nth-child(10), th:nth-child(11), td:nth-child(11) { display: none; }
}
@media (max-width: 1040px) {
  th:nth-child(9), td:nth-child(9), th:nth-child(14), td:nth-child(14) { display: none; }
}
@media (max-width: 860px) {
  th:nth-child(8), td:nth-child(8), th:nth-child(6), td:nth-child(6) { display: none; }
  .hint { display: none; }
}
@media (max-width: 720px) {
  .top { padding: 0 12px; }
  .views { margin-left: 4px; }
  .views a { padding: 2px 8px 4px; }
    .panel-head { padding: 10px 12px 8px; }
  #q { width: 100%; }
  th, td { padding: 4px 8px; }
  th:nth-child(n+6), td:nth-child(n+6), th:nth-child(3), td:nth-child(3) { display: none; }
  .name { display: block; margin: 2px 0 0; }
  .name.hl { display: inline-block; }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 14px; }
}
