/* netdesk: a price app, read on a phone first.
   One family (Barlow, self-hosted, SIL OFL), five sizes. Green and red only mean up and down. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/fonts/barlow-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-latin-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/fonts/barlow-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-latin-700.woff2") format("woff2"); }
:root {
  --bg: #0d1012;
  --surface: #14181b;
  --raise: #1b2024;
  --line: #242b30;
  --text: #e9edef;
  --muted: #8f999f;
  --up: #3ddc84;
  --up-bg: rgba(61, 220, 132, 0.12);
  --down: #ff6b6b;
  --warn: #f2b84b;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* The type scale. Nothing else is allowed. */
  --t1: 12px;   /* labels, captions */
  --t2: 14px;   /* secondary text */
  --t3: 16px;   /* names, body */
  --t4: 20px;   /* headings */
  --t5: 32px;   /* the one big number on a page */
  --r: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--t3)/1.4 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
a { color: inherit; text-decoration: none; }
p a, .note a, footer a { text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
strong { font-weight: 600; }
small { font-size: var(--t1); color: var(--muted); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: var(--t4); line-height: 1.25; }
h2 { font-size: var(--t3); margin: 28px 0 10px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

/* Header: brand on top; tabs at the bottom of the screen on a phone, in the header on a desktop. */
/* No backdrop-filter on the header: it would pin the fixed tab bar inside the header. */
header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.topin { max-width: 760px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--t3); }
.brand img { border-radius: 6px; display: block; }
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(20, 24, 27, 0.96); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a { text-align: center; padding: 12px 4px 14px; font-size: var(--t1); font-weight: 500; color: var(--muted); }
nav.tabs a.on { color: var(--text); box-shadow: inset 0 2px 0 var(--up); }
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  nav.tabs { position: static; display: flex; gap: 4px; background: none; border: 0; padding: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
  nav.tabs a { padding: 6px 12px; font-size: var(--t2); border-radius: 8px; }
  nav.tabs a.on { box-shadow: none; background: var(--raise); }
  nav.tabs a:hover { color: var(--text); }
}

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 32px; }
main.wide { max-width: 1680px; }
.lede { margin: 0 0 18px; }
.lede h1 { margin-bottom: 6px; }
p.sub { color: var(--muted); font-size: var(--t2); margin: 0 0 16px; }
p.sub strong { color: var(--text); }
p.crumb { font-size: var(--t1); color: var(--muted); margin: 0 0 8px; }
p.crumb a { text-decoration: none; }
p.note { color: var(--muted); font-size: var(--t1); line-height: 1.5; margin: 14px 0 0; }
p.empty { color: var(--muted); font-size: var(--t2); }
p.stale { background: var(--warn); color: #15120a; border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; font-size: var(--t2); font-weight: 600; }
p.private { color: var(--warn); border: 1px solid rgba(242,184,75,.35); border-radius: 10px; padding: 8px 12px; margin: 0 0 14px; font-size: var(--t2); }
p.snap { color: var(--warn); }
code { font: inherit; background: var(--raise); padding: 1px 5px; border-radius: 4px; }

/* Market cards (one per peer group) */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 600px) { .cards { grid-template-columns: repeat(3, 1fr); } }
a.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
a.card:hover { border-color: #39434a; }
.card .cl { font-size: var(--t2); font-weight: 500; }
.card .cbig { font-size: var(--t4); font-weight: 600; margin: 6px 0 2px; }
.card .cs { font-size: var(--t1); color: var(--muted); }
.card .cm { font-size: var(--t1); color: var(--muted); margin-top: 10px; }

/* Rows: the one list shape on every page. Name left, number right, detail under it. */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--raise); }
.row .nm { font-size: var(--t3); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .mt { font-size: var(--t1); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pr { font-size: var(--t3); font-weight: 600; text-align: right; white-space: nowrap; }
.row .ch { font-size: var(--t1); font-weight: 500; text-align: right; white-space: nowrap; }
.row .ft { grid-column: 1 / -1; margin-top: 8px; }
.row .ft.txt { font-size: var(--t1); color: var(--muted); margin-top: 4px; }
.row.win { background: var(--up-bg); }
.row.win .pr { color: var(--up); }
.list .none { padding: 14px; color: var(--muted); font-size: var(--t2); }
.list .sec { padding: 10px 14px 6px; font-size: var(--t1); font-weight: 500; color: var(--muted); background: var(--bg); border-top: 1px solid var(--line); }
.list .sec:first-child { border-top: 0; }

/* The 30-day range: low on the left, high on the right, a dot where the price is now. */
.rng { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; align-items: center; gap: 10px; font-size: var(--t1); color: var(--muted); }
.rng .bar { position: relative; height: 4px; border-radius: 2px; background: linear-gradient(90deg, rgba(255,107,107,.45), #2c353b 50%, rgba(61,220,132,.45)); }
.rng .mk { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg); }
.mk.p0 { left: 0%; } .mk.p1 { left: 5%; } .mk.p2 { left: 10%; } .mk.p3 { left: 15%; } .mk.p4 { left: 20%; }
.mk.p5 { left: 25%; } .mk.p6 { left: 30%; } .mk.p7 { left: 35%; } .mk.p8 { left: 40%; } .mk.p9 { left: 45%; }
.mk.p10 { left: 50%; } .mk.p11 { left: 55%; } .mk.p12 { left: 60%; } .mk.p13 { left: 65%; } .mk.p14 { left: 70%; }
.mk.p15 { left: 75%; } .mk.p16 { left: 80%; } .mk.p17 { left: 85%; } .mk.p18 { left: 90%; } .mk.p19 { left: 95%; } .mk.p20 { left: 100%; }
.rng sup { font-size: 10px; }

/* Item page */
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.hero .lbl { font-size: var(--t1); color: var(--muted); }
.hero .big { font-size: var(--t5); font-weight: 600; line-height: 1.1; margin: 4px 0; letter-spacing: -0.5px; }
.hero .chg { font-size: var(--t2); font-weight: 600; }
.hero .chg span { font-weight: 400; color: var(--muted); }
.hero .rng { margin-top: 16px; }
.hero .where { font-size: var(--t1); color: var(--muted); margin-top: 8px; }
.stats { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; font-size: var(--t2); }
.stats th, .stats td { padding: 10px 12px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.stats thead th { border-top: 0; font-size: var(--t1); font-weight: 500; color: var(--muted); }
.stats th:first-child, .stats td:first-child { text-align: left; }
.stats tbody th { font-weight: 500; }
.stats td.m { color: var(--muted); }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; font-size: var(--t2); color: var(--muted); padding: 6px 0; }
details.more .list { margin-top: 6px; }

/* Answer card (best cash-out) */
.answer { background: var(--up-bg); border: 1px solid rgba(61,220,132,.3); border-radius: var(--r); padding: 14px 16px; margin: 0 0 12px; }
.answer .lbl { font-size: var(--t1); color: var(--muted); }
.answer .big { font-size: var(--t5); font-weight: 600; color: var(--up); line-height: 1.1; margin: 4px 0; letter-spacing: -0.5px; }
.answer .small { font-size: var(--t2); color: var(--muted); }

/* Portfolio */
.pf-total { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 0 0 12px; }
.pf-total .lbl { font-size: var(--t1); color: var(--muted); }
.pf-total .val { font-size: var(--t5); font-weight: 600; line-height: 1.1; margin: 4px 0; letter-spacing: -0.5px; }
.pf-total .chg { font-size: var(--t2); font-weight: 600; }
.pf-total .sm { font-size: var(--t1); color: var(--muted); margin-top: 8px; }
.pf-actions { display: flex; gap: 8px; margin: 0 0 12px; }

/* Forms and buttons */
form.myskins, form.cashout { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
form label { font-size: var(--t2); font-weight: 500; }
textarea { width: 100%; min-height: 150px; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 400 var(--t3)/1.45 var(--font); }
textarea::placeholder { color: #5f696f; }
textarea:focus { outline: 2px solid #3a6ea8; outline-offset: -1px; border-color: transparent; }
button, a.btn { display: inline-block; align-self: flex-start; background: var(--up); color: #0b1a10; border: 0; border-radius: 10px; padding: 10px 16px; font: 600 var(--t2) var(--font); cursor: pointer; text-decoration: none; }
button.ghost, a.btn.ghost { background: var(--raise); color: var(--text); border: 1px solid var(--line); font-weight: 500; }
#result:empty { display: none; }
#result { margin: 0 0 20px; }

/* Sites & fees */
.sitecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin: 0 0 10px; }
.sitecard h2 { margin: 0 0 8px; }
.sitecard dl { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; margin: 0 0 8px; font-size: var(--t2); }
.sitecard dt { color: var(--muted); }
.sitecard dd { margin: 0; }
.sitecard p { color: var(--muted); font-size: var(--t2); margin: 6px 0 0; }
.sitecard .srcs { font-size: var(--t1); word-break: break-all; }
.tag { display: inline-block; font-size: var(--t1); font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }
.tag.ok { color: var(--up); border-color: rgba(61,220,132,.35); }
.tag.bad { color: var(--warn); border-color: rgba(242,184,75,.35); }
.flagtext { color: var(--warn); }
details.report { margin-top: 8px; }
details.report summary { cursor: pointer; color: var(--muted); font-size: var(--t2); }
details.report form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
details.report textarea { min-height: 80px; }

/* Wide tables (private live board only) */
.tablewrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table.board { border-collapse: collapse; width: 100%; font-size: var(--t2); }
table.board th, table.board td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.board th.item { text-align: left; font-weight: 500; }
table.board thead th { border-top: 0; font-size: var(--t1); font-weight: 500; color: var(--muted); }
table.board td.win { color: var(--up); background: var(--up-bg); font-weight: 600; }
.strip { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; font-size: var(--t1); color: var(--muted); }
.feed.bad { color: var(--warn); }

footer { max-width: 760px; margin: 0 auto; padding: 8px 16px 24px; }
footer p { color: var(--muted); font-size: var(--t1); line-height: 1.5; margin: 0 0 8px; }
