/* ===== tracker.css — Wallet Tracker page (tracker.html) + the watchlist hand-off card =====
 * Builds on styles.css tokens/utilities only; never redefines them. Dark UI, ≥4.5:1 text, 44px targets on phones,
 * reduced-motion safe, no horizontal overflow at 320px. */

.trk-wrap { max-width: 1160px; margin: 0 auto; min-width: 0; }
.trk-hero { max-width: 820px; }
.trk-h2 { color: var(--green-bright); font-size: max(var(--text-floor), 1.35rem); margin: 0 0 0.6rem; letter-spacing: 0.03em; }
.trk-h3 { font-family: 'Luckiest Guy', 'Rubik', cursive; font-weight: 400; color: var(--gold); font-size: max(var(--text-floor), 1.05rem); letter-spacing: 0.03em; margin: 0 0 0.2rem; }
.trk-opt { font-weight: 400; color: var(--text-dim); }

/* ---- signed-out explainer ---- */
.trk-signedout { max-width: 640px; margin: 0.6rem auto 0; }
.trk-so-list { list-style: none; margin: 0.4rem 0 0.6rem; padding: 0; display: grid; gap: 0.55rem; }
.trk-so-list li { display: flex; gap: 0.6rem; align-items: flex-start; line-height: 1.5; font-size: max(var(--text-floor), 0.95rem); color: var(--text-dim); }
.trk-so-list li > span[aria-hidden] { flex: 0 0 auto; font-size: max(var(--text-floor), 1.15rem); line-height: 1.3; }
.trk-so-list b { color: var(--text); }
.trk-signedout .btn { width: 100%; margin-top: 0.4rem; }
/* the signed-out address form: live, so the address typed here is tracked the moment the account is in */
.trk-so-form { border-top: 1px solid var(--ink-4); padding-top: 0.7rem; margin-top: 0.6rem; }
.trk-so-form .f-label { margin-top: 0; }
.trk-so-form .trk-so-btn { justify-self: stretch; }
.trk-hero-time { color: var(--text-dim); font-size: max(var(--text-floor), 0.92rem); }

/* ---- two-column layout (stacked below 900px) ---- */
.trk-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; margin-top: 0.6rem; min-width: 0; }
.trk-side, .trk-main { padding: 1.1rem 1rem 1.2rem; min-width: 0; position: static; }
.trk-side { background: linear-gradient(180deg, var(--ink-3), var(--ink-2)); border: 2px solid rgba(255,179,64,0.35); border-radius: 22px; box-shadow: 0 18px 40px rgba(0,0,0,0.45); }
.trk-main { background: linear-gradient(180deg, var(--ink-3), var(--ink-2)); border: 2px solid color-mix(in srgb, var(--green) 28%, transparent); border-radius: 22px; box-shadow: 0 18px 40px rgba(0,0,0,0.45); }
/* the wallet list lays itself out by its own width (a phone, or the desktop column), not the window's */
.trk-side { container: trkside / inline-size; }
@media (min-width: 900px) {
  .trk-layout { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: start; }   /* 360px at most: the report's tables are sized for a 732px column */
  .trk-side { position: sticky; top: calc(var(--nav-h, 58px) + 0.6rem); max-height: calc(100vh - var(--nav-h, 58px) - 1.2rem); overflow-y: auto; }
}

