/* xprhub.com loan tracker (2026-11-07). The hub's palette and type, copied from the burn tracker (burns/burns.css) so
   this page stands on its own. Cards: now, all time (one card per market), liquidations, activity (compact table on
   desktop, two-line blocks on phones, 25 / 50 / 100 per page with Back and Forward). */
:root {
  --bg: #0d0a17; --panel: #17112a; --panel-2: #120d22; --ink: #f6f4ff; --muted: #a9a0c9; --line: #2e2350;
  --gold: #9b7bff; --purple: #7543e3; --bad: #ff8f8f; --good: #8ff0b4;
  --head: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 85% -10%, rgba(117, 67, 227, .28), transparent 60%), var(--bg);
  color: var(--ink); font: 16px/1.55 var(--text); min-height: 100vh; overflow-x: hidden;
  display: flex; flex-direction: column;
}
[hidden] { display: none !important; }
/* the header, tools row and footer are the shared ones in /site.css */
main { width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 20px 40px; flex: 1; }

.intro h1 { font: 800 clamp(30px, 5vw, 44px)/1.1 var(--head); margin: 0 0 14px; letter-spacing: -.03em; }
.intro p { margin: 0 0 10px; max-width: 68ch; color: var(--muted); font-size: 17px; }
.intro p:first-of-type { color: var(--ink); }
.plain { color: var(--muted); max-width: 72ch; }
.small { font-size: 14px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 14px; }

