/* Layout: one centred column, sticky header with tabs; dense tables in scroll boxes. */
:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #14202b; --muted: #5b6875; --line: #dde3e9;
  --accent: #1f6f8b; --up: #137a4b; --down: #b3261e; --warn: #9a6200;
  --s1: #1f6f8b; --s2: #c2571a; --s3: #6b7785;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --panel: #161e26; --ink: #e4eaf0; --muted: #94a2b0; --line: #26313c;
    --accent: #5cb3d1; --up: #4cc38a; --down: #f2756b; --warn: #e0a84a;
    --s1: #5cb3d1; --s2: #f0955a; --s3: #8d99a6;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
h1 { font-size: 1.6rem; font-weight: 600; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 1.6rem 0 .6rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding-block: 1.5rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.bar { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1180px; margin: 0 auto; display: flex; gap: 1.25rem; align-items: center; padding-block: .6rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.tabs { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.tabs a { color: var(--muted); text-decoration: none; padding: .3rem .6rem; border-radius: 6px; font-size: .92rem; }
.tabs a[aria-current="page"] { color: var(--ink); background: var(--bg); font-weight: 600; }
.tabs a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: .3rem .4rem; }
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; font: inherit; font-weight: 600; padding: .65rem 1.4rem; cursor: pointer; }

.signin { max-width: 34rem; margin: 12vh auto 0; display: grid; gap: 1rem; justify-items: start; }
.signin p { margin: 0; }

.head { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.head p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.cards.wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; min-width: 0; }
.panel { margin-top: 1rem; }
.panel-head { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.card .k { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; color: var(--muted); font-size: .85rem; }
.card .v { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; margin: .2rem 0; }
.card .row { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .row b { color: var(--ink); font-weight: 600; }
.card p { margin: .5rem 0 0; }
.swatch { display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin-right: .35rem; vertical-align: baseline; }
.up { color: var(--up); } .down { color: var(--down); }
.chip { display: inline-block; font-size: .75rem; border: 1px solid currentColor; border-radius: 999px; padding: 0 .5rem; line-height: 1.5; white-space: nowrap; color: var(--muted); }
.chip.buy, .chip.hold, .chip.filled, .chip.target { color: var(--up); }
.chip.sell, .chip.rejected, .chip.halted, .chip.stop, .chip.stop_gap { color: var(--down); }
.chip.pending, .chip.time, .chip.skipped, .chip.cancelled { color: var(--warn); }

.chart { position: relative; min-height: 260px; margin-top: .75rem; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ref { stroke: var(--muted); stroke-dasharray: 4 4; }
.chart .tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: .8rem; box-shadow: 0 4px 16px rgb(0 0 0 / .12); white-space: nowrap; }
.empty { color: var(--muted); padding: 2rem 1rem; text-align: center; }

.tablebox { overflow: auto; max-height: 34rem; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.tablebox.tall { max-height: 44rem; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th { position: sticky; top: 0; background: var(--panel); text-align: left; color: var(--muted); font-weight: 600; padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.sym { font-weight: 600; white-space: nowrap; }
td.txt { min-width: 18rem; line-height: 1.45; }
table.wide { min-width: 72rem; }

.pick { color: var(--muted); font-size: .9rem; display: flex; gap: .4rem; align-items: center; }
select, input[type="search"] { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.filters input { flex: 1 1 14rem; max-width: 24rem; min-width: 0; }
.summary { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); margin-top: .5rem; }
.summary .card p { line-height: 1.55; }
.error { color: var(--down); }
.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.foot .wrap { padding-block: 1rem; }
[hidden] { display: none !important; }