/* ---- wallet list ---- */
.trk-wstatus { margin: 0.2rem 0 0.5rem; }
/* the "Retry" button trackerpage.js renders bare — a light pill with black type, like every other control */
.trk-wstatus button { background: var(--ctl-fill); color: var(--ctl-ink); border: 0; border-radius: var(--r-pill); font: inherit; font-weight: 700; cursor: pointer; padding: 0.3rem 0.7rem; }
.trk-wstatus button:hover { background: var(--green); color: var(--on-green); }
.trk-wlist { list-style: none; margin: 0 0 0.9rem; padding: 0; display: grid; gap: 0.45rem; min-width: 0; }
.trk-empty { padding: 1rem 0.8rem; font-size: max(var(--text-floor), 0.9rem); }
.trk-w { display: flex; align-items: stretch; gap: 0.35rem; min-width: 0; background: var(--ink); border: 1.5px solid var(--ink-4); border-radius: 14px; padding: 0.3rem; transition: border-color 0.15s ease, background 0.15s ease; }
.trk-w:hover { border-color: var(--g-lit); }
.trk-w.is-selected { border-color: var(--green); background: var(--g-wash); box-shadow: inset 4px 0 0 0 var(--green); }
.trk-w-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.55rem; text-align: left; background: var(--ctl-fill-lo); border: none; color: var(--ctl-ink); font: inherit; cursor: pointer; padding: 0.35rem 0.5rem; border-radius: 10px; min-height: 44px; }
.trk-w-main:hover { background: var(--ctl-fill-hi); }
.trk-w.is-selected .trk-w-main { background: var(--green); color: var(--on-green); }
.trk-w-main:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 1px; }
.trk-w-ico { flex: 0 0 auto; font-size: max(var(--text-floor), 1.15rem); }
.trk-w-txt { display: flex; flex-direction: column; min-width: 0; gap: 0.1rem; flex: 1 1 auto; }
.trk-w-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.45rem; min-width: 0; }
.trk-w-top .trk-w-badge { flex: none; white-space: nowrap; }
.trk-w-label { font-weight: 800; font-size: max(var(--text-floor), 0.95rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-w-addr { font-size: max(var(--text-floor), 0.78rem); color: inherit; display: flex; align-items: center; gap: 0.4rem; min-width: 0; }   /* one line: the address shortens to fit (.addr-fit) */
.trk-w-addr code { font-family: ui-monospace, Menlo, monospace; }
.trk-w-badge { display: inline-block; font-size: max(var(--text-floor), 0.68rem); font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--on-diamond); background: var(--diamond); border: 1px solid var(--diamond); border-radius: 999px; padding: 0.05rem 0.45rem; }
.trk-w-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 0.25rem; }
.trk-w-btn { min-width: 36px; min-height: 36px; padding: 0.3rem 0.45rem; font-size: max(var(--text-floor), 0.85rem); }
.trk-w-rm.is-armed { background: var(--red); color: var(--on-red); font-size: max(var(--text-floor), 0.78rem); }
.trk-w-rm:hover { background: var(--red); color: var(--on-red); }
.trk-w-btn:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }
.trk-rename { flex: 1 1 100%; display: grid; gap: 0.4rem; padding: 0.3rem; min-width: 0; }
.trk-rename .addr-input { margin: 0; font-family: 'Rubik', system-ui, sans-serif; color: var(--text); padding: 0.6rem 0.8rem; }
.trk-rename-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.trk-rename-hint { color: var(--text-dim); font-size: max(var(--text-floor), 0.78rem); }

/* ---- quick-add chips ---- */
.trk-chips { margin: 0 0 0.9rem; }
.trk-chips-lbl { font-size: max(var(--text-floor), 0.78rem); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 0.35rem; }
.trk-chips-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.trk-chip { min-height: 40px; max-width: 100%; white-space: normal; text-align: left; line-height: 1.3; flex-wrap: wrap; justify-content: flex-start; gap: 0.2rem 0.4rem; }
.trk-chip code { font-family: ui-monospace, Menlo, monospace; font-size: max(var(--text-floor), 0.8em); }   /* .addr-fit: one line, shortened to fit */
.trk-chip:disabled { background: var(--ctl-fill-dis); border-color: var(--ctl-fill-dis); color: var(--ctl-ink); opacity: 1; cursor: default; }