h2 { font: 700 18px var(--head); margin: 0; letter-spacing: -.01em; }
.amt { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.usd { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.usd.none { font-style: italic; }
.link { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }

.pbtn { font: 600 14px var(--head); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; cursor: pointer; }
.pbtn:hover:not(:disabled) { border-color: var(--gold); }
.pbtn:disabled { opacity: .4; cursor: default; }
.pbtn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.pbtn.primary:hover { background: #8455f0; border-color: #8455f0; }
select, input { font: 500 14px var(--text); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; }
select { margin-left: 8px; padding: 5px 8px; }
.pbtn:focus-visible, select:focus-visible, input:focus-visible, .link:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ---- which account ---- */
.who { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin: 22px 0 6px; padding: 14px 18px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; }
.who-line { margin: 0; overflow-wrap: anywhere; }
.who-line .pbtn { margin-right: 4px; }
.lookup { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.lookup-row { display: flex; gap: 8px; }
.lookup input { width: 11.5em; }

.status { margin: 18px 0 14px; font: 600 14px var(--head); color: var(--muted); letter-spacing: .02em; }
.status.bad { color: var(--bad); }

/* ---- cards ---- */
.card { background: linear-gradient(180deg, #1e1636, var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px 16px; margin: 0 0 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.per { color: var(--muted); font-size: 14px; }
.note { margin: 12px 0 0; max-width: 90ch; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.stat dt { color: var(--muted); font-size: 13px; }
.stat dd { margin: 2px 0 0; }
.stat .big { display: block; font: 800 22px/1.25 var(--head); letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .big.pos { color: var(--good); }
.stat .big.neg { color: var(--bad); }
/* interest earned: one line per token earned (owner 2026-11-08: tokens, not dollars) */
.stat .big.tok { font-size: 17px; }
.stat .usd { display: block; }
.bar { display: block; height: 7px; margin: 6px 0 4px; border-radius: 99px; background: #2a2045; overflow: hidden; }
.bar .fill { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; }
.bar.hot .fill { background: var(--bad); }

/* ---- tables ---- */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list thead th { font: 600 13px var(--head); color: var(--gold); letter-spacing: .03em; text-align: left; padding: 8px 10px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list .num { text-align: right; }
table.list td { padding: 6px 10px; border-top: 1px solid rgba(46, 35, 80, .7); vertical-align: baseline; }
table.list tbody tr:first-child td { border-top: 0; }
table.list tbody tr:hover td { background: rgba(155, 123, 255, .06); }
table.list td.msg { color: var(--muted); padding: 16px 10px; }
table.list td .amt { font-weight: 800; color: #fff; }
table.list td.num .amt, table.list td.num .usd { display: block; }
table.pos td.c-col { color: var(--muted); }
table.liq td.c-when, table.recent td.r-time { color: var(--muted); white-space: nowrap; font-size: 13px; }
table.list td.c-who, table.recent td.r-act { overflow-wrap: anywhere; }
table.recent td.r-amt .amt { display: inline; }
.liq-sum { margin: 0 0 12px; max-width: 80ch; }
.more { margin-top: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }

/* ---- one small card per market (the coin and its LOAN not claimed yet); a click opens the full stats in a pop-up ---- */
.markets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mk-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; width: 100%; text-align: left; cursor: pointer;
  font: 500 14px/1.35 var(--text); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.mk-tile:hover { border-color: var(--gold); }
.mk-tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.mk-claim { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* the pop-up: a native <dialog> sheet, the same look as the /talks pop-ups */
dialog.sheet {
  width: 560px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px); margin: auto; padding: 0;
  color: var(--ink); background: linear-gradient(180deg, #1e1636, var(--panel)); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .6); overflow: auto; overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(8, 6, 16, .74); backdrop-filter: blur(3px); }
body:has(dialog.sheet[open]) { overflow: hidden; } /* the page behind does not scroll */
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px 12px; background: #1e1636; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sheet-close { flex: none; font: 700 14px var(--head); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 7px 14px; cursor: pointer; }
.sheet-close:hover { border-color: var(--gold); }
.sheet-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.mk-body { padding: 14px 22px 22px; min-width: 0; }
.mk-body .mk { background: transparent; border: 0; padding: 0; }
.mk-body .mk-head { display: none; } /* the dialog title already names the coin and market */
.mk { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 10px; min-width: 0; }
.mk-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.mk h4 { font: 700 13px var(--head); color: var(--gold); letter-spacing: .03em; margin: 10px 0 2px; }
.lines { margin: 0; }
.ln { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 3px 0; border-top: 1px solid rgba(46, 35, 80, .6); font-size: 14px; }
.ln:first-child { border-top: 0; }
.ln dt { color: var(--muted); }
.ln dd { margin: 0; margin-left: auto; text-align: right; min-width: 0; }
.ln dd .usd { margin-left: 8px; }

/* ---- where your LOAN went: a year picker and the CSV button in the head, two columns of plain lines ---- */
.flow-head { align-items: flex-start; }
.flow-tools { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.flow-status { margin: 4px 0 10px; }
.flow-status:empty { display: none; }
.flow-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 28px; }
.flow-col { min-width: 0; }
.flow-col h4 { font: 700 13px var(--head); color: var(--gold); letter-spacing: .03em; margin: 0 0 2px; }
.flow-held { margin-top: 14px; padding-top: 8px; border-top: 1px solid var(--line); }
.ln dd .flow-sub { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 760px) { .flow-cols { grid-template-columns: minmax(0, 1fr); } }

/* token chips, as on the burn tracker */
.tok-chip { display: inline-block; min-width: 58px; text-align: center; padding: 2px 10px; border-radius: 999px; font: 800 12.5px var(--head); letter-spacing: .03em; color: #fff; background: rgba(117, 67, 227, .28); border: 1px solid rgba(155, 123, 255, .55); }
.tok-chip[data-tok="XPR"] { background: rgba(117, 67, 227, .45); border-color: #9b7bff; }
.tok-chip[data-tok="LOAN"] { background: rgba(245, 158, 11, .22); border-color: rgba(245, 158, 11, .7); color: #ffd58a; }
.tok-chip[data-tok="XMD"] { background: rgba(45, 212, 191, .18); border-color: rgba(45, 212, 191, .65); color: #9ff3e6; }
.tok-chip[data-tok="XUSDT"], .tok-chip[data-tok="XUSDC"] { background: rgba(34, 197, 94, .18); border-color: rgba(34, 197, 94, .6); color: #a7f3c2; }
.tok-chip[data-tok="XBTC"] { background: rgba(247, 147, 26, .2); border-color: rgba(247, 147, 26, .7); color: #ffc98a; }
.tok-chip[data-tok="XETH"] { background: rgba(140, 158, 255, .2); border-color: rgba(140, 158, 255, .65); color: #ccd5ff; }

/* ---- phones: each table row becomes a small block ---- */
@media (max-width: 760px) {
  .card { padding: 14px 14px 12px; }
  table.list, table.list tbody { display: block; }
  table.list thead { display: none; }
  table.list tr { display: grid; gap: 1px 12px; padding: 8px 0; border-top: 1px solid rgba(46, 35, 80, .7); }
  table.list tbody tr:first-child { border-top: 0; }
  table.list td { display: block; padding: 0; border: 0; min-width: 0; }
  table.list td.msg { grid-column: 1 / -1; padding: 10px 0; }

  table.pos tr { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "mkt col" "sup sup" "bor bor"; }
  table.pos td.c-mkt { grid-area: mkt; }
  table.pos td.c-col { grid-area: col; text-align: right; font-size: 13px; }
  table.pos td.c-sup { grid-area: sup; }
  table.pos td.c-bor { grid-area: bor; }
  table.pos td.c-sup::before { content: "Supplied"; float: left; color: var(--muted); font-size: 13px; }
  table.pos td.c-bor::before { content: "Borrowed"; float: left; color: var(--muted); font-size: 13px; }

  table.liq tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "when tx" "take debt" "who who"; }
  table.liq td.c-when { grid-area: when; }
  table.liq td.c-tx { grid-area: tx; text-align: right; }
  table.liq td.c-take { grid-area: take; text-align: left; }
  table.liq td.c-debt { grid-area: debt; }
  table.liq td.c-take::before { content: "Taken"; display: block; color: var(--muted); font-size: 12px; }
  table.liq td.c-debt::before { content: "Debt repaid"; display: block; color: var(--muted); font-size: 12px; }
  table.liq td.c-who { grid-area: who; font-size: 13px; }
  table.liq td.c-who::before { content: "by "; color: var(--muted); }

  table.recent tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "tok act amt" "when when tx"; align-items: baseline; padding: 6px 0; }
  table.recent td.r-tok { grid-area: tok; }
  table.recent td.r-act { grid-area: act; font-size: 14px; }
  table.recent td.r-amt { grid-area: amt; }
  table.recent td.r-time { grid-area: when; font-size: 12px; white-space: normal; }
  table.recent td.r-tx { grid-area: tx; text-align: right; font-size: 13px; }
}
@media (max-width: 520px) {
  main { padding-left: 16px; padding-right: 16px; }
  .intro h1 { font-size: 27px; }
  .intro p { font-size: 16px; }
  .who { padding: 12px 14px; }
  .lookup { width: 100%; }
  .lookup-row { width: 100%; }
  .lookup input { flex: 1; width: auto; min-width: 0; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stat { padding: 9px 12px; }
  .stat .big { font-size: 19px; }
  .markets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mk-tile { padding: 10px 12px; }
  dialog.sheet { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 14px; }
  .sheet-head { padding: 14px 16px 10px; }
  .mk-body { padding: 12px 16px 18px; }
}
