/* satxl — mobile-first, light and dark. */
:root {
  --bg: #fbfaf7; --surface: #ffffff; --ink: #1c1a17; --muted: #6b665e; --line: #e7e2d9;
  --accent: #d9730d; --accent-ink: #ffffff; --pos: #1f7a4a; --neg: #b3261e; --stale-bg: #fff1d6; --stale-ink: #7a4b00;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --surface: #1b1a18; --ink: #efebe4; --muted: #a39d93; --line: #2e2b27;
    --accent: #f28c28; --accent-ink: #1b1206; --pos: #5cc48d; --neg: #f2847b; --stale-bg: #3a2a0c; --stale-ink: #ffcf7a;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --surface: #1b1a18; --ink: #efebe4; --muted: #a39d93; --line: #2e2b27;
  --accent: #f28c28; --accent-ink: #1b1206; --pos: #5cc48d; --neg: #f2847b; --stale-bg: #3a2a0c; --stale-ink: #ffcf7a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
main, .top, footer { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 1.2rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
small, .muted { color: var(--muted); }
.num, .big, .stat dd, [data-field] { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.2rem; padding-top: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span { color: var(--accent); }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.btc { margin: 0 0 0 auto; font-weight: 600; }
.btc small { font-weight: 400; margin-left: .3rem; }

.hero p { color: var(--muted); max-width: 60ch; margin-top: 0; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.stale { background: var(--stale-bg); color: var(--stale-ink); border-radius: 4px; padding: 0 .35em; font-size: .78em; font-family: var(--sans); }
.pos { color: var(--pos); } .neg { color: var(--neg); }

/* Watchlist: cards on phones, a table from 720px. */
.watch { width: 100%; border-collapse: collapse; }
.watch thead { display: none; }
.watch tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; margin-bottom: .7rem; }
.watch th[scope="row"] { display: block; text-align: left; font-size: 1.05rem; padding-bottom: .3rem; }
.watch td { display: flex; justify-content: space-between; gap: 1rem; padding: .15rem 0; }
.watch td::before { content: attr(data-label); color: var(--muted); font-family: var(--sans); }
.watch .strong { font-weight: 700; }
@media (min-width: 720px) {
  .watch thead { display: table-header-group; }
  .watch tr { display: table-row; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .watch th, .watch td { display: table-cell; padding: .6rem .5rem; text-align: left; white-space: nowrap; }
  .watch td::before { content: none; }
  .watch thead th { font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); font-family: var(--sans); }
  .watch .num { text-align: right; }
  .watch th[scope="row"] { padding-bottom: .6rem; }
}

.ticker header h1 { margin-bottom: .2rem; }
.big { font-size: 2.2rem; font-weight: 700; margin: .2rem 0; }
.big small { font-size: .95rem; font-family: var(--sans); font-weight: 400; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: .7rem; margin: 1rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; margin: 0; }
.stat dt { color: var(--muted); font-size: .85rem; }
.stat dd { margin: .15rem 0 0; font-size: 1.3rem; font-weight: 700; }
.stat .hint { margin: .2rem 0 0; color: var(--muted); font-size: .8rem; }

.trades { list-style: none; padding: 0; margin: 0; }
.trades li { display: flex; flex-wrap: wrap; gap: .3rem .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.trades time { color: var(--muted); font-family: var(--mono); font-size: .9rem; min-width: 6.5rem; }
.trades span { font-family: var(--mono); flex: 1; }
.trades .sell span { color: var(--neg); }

.buttons { display: flex; flex-wrap: wrap; gap: .6rem; }
.button, button { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: .6rem 1rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
button.secondary, .button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.prose { max-width: 70ch; }
.formulas dt { font-weight: 600; margin-top: .6rem; }
.formulas dd { margin: 0; font-family: var(--mono); font-size: .92rem; overflow-wrap: anywhere; }
table.sources, table.pf { width: 100%; border-collapse: collapse; }
table.sources td, table.sources th, table.pf td, table.pf th { text-align: left; padding: .4rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Portfolio */
.pf-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin: 1rem 0; }
.pf-form label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); }
input, select { font: inherit; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); min-width: 0; }
.pf-wrap { overflow-x: auto; }
.msg { border-radius: var(--radius); padding: .6rem .8rem; background: var(--stale-bg); color: var(--stale-ink); }

footer { margin-top: 3rem; padding-top: 1rem; padding-bottom: 2rem; border-top: 1px solid var(--line); font-size: .9rem; }
footer p { margin: .3rem 0; }
table.pf input { width: 5.5rem; }