/* ---- add form ---- */
.trk-add { border-top: 1px solid var(--ink-4); padding-top: 0.8rem; display: grid; gap: 0.1rem; }
.trk-add .addr-input { margin: 0 0 0.2rem; }
.trk-add .f-label { margin: 0.5rem 0 0.3rem; }
.trk-add-btn { margin-top: 0.6rem; justify-self: start; }
.trk-add-btn:disabled { cursor: not-allowed; transform: none !important; }   /* fill + ink come from .btn:disabled — no opacity wash over black type */
.trk-err { color: #ffb0b0; font-size: max(var(--text-floor), 0.85rem); font-weight: 700; margin: 0.15rem 0 0.25rem; line-height: 1.45; }
.trk-err::before { content: '⚠️ '; }
.addr-input[aria-invalid="true"] { border-color: var(--red); }

/* ---- report column ---- */
.trk-main-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.trk-main-head .trk-h2 { margin-bottom: 0.2rem; }
.trk-main-actions { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
/* the armed state of "Rebuild from scratch" (two taps): the colour is the second signal — the words change too */
.trk-rebuild.is-armed { background: var(--red); color: var(--on-red); border-color: var(--red); }
.trk-note { margin: 0.2rem 0 0.6rem; color: var(--gold); font-weight: 600; }
.trk-selected { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.2rem 0 0.6rem; font-size: max(var(--text-floor), 0.9rem); min-width: 0; }
.trk-sel-lbl { font-weight: 800; color: var(--gold); }
.trk-sel-addr { font-family: ui-monospace, Menlo, monospace; font-size: max(var(--text-floor), 0.78rem); color: var(--text-dim); word-break: break-all; }
/* drawn as head + tail (trackerpage.js fitInner): one line, as much as fits, then …, then its last 4 */
#trk-selected .trk-sel-addr { display: inline-flex; max-width: 100%; min-width: 0; vertical-align: bottom; white-space: nowrap; word-break: normal; overflow-wrap: normal; }
#trk-selected .trk-sel-addr .addr-head { min-width: 7ch; overflow: hidden; text-overflow: ellipsis; }
#trk-selected .trk-sel-addr .addr-tail { flex: none; }
.trk-sel-link { font-size: max(var(--text-floor), 0.82rem); font-weight: 700; text-decoration: none; }
.trk-sel-link:hover { text-decoration: underline; }
/* the saved-history line ("history read 2h ago · to block N · partial") takes its own row under the address */
.trk-sel-read { flex-basis: 100%; font-size: max(var(--text-floor), 0.8rem); font-weight: 600; color: var(--text-dim); line-height: 1.45; overflow-wrap: anywhere; }
.trk-banner { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; font-size: max(var(--text-floor), 0.85rem); font-weight: 600; line-height: 1.5; border-radius: 12px; padding: 0.5rem 0.8rem; margin: 0 0 0.5rem; border: 1px solid var(--ink-4); background: var(--ink); color: var(--text-dim); }
.trk-banner b { color: var(--text); }
.trk-banner.is-fresh { border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green-bright); }
.trk-banner.is-fresh b { color: var(--green-bright); }
.trk-banner.is-warn { border-color: rgba(255,179,64,0.45); background: rgba(255,179,64,0.08); color: var(--gold); }
.trk-banner.is-warn b { color: var(--gold); }
/* ---- the read's progress: one line, a bar, the "you can leave" note (the spoken copy is a separate sr-only region) ---- */
.trk-progress { margin: 0 0 0.6rem; min-width: 0; }
.trk-progress[hidden] { display: none; }
.trk-prog-line { margin: 0; font-size: max(var(--text-floor), 0.88rem); font-weight: 700; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.trk-prog-bar { height: 10px; margin: 0.4rem 0 0; border-radius: 999px; background: var(--ink); border: 1px solid var(--ink-4); overflow: hidden; }
.trk-prog-bar[hidden] { display: none; }
.trk-prog-fill { height: 100%; width: 0; background: var(--green); border-radius: inherit; transition: width 0.3s ease; }
.trk-prog-note { margin: 0.4rem 0 0; font-size: max(var(--text-floor), 0.82rem); color: var(--text-dim); font-weight: 600; line-height: 1.5; }
.trk-prog-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .trk-prog-fill { transition: none; } }
html.motion-off .trk-prog-fill { transition: none; }
@media (forced-colors: active) { .trk-prog-fill { background: Highlight; } .trk-prog-bar { border-color: CanvasText; } }
.trk-report { min-width: 0; }
.trk-report .trk-table { min-width: 420px; } /* the wrapper div (overflow-x:auto) scrolls, the page never does */
.trk-retry { margin-left: 0.4rem; vertical-align: middle; }

/* ---- "What am I looking at?" ---- */
.trk-explain { background: var(--ink); border: 1.5px solid var(--ink-4); border-radius: 12px; margin: 0 0 0.9rem; }
.trk-explain > summary { list-style: none; cursor: pointer; padding: 0.65rem 0.9rem; font-weight: 800; font-size: max(var(--text-floor), 0.9rem); color: var(--on-gold); background: var(--gold); display: flex; align-items: center; gap: 0.5rem; min-height: 44px; border-radius: 12px; }
.trk-explain > summary::-webkit-details-marker { display: none; }
.trk-explain > summary::after { content: '▾'; margin-left: auto; color: currentColor; transition: transform 0.2s; }
.trk-explain[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.trk-explain[open] > summary::after { transform: rotate(180deg); }
.trk-explain > summary:hover { background: var(--gold-deep); color: var(--ctl-ink); }
.trk-explain > summary:focus-visible { outline: 3px solid var(--green-bright); outline-offset: -3px; }
.trk-explain-body { padding: 0 0.9rem 0.8rem; border-top: 1px solid var(--ink-4); }
.trk-defs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.15rem 0.8rem; margin: 0.7rem 0 0.2rem; font-size: max(var(--text-floor), 0.88rem); line-height: 1.5; }
.trk-defs dt { font-weight: 800; color: var(--text); margin-top: 0.4rem; }
.trk-defs dd { margin: 0; color: var(--text-dim); }
@media (min-width: 600px) { .trk-defs { grid-template-columns: max-content minmax(0, 1fr); } .trk-defs dt, .trk-defs dd { margin-top: 0.3rem; } }

/* ---- ⓘ stat explainers (button + aria-expanded panel) ----
 * Scoped to .trk-report: watchlist.html also loads this sheet (for the hand-off card) and has its own .hstat .lbl
 * labels that must keep rendering exactly like newpairs.html. */
.trk-report .hstat .lbl, .trk-report .trk-h-row { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
/* The disc is --ava wide (28px; responsive.css raises it to 44px under a finger) and the glyph is drawn from it —
   responsive.css sets the font-size from --ava, so the ⓘ stays centred in its circle at every page size. */
.trk-report .trk-info { display: inline-flex; align-items: center; justify-content: center; width: var(--ava, 28px); height: var(--ava, 28px); margin: -6px 0; padding: 0; border-radius: 50%; border: 1.5px solid var(--ctl-fill-lo); background: var(--ctl-fill-lo); color: var(--ctl-ink); font: inherit; font-size: max(var(--text-floor), 0.95rem); line-height: 1; cursor: pointer; text-transform: none; letter-spacing: 0; flex: 0 0 auto; }
.trk-report .trk-info:hover, .trk-report .trk-info[aria-expanded="true"] { border-color: var(--green); background: var(--green); color: var(--on-green); }
.trk-report .trk-info:focus-visible { outline: 3px solid var(--green-bright); outline-offset: 2px; }
.trk-report .trk-info-panel { margin: 0.4rem 0 0; font-size: max(var(--text-floor), 0.8rem); font-weight: 400; line-height: 1.5; color: var(--text-dim); text-transform: none; letter-spacing: 0; border-top: 1px dashed var(--ink-4); padding-top: 0.35rem; }
/* a heading row's panel sits AFTER the row (the ⓘ is the h3's sibling, never inside it) — pull it up under the heading */
.trk-report .trk-h-row + .trk-info-panel { margin: -0.2rem 0 0.6rem; }

/* ---- skeleton shimmer ---- */
.trk-skel { display: grid; gap: 0.6rem; }
.trk-skel-bar, .trk-skel-stat, .trk-skel-h, .trk-skel-row { position: relative; overflow: hidden; border-radius: 10px; background: var(--ink); border: 1px solid var(--ink-4); }
.trk-skel-bar { height: 42px; }
.trk-skel-stat { height: 62px; }
.trk-skel-h { height: 22px; width: 55%; margin-top: 0.3rem; }
.trk-skel-row { height: 52px; }
.trk-skel [class^="trk-skel-"]::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--green) 9%, transparent) 50%, transparent 100%); transform: translateX(-100%); animation: trk-shimmer 1.4s ease-in-out infinite; }
@keyframes trk-shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) {
  .trk-skel [class^="trk-skel-"]::after { animation: none; transform: none; opacity: 0.5; }
  .trk-w, .trk-explain > summary::after { transition: none; }
}

/* ---- phones ---- */
@media (max-width: 560px) {
  .trk-side, .trk-main { padding: 0.9rem 0.75rem 1rem; border-radius: 18px; }
  .trk-w-btn { min-width: 44px; min-height: 44px; }
  .trk-chip, .trk-add-btn, .trk-rename-btns .btn { min-height: 44px; }
  .trk-add-btn { justify-self: stretch; }
  .trk-main-head .btn { min-height: 44px; }
}
/* a narrow list (a phone, or the desktop column at large text): the buttons take their own line under the wallet,
   so the label and the address get the whole width; a wrapped quick-add chip becomes a rounded card. (The media query
   is for a phone whose browser predates container queries — Safari 15 on the 320px iPhone SE.) */
@media (max-width: 400px) {
  .trk-w { flex-wrap: wrap; }
  .trk-w-main { flex-basis: 100%; }
  .trk-w-actions { width: 100%; justify-content: flex-end; }
  .trk-chip { border-radius: 14px; }
}
@container trkside (max-width: 26em) {
  .trk-w { flex-wrap: wrap; }
  .trk-w-main { flex-basis: 100%; }
  .trk-w-actions { width: 100%; justify-content: flex-end; }
  .trk-chip { border-radius: 14px; }
}

/* ---- watchlist.html hand-off card ---- */
.wl-trk-card { display: flex; align-items: center; justify-content: center; gap: 0.6rem 1rem; flex-wrap: wrap; text-align: left; padding: 0.9rem 1rem; margin: 0 0 0.8rem; font-size: max(var(--text-floor), 0.92rem); line-height: 1.45; }
.wl-trk-card b { color: var(--text); }
.wl-trk-card .btn { flex: 0 0 auto; }
@media (max-width: 480px) { .wl-trk-card { flex-direction: column; align-items: stretch; text-align: center; } }

/* ---- combined totals across your own linked wallets --------------------
   One person with several wallets has one portfolio. This sits above the
   single-wallet report because it answers the question the page is opened
   with. Gains/losses are never colour-only: every figure carries a + or −,
   so the panel reads correctly in greyscale and to anyone colour-blind. */
.trk-comb { background: var(--ink-2); border: 1.5px solid color-mix(in srgb, var(--green) 30%, var(--ink-4));
  border-radius: 14px; padding: 0.9rem 1rem; margin: 0 0 1rem; }
.trk-comb-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.trk-comb-h { margin: 0; font-size: max(var(--text-floor), 1rem); color: var(--green-bright); }
.trk-comb-head .btn { margin-left: auto; }
.trk-comb-sub { margin: 0.3rem 0 0; font-size: max(var(--text-floor), 0.82rem); color: var(--text-dim); line-height: 1.5; }

.trk-comb-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin-top: 0.85rem; }
@media (min-width: 620px) { .trk-comb-totals { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cmb-stat { background: var(--ink); border: 1px solid var(--ink-4); border-radius: 10px; padding: 0.55rem 0.7rem; min-width: 0; }
.cmb-l { font-size: max(var(--text-floor), 0.68rem); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-mute); font-weight: 700; }
.cmb-v { font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cmb-v.big { font-size: max(var(--text-floor), 1.15rem); color: var(--text); }
.cmb-v.up { color: var(--green-bright); }
.cmb-v.down { color: var(--red); }

.trk-comb-rows { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.cmb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.6rem;
  background: var(--ink); border: 1px solid var(--ink-4); border-radius: 10px; padding: 0.45rem 0.6rem; }
.cmb-row.is-pending { color: var(--text-mute); filter: saturate(0.4); }
.cmb-pick { background: var(--ctl-fill-lo); border: 0; padding: 0.35rem 0.85rem; border-radius: var(--r-pill); text-align: left; cursor: pointer; color: var(--ctl-ink);
  display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; min-width: 0; font: inherit; }
.cmb-pick:hover, .cmb-pick:focus-visible { background: var(--ctl-fill-hi); }
.cmb-addr { font-size: max(var(--text-floor), 0.82rem); color: inherit; }
.cmb-addr.addr-fit .addr-head { min-width: 3ch; }   /* a narrow pill: as short as 0x…bbcc, never out of it */
.cmb-name { font-size: max(var(--text-floor), 0.78rem); color: inherit; overflow-wrap: anywhere; }
.cmb-cell { font-size: max(var(--text-floor), 0.85rem); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmb-wait { color: var(--text-mute); font-weight: 600; font-size: max(var(--text-floor), 0.8rem); }
.trk-comb-note { margin: 0.6rem 0 0; }
@media (max-width: 460px) {
  .cmb-row { grid-template-columns: minmax(0, 1fr) auto; }
  .cmb-row .cmb-cell:last-child { grid-column: 2; }
}
