/* =========================================================================
   STOCKING design system  ·  css/stocking.css
   Tokens, base rules and every component shared across pages.
   Page-specific CSS lives in each page's own <style>. Do not redefine the
   classes in this file; add a page-prefixed modifier instead.
   Breakpoints (max-width): 1080px and 760px. Catalogue: tools/FOUNDATION.md.
   ========================================================================= */

/* ---------- tokens ---------- */
:root {
  --bg: #0A0C0B; --s1: #111413; --s2: #171B19; --s3: #1E2320; --s4: #262C28;
  --hair: rgba(255,255,255,.06); --hair2: rgba(255,255,255,.10);
  --t1: #F2F4EF; --t2: #A3A9A1; --t3: #8A938C; /* AA on --s3 and on the page */
  --acc: #3CE3A7; --acc-hi: #56ECB6;
  --acc-a: #2ED69A; --acc-b: #3CE3A7; --acc-c: #6FEDC1;
  --grad: linear-gradient(135deg, var(--acc-a) 0%, var(--acc-b) 55%, var(--acc-c) 100%);
  --acc-ink: #06130D;
  --acc-dim: rgba(60,227,167,.12); --acc-glow: rgba(60,227,167,.55);
  --blue: #8FB3D4; --blue-dim: rgba(143,179,212,.13);
  --amb: #E3B93C; --amb-dim: rgba(227,185,60,.10);
  --red: #E36A5C; --red-dim: rgba(227,106,92,.12);

  --f-xs: 11px; --f-sm: 12.5px; --f-md: 14px; --f-lg: 18px; --f-xl: 28px; --f-2xl: 44px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Archivo", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --pixel: "Silkscreen", "Geist Mono", ui-monospace, monospace;

  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 14px; --r-xl: 16px;
  --nav-h: 64px; --gutter: 24px;
  --w-page: 1344px; --w-read: 1120px; --w-doc: 800px; --w-app: 720px;
  --focus: rgba(60,227,167,.45);
  --shadow-pop: 0 18px 44px rgba(0,0,0,.55);
  color-scheme: dark;
}
@media (max-width: 760px) { :root { --nav-h: 56px; --gutter: 16px; } }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}
/* html owns the page colour. body must stay transparent: an opaque body background
   paints above the fixed z-index:-1 canvases (dot field and mark) and hides them. */
body {
  color: var(--t1);
  font-family: var(--sans); font-size: var(--f-md); line-height: 1.5;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: 500; line-height: 1.2; }
p { overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
img, video, svg { max-width: 100%; }
table { border-collapse: collapse; }
code, kbd, pre, samp { font-family: var(--mono); }
code { font-size: .95em; }
::selection { background: rgba(60,227,167,.28); color: var(--t1); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--w-page); margin-inline: auto; padding-inline: var(--gutter); position: relative; }
.wrap-read { max-width: var(--w-read); }
.wrap-doc { max-width: var(--w-doc); }
.wrap-app { max-width: var(--w-app); }
.g2, .g3, .g4 { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g2 > *, .g3 > *, .g4 > * { min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.divider { height: 1px; background: var(--hair); border: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,12,11,.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.15); backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid var(--hair);
}
.nav-in {
  max-width: var(--w-page); margin-inline: auto; height: var(--nav-h);
  padding-inline: var(--gutter); display: flex; align-items: center; gap: 28px; position: relative;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--t1); flex: none; min-height: 40px; }
.brand:hover { color: var(--t1); }
.brand-logo { width: 28px; height: 28px; display: block; flex: none; }
.brand-mark { width: 22px; height: 26px; display: block; flex: none; overflow: visible; }
.brand-word { font-family: var(--pixel); font-weight: 700; font-size: 13px; letter-spacing: .14em; line-height: 1; }
.nav-menu { display: flex; align-items: center; gap: 24px; font-size: var(--f-sm); min-width: 0; }
.nav-link { color: var(--t2); white-space: nowrap; transition: color .15s; }
.nav-link:hover, .nav-link.is-on { color: var(--t1); }
.nav-menu-extra { display: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.nav-connect { min-width: 84px; }
.nav-burger {
  display: none; width: 40px; height: 40px; border-radius: 10px; background: var(--s2);
  flex-direction: column; align-items: center; justify-content: center; gap: 4px; flex: none;
}
.nav-burger:hover { background: var(--s3); }
.nav-burger i { display: block; width: 16px; height: 1.5px; border-radius: 1px; background: var(--t2); transition: transform .2s, opacity .2s; }
.nav-burger[aria-expanded="true"] i:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-burger[aria-expanded="true"] i:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] i:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 32px; padding-inline: 14px; border-radius: var(--r-sm);
  background: var(--s2); color: var(--t1);
  font-size: var(--f-sm); font-weight: 500; line-height: 1; white-space: nowrap;
  transition: background-color .15s, color .15s, filter .15s, box-shadow .15s;
  -webkit-user-select: none; user-select: none; text-decoration: none;
}
.btn:hover { background: var(--s3); color: var(--t1); }
.btn-primary { background: var(--acc); color: var(--acc-ink); font-weight: 600; }
.btn-primary:hover { background: var(--acc-hi); color: var(--acc-ink); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--hair2); }
.btn-ghost:hover { background: var(--s2); }
.btn-warn { background: var(--amb); color: var(--acc-ink); font-weight: 600; }
.btn-warn:hover { background: var(--amb); color: var(--acc-ink); filter: brightness(1.07); }
.btn-danger { background: var(--red-dim); color: var(--red); box-shadow: inset 0 0 0 1px rgba(227,106,92,.3); }
.btn-danger:hover { background: rgba(227,106,92,.2); color: var(--red); }
.btn-lg { height: 44px; padding-inline: 22px; font-size: var(--f-md); border-radius: 10px; }
.btn-sm { height: 28px; padding-inline: 11px; font-size: var(--f-xs); border-radius: 7px; }
.btn-block { display: flex; width: 100%; }
.btn-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 10px 16px; border-radius: var(--r-md);
  background: var(--acc); color: var(--acc-ink); font-size: 15px; font-weight: 600; line-height: 1.25; text-align: center;
  transition: background-color .15s, color .15s;
}
.btn-cta:hover { background: var(--acc-hi); color: var(--acc-ink); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--s2); color: var(--t3); filter: none; box-shadow: none; cursor: not-allowed; }
.btn-primary:disabled, .btn-primary[aria-disabled="true"],
.btn-cta:disabled, .btn-cta[aria-disabled="true"] { background: var(--s3); color: var(--t3); }
.btn.is-connected { font-family: var(--mono); font-weight: 400; }
.btn.is-wrong { background: linear-gradient(var(--amb-dim), var(--amb-dim)), var(--s2); color: var(--amb); box-shadow: inset 0 0 0 1px rgba(227,185,60,.35); }
.btn.is-done { background: linear-gradient(var(--acc-dim), var(--acc-dim)), var(--s2); color: var(--acc); }
.btn[aria-busy="true"] { cursor: progress; }
.btn .icon { width: 14px; height: 14px; }
.link { color: var(--acc); }
.link:hover { color: var(--acc-c); }

/* ---------- pills, dots, badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding-inline: 12px;
  border-radius: var(--r-sm); background: var(--s2); color: var(--t2);
  font-size: var(--f-sm); line-height: 1; white-space: nowrap;
}
.pill-sm { height: 26px; padding-inline: 10px; font-size: var(--f-xs); gap: 6px; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--t3); flex: none; }
.dot-live, .pill-live .dot { background: var(--acc); box-shadow: 0 0 8px var(--acc-glow); }
.dot-pre, .pill-pre .dot { background: var(--amb); box-shadow: 0 0 8px rgba(227,185,60,.6); }
.dot-bad { background: var(--red); }
.pill-buy { background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair2); color: var(--t2); }
.pill-buy[aria-disabled="true"] { cursor: default; }
a.pill-buy { background: var(--acc); box-shadow: none; color: var(--acc-ink); font-weight: 600; }
a.pill-buy:hover { background: var(--acc-hi); }
.pill-ca { background: var(--bg); box-shadow: inset 0 0 0 1px var(--hair2); color: var(--t1); font-weight: 500; cursor: pointer; }
.pill-ca:hover:not(:disabled) { background: var(--s2); }
.pill-ca:disabled { color: var(--t2); cursor: default; }
.pill-ca.is-done { color: var(--acc); }
.badge {
  display: inline-flex; align-items: center; height: 22px; padding-inline: 8px; border-radius: var(--r-xs);
  background: var(--s2); color: var(--t2); font-family: var(--sans); font-size: 10.5px; font-weight: 500;
  letter-spacing: .05em; line-height: 1; white-space: nowrap; vertical-align: middle;
}
.badge-ok { background: linear-gradient(var(--acc-dim), var(--acc-dim)), var(--s1); color: var(--acc); }
.badge-blue { background: linear-gradient(var(--blue-dim), var(--blue-dim)), var(--s1); color: var(--blue); }
.badge-amb { background: linear-gradient(rgba(227,185,60,.12), rgba(227,185,60,.12)), var(--s1); color: var(--amb); }
.badge-red { background: linear-gradient(var(--red-dim), var(--red-dim)), var(--s1); color: var(--red); }

/* ---------- icons (inline SVG, stroke currentColor) ---------- */
.icon { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.spinner { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid rgba(60,227,167,.25); border-top-color: var(--acc); animation: stocking-spin .8s linear infinite; }
@keyframes stocking-spin { to { transform: rotate(360deg); } }

/* ---------- fields and inputs ---------- */
.field { background: var(--s2); border-radius: var(--r-md); padding: 16px 18px; transition: box-shadow .15s; }
.field:focus-within { box-shadow: inset 0 0 0 1px var(--focus); }
.field-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: var(--f-xs); color: var(--t3); margin-bottom: 8px; min-width: 0; }
.field-bal { color: var(--t2); white-space: nowrap; }
button.field-bal:hover { color: var(--acc); }
.field-mid { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-width: 0; }
.field-input {
  font-family: var(--mono); font-size: var(--f-xl); font-weight: 500; letter-spacing: -.01em;
  width: 100%; min-width: 0; background: none; border: 0; outline: none; padding: 0; color: var(--t1);
}
.field-input::placeholder { color: var(--t3); }
.field-input:focus-visible { outline: none; }
.field-sub { margin-top: 6px; font-size: var(--f-xs); color: var(--t3); min-width: 0; overflow-wrap: anywhere; }
.label { display: block; font-size: var(--f-xs); color: var(--t3); margin-bottom: 6px; }
.input, .textarea, .select {
  display: block; width: 100%; min-height: 40px; background: var(--s2); color: var(--t1);
  border: 0; border-radius: 10px; padding: 10px 12px; font-size: var(--f-md); line-height: 1.4; outline: none;
  transition: box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--t3); }
.input:focus, .textarea:focus, .select:focus { box-shadow: inset 0 0 0 1px var(--focus); }
.input.is-bad, .textarea.is-bad { box-shadow: inset 0 0 0 1px rgba(227,106,92,.6); }
.input-mono { font-family: var(--mono); }
.textarea { min-height: 72px; resize: vertical; }
.select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--t2) 50%), linear-gradient(135deg, var(--t2) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.count { font-family: var(--mono); font-size: var(--f-xs); color: var(--t3); text-align: right; margin-top: 4px; }
.count.is-bad { color: var(--red); }

/* ---------- token chips and icons ---------- */
.tok {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border-radius: 999px;
  background: var(--s3); color: var(--t1); font-size: var(--f-sm); font-weight: 500; line-height: 1.2;
  white-space: nowrap; flex: none;
}
button.tok:hover { background: var(--s4); }
.tokline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-width: 0; }
.ico {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #DCE1EA, #8990A3);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}
.ico-eth { background: linear-gradient(135deg, #CAD3F2, #5F6FB6); }
.ico-usdg { background: linear-gradient(135deg, #A6EBD6, #2C9A83); }
.ico-stocking { background: var(--s2) url("/img/stocking-64.png") center / cover no-repeat; }
.ico-sm { width: 16px; height: 16px; }
.ico-md { width: 18px; height: 18px; }
.ico-lg { width: 32px; height: 32px; }
.ico-xl { width: 48px; height: 48px; }
/* Real stock logos: js/logos.js paints /img/stocks/<TICKER>.png on any .ico carrying data-stock. */
.ico[data-stock] { background-color: #fff; background-position: center; background-size: cover; background-repeat: no-repeat; }

/* ---------- gift ledger rows (the "you receive" panel) ---------- */
.legs { background: var(--s2); border-radius: var(--r-md); overflow: hidden; }
.legs-head, .legs-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: var(--f-xs); color: var(--t3); padding-inline: 18px; }
.legs-head { padding-block: 12px 4px; }
.legs-foot { padding-block: 12px; border-top: 1px solid var(--hair); }
.legs-foot b { color: var(--t2); font-weight: 500; font-family: var(--mono); }
.leg { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; }
.leg + .leg { border-top: 1px solid var(--hair); }
.leg-name { font-weight: 500; min-width: 0; overflow-wrap: break-word; }
.leg-name small { display: block; margin-top: 2px; font-size: var(--f-xs); font-weight: 400; color: var(--t3); }
.leg-val { font-family: var(--mono); font-size: var(--f-lg); font-weight: 500; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.leg-val small { display: block; margin-top: 2px; font-size: var(--f-xs); font-weight: 400; color: var(--t3); }
.leg-val.is-acc { color: var(--acc); }
.cleave { height: 28px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: var(--f-xs); color: var(--t3); }
.cleave::before, .cleave::after { content: ""; display: block; width: 90px; height: 1px; background: linear-gradient(90deg, transparent, rgba(60,227,167,.7), transparent); }

/* ---------- cards ---------- */
.card { background: var(--s1); border-radius: var(--r-lg); padding: 22px 24px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.card-h { font-size: var(--f-md); font-weight: 500; color: var(--t1); }
.card-title { font-size: var(--f-lg); font-weight: 500; margin-bottom: 8px; }
.card-text { color: var(--t2); font-size: var(--f-sm); }
.card-text b { color: var(--t1); font-weight: 500; }
.card-lift { box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 1px rgba(60,227,167,.10); }
.hint { font-size: var(--f-sm); color: var(--t3); }
.eyebrow { font-family: var(--mono); font-size: var(--f-xs); color: var(--acc); letter-spacing: .04em; margin-bottom: 10px; }
.eyebrow-blue { color: var(--blue); }
.eyebrow-amb { color: var(--amb); }

/* ---------- kv rows ---------- */
.kvs { display: flex; flex-direction: column; }
.kvs-box { background: var(--s1); border-radius: var(--r-lg); padding: 6px 20px; }
.kvs-box > .kv:first-child, .kvs-flush > .kv:first-child { border-top: 0; }
.kv {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 16px; row-gap: 2px;
  min-height: 44px; padding-block: 10px; border-top: 1px solid var(--hair); font-size: var(--f-sm);
}
.kv .k { color: var(--t2); }
.kv .v { margin-left: auto; min-width: 0; font-family: var(--mono); color: var(--t1); text-align: right; overflow-wrap: anywhere; }
.kv .v a { color: var(--t1); }
.kv .v a:hover { color: var(--acc); }
.kv .v.is-acc { color: var(--acc); }
.kv .v.is-blue { color: var(--blue); }
.kv .v.is-amb { color: var(--amb); }
.kv .v.is-red { color: var(--red); }
.kv .v.is-dim { color: var(--t3); }
.kv-sect { font-size: var(--f-xs); color: var(--t3); margin: 18px 0 4px; }
.kv-sect:first-child { margin-top: 0; }

/* ---------- KPI tiles, progress, states ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--s2); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; }
.kpi-l { font-size: var(--f-xs); color: var(--t3); margin-bottom: 6px; }
.kpi-n { font-family: var(--mono); font-size: var(--f-lg); font-weight: 500; overflow-wrap: anywhere; }
.kpi-s { font-size: var(--f-xs); color: var(--t3); margin-top: 4px; }
.progress { height: 3px; background: var(--s3); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .6s ease; }
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 20px; text-align: center; font-size: var(--f-sm); color: var(--t3); }
.state-inline { flex-direction: row; justify-content: flex-start; flex-wrap: wrap; padding: 0; gap: 8px; text-align: left; }
.state-fail { color: var(--t2); }
.state-fail .icon { color: var(--red); }

/* ---------- tables ---------- */
.table-wrap {
  max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, var(--s1) 30%, rgba(17,20,19,0)) left center / 36px 100% no-repeat local,
    linear-gradient(270deg, var(--s1) 30%, rgba(17,20,19,0)) right center / 36px 100% no-repeat local,
    linear-gradient(90deg, rgba(60,227,167,.12), rgba(60,227,167,0)) left center / 12px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(60,227,167,.12), rgba(60,227,167,0)) right center / 12px 100% no-repeat scroll,
    var(--s1);
}
.table { width: 100%; min-width: 720px; border-collapse: collapse; font-family: var(--mono); font-size: var(--f-sm); }
.table-fit { min-width: 0; }
.table th { text-align: left; font-family: var(--sans); font-size: var(--f-xs); font-weight: 400; color: var(--t3); padding: 14px 16px; border-bottom: 1px solid var(--hair2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--hair); color: var(--t2); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table td.sym { color: var(--t1); font-family: var(--sans); font-weight: 500; }
.table td.sym small { display: block; margin-top: 3px; font-family: var(--mono); font-size: var(--f-xs); font-weight: 400; color: var(--t3); }
.table td.state { display: table-cell; text-align: center; padding: 28px 16px; color: var(--t3); font-family: var(--sans); }

/* ---------- tabs, segmented controls, choice chips ---------- */
.tabs { display: inline-flex; gap: 4px; max-width: 100%; padding: 4px; border-radius: 10px; background: var(--s2); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 7px; font-size: var(--f-sm); font-weight: 500; line-height: 1.5; color: var(--t2); white-space: nowrap; transition: color .15s, background-color .15s; }
.tab:hover:not(.is-on):not(:disabled) { color: var(--t1); }
.tab.is-on, .tab[aria-selected="true"] { background: var(--s3); color: var(--t1); }
.tab:disabled { color: var(--t3); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--s2); }
.seg-item { display: inline-flex; align-items: center; justify-content: center; padding: 3px 9px; border-radius: var(--r-xs); font-size: var(--f-xs); line-height: 1.5; color: var(--t3); white-space: nowrap; }
.seg-item.is-on, .seg-item[aria-pressed="true"] { background: var(--s3); color: var(--t1); }
button.seg-item:hover:not(.is-on) { color: var(--t1); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px; border-radius: var(--r-sm); background: var(--s2); color: var(--t2); font-size: var(--f-sm); white-space: nowrap; transition: color .15s, background-color .15s; }
.chip:hover:not(.is-on):not(:disabled) { color: var(--t1); }
.chip.is-on, .chip[aria-pressed="true"] { background: linear-gradient(var(--acc-dim), var(--acc-dim)), var(--s1); color: var(--acc); box-shadow: inset 0 0 0 1px rgba(60,227,167,.38); }
.chip:disabled { color: var(--t3); }

/* ---------- stock picker grid ---------- */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: var(--r-md); background: var(--s2); color: var(--t1); text-align: left; min-width: 0; transition: background-color .15s, box-shadow .15s; }
.pick:hover { background: var(--s3); }
.pick.is-on, .pick[aria-pressed="true"] { background: linear-gradient(var(--acc-dim), var(--acc-dim)), var(--s1); box-shadow: inset 0 0 0 1px rgba(60,227,167,.38); }
.pick-name { min-width: 0; }
.pick-name b { display: block; font-size: var(--f-sm); font-weight: 500; }
.pick-name small { display: block; font-family: var(--mono); font-size: var(--f-xs); color: var(--t3); margin-top: 1px; overflow-wrap: anywhere; }

/* ---------- section headers ---------- */
.sec { padding-top: 80px; }
.sec-title { font-size: 34px; font-weight: 500; letter-spacing: -.015em; line-height: 1.15; margin-bottom: 10px; }
.sec-sub { color: var(--t2); font-size: 15px; max-width: 640px; margin-bottom: 28px; }
.sec-sub b { color: var(--t1); font-weight: 500; }
.page-title { font-size: var(--f-xl); font-weight: 500; letter-spacing: -.01em; line-height: 1.2; margin: 56px 0 10px; }
.page-lead { color: var(--t2); font-size: 15px; max-width: 680px; margin-bottom: 28px; }
.page-lead b { color: var(--t1); font-weight: 500; }
.sec-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin: 44px 0 14px; font-size: var(--f-lg); font-weight: 500; line-height: 1.3; color: var(--t1); }
.sec-num { font-family: var(--mono); font-size: var(--f-xs); font-weight: 400; color: var(--acc); }
.sec-aside { margin-left: auto; font-family: var(--mono); font-size: var(--f-xs); font-weight: 400; color: var(--t3); }
.note { font-size: var(--f-sm); color: var(--t3); margin-top: 12px; line-height: 1.55; }
.note b { color: var(--t2); font-weight: 500; }
.grad-text { color: var(--acc); }

/* ---------- code ---------- */
.code, .math {
  display: block; max-width: 100%; overflow-x: auto; white-space: pre; tab-size: 2;
  background: var(--s1); border-radius: var(--r-lg); padding: 18px 20px;
  font-family: var(--mono); font-size: var(--f-sm); line-height: 1.7; color: var(--t2);
}
.math { color: var(--t1); padding-block: 16px; }
.code b, .math b { color: var(--t1); font-weight: 500; }
.code .c, .math .c { color: var(--t3); }
.code .hl, .math .hl { color: var(--acc); }
.code .s { color: var(--amb); }
code.ic { background: var(--s2); border-radius: 5px; padding: 1px 5px; color: var(--t1); }

/* ---------- notices ---------- */
.notice { display: flex; align-items: flex-start; gap: 16px; background: linear-gradient(var(--amb-dim), var(--amb-dim)), var(--s1); border-radius: var(--r-lg); padding: 16px 20px; color: var(--t2); font-size: var(--f-sm); line-height: 1.55; }
.notice-tag { flex: none; margin-top: 2px; font-family: var(--mono); font-size: var(--f-xs); letter-spacing: .04em; color: var(--amb); white-space: nowrap; }
.notice p { margin: 0; min-width: 0; }
.notice b { color: var(--t1); font-weight: 500; }
.notice-info { background: linear-gradient(var(--acc-dim), var(--acc-dim)), var(--s1); }
.notice-info .notice-tag { color: var(--acc); }
.notice-bad { background: linear-gradient(var(--red-dim), var(--red-dim)), var(--s1); }
.notice-bad .notice-tag { color: var(--red); }

/* ---------- $STOCKING contract bar ---------- */
.ca-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; background: var(--s1); border-radius: var(--r-lg); padding: 16px 20px; }
.ca-label { font-size: var(--f-xs); color: var(--t3); white-space: nowrap; }
.ca-addr { flex: 1 1 220px; min-width: 0; font-family: var(--mono); font-size: var(--f-sm); color: var(--t1); overflow-wrap: anywhere; }
.ca-addr.is-blank { font-family: var(--sans); color: var(--t2); }
.ca-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- link box and QR ---------- */
.linkbox { display: flex; align-items: center; gap: 10px; background: var(--s2); border-radius: var(--r-md); padding: 10px 10px 10px 14px; min-width: 0; }
.linkbox code { flex: 1 1 auto; min-width: 0; font-size: var(--f-sm); color: var(--t1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr { display: block; width: 100%; max-width: 220px; height: auto; border-radius: var(--r-md); background: #fff; padding: 10px; }
.qr svg { display: block; width: 100%; height: auto; }

/* ---------- popover menu (wallet picker, account menu) ---------- */
.menu-pop { position: fixed; z-index: 95; min-width: 232px; max-width: calc(100vw - 16px); padding: 6px; border-radius: var(--r-md); background: var(--s2); box-shadow: var(--shadow-pop), 0 0 0 1px var(--hair2); }
.menu-pop-title { padding: 8px 10px 6px; font-size: var(--f-xs); color: var(--t3); }
.menu-pop-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding-inline: 10px; border-radius: var(--r-sm); color: var(--t1); font-size: var(--f-sm); text-align: left; }
.menu-pop-item:hover, .menu-pop-item:focus-visible { background: var(--s3); outline: none; }
.menu-pop-item img { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.menu-pop-item .icon { color: var(--t2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 12px 10px 12px 14px; border-radius: var(--r-md); background: var(--s2); color: var(--t1);
  font-size: var(--f-sm); line-height: 1.45; box-shadow: var(--shadow-pop), 0 0 0 1px var(--hair2);
  animation: stocking-toast-in .18s ease-out;
}
.toast > .icon, .toast > .spinner { margin-top: 2px; }
.toast-info > .icon, .toast-ok > .icon { color: var(--acc); }
.toast-warn > .icon { color: var(--amb); }
.toast-bad > .icon { color: var(--red); }
.toast-msg { min-width: 0; overflow-wrap: anywhere; }
.toast-msg a { color: var(--acc); text-decoration: underline; text-underline-offset: 2px; margin-left: 6px; white-space: nowrap; }
.toast-close { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin: -4px 0 -4px 0; border-radius: 7px; color: var(--t3); }
.toast-close:hover { background: var(--s3); color: var(--t1); }
@keyframes stocking-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */
.foot { position: relative; margin-top: 72px; padding-block: 28px 40px; border-top: 1px solid var(--hair); background: var(--bg); font-size: var(--f-xs); color: var(--t3); }
.foot-flush { margin-top: 0; }
.foot-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 14px; }
.foot-brand { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.foot-word { font-family: var(--pixel); font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--t1); }
.foot-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.foot-links a { color: var(--t3); transition: color .15s; }
.foot-links a:hover { color: var(--t1); }
.foot-links a.pill-buy, .foot-links a.pill-buy:hover { color: var(--acc-ink); }
.foot p { max-width: 900px; margin-top: 6px; line-height: 1.55; }

/* ---------- background canvases (built by js/shell.js) ---------- */
#bgfx, #bgmark { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bgfx { z-index: -2; }
#bgmark { z-index: -1; transition: opacity .25s linear; }

/* ---------- utilities ---------- */
.mono { font-family: var(--mono); font-feature-settings: "tnum" 1; }
.sans { font-family: var(--sans); }
.pixel { font-family: var(--pixel); letter-spacing: .14em; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus, .skip-link:focus-visible { position: fixed !important; left: 12px; top: 10px; z-index: 100; width: auto; height: auto; margin: 0; padding: 10px 14px; overflow: visible; clip: auto; clip-path: none; border-radius: var(--r-sm); background: var(--s2); color: var(--t1); font-size: var(--f-sm); box-shadow: var(--shadow-pop); }
.c-t1 { color: var(--t1); } .c-t2 { color: var(--t2); } .c-t3 { color: var(--t3); }
.c-acc { color: var(--acc); } .c-blue { color: var(--blue); }
.c-amb { color: var(--amb); } .c-red { color: var(--red); }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; word-break: break-word; }
.min-0 { min-width: 0; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
@media (min-width: 761px) { .show-sm { display: none !important; } }

/* ---------- 1080px ---------- */
@media (max-width: 1080px) {
  /* the nav collapses into the burger here already: eight nav words, two pills and Connect do not fit a tablet */
  .nav-in { gap: 16px; }
  .nav-menu {
    display: none; position: absolute; top: calc(100% + 8px); left: var(--gutter); right: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 0; padding: 8px;
    background: var(--s2); border-radius: var(--r-md); box-shadow: var(--shadow-pop), 0 0 0 1px var(--hair2);
    max-height: calc(100vh - var(--nav-h) - 24px); overflow-y: auto; font-size: var(--f-md);
  }
  .nav-menu.is-open { display: flex; }
  .nav-link { display: flex; align-items: center; min-height: 44px; padding-inline: 12px; border-radius: var(--r-sm); }
  .nav-link:hover { background: var(--s3); }
  .nav-link.is-on { background: var(--s3); }
  .nav-menu-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; padding: 12px 12px 6px; border-top: 1px solid var(--hair); }
  .nav-menu-extra .pill { height: 40px; }
  a.pill-buy, button.pill-ca { min-height: 40px; }
  .nav-right .pill-status, .nav-right .pill-buy, .nav-right .pill-ca { display: none; }
  .nav-burger { display: flex; }
  .brand { min-height: 44px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-md { display: none !important; }
}

/* ---------- 760px ---------- */
@media (max-width: 760px) {
  .nav-in { gap: 12px; }

  .btn, .btn-sm { min-height: 40px; }
  .btn-sm { padding-inline: 12px; }
  .ctas-sm-fill > .btn { flex: 1 1 0; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .hide-sm { display: none !important; }

  .field { padding: 14px 16px; }
  .field-input { font-size: 24px; min-height: 40px; }
  button.field-bal { display: inline-flex; align-items: center; min-height: 40px; margin-block: -10px; }
  .input, .textarea, .select { font-size: 16px; }
  .leg { padding: 12px 14px; gap: 10px; }
  .leg-val { font-size: 15px; }
  .legs-head, .legs-foot { padding-inline: 14px; }
  .cleave::before, .cleave::after { width: 64px; }
  .card { padding: 18px 16px; border-radius: var(--r-md); }
  .kvs-box { padding: 4px 16px; }
  .kpis { gap: 8px; }
  .kpi { padding: 12px; }
  .kpi-n { font-size: 15px; }
  .tabs { display: flex; width: 100%; }
  .tabs .tab { flex: 1 0 auto; min-height: 40px; padding-inline: 10px; }
  button.seg-item { min-height: 40px; min-width: 40px; padding-inline: 12px; }
  .kv .v a, .table td a { display: inline-block; padding-block: 12px; margin-block: -12px; }
  .chip { height: auto; min-height: 40px; }
  .picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec { padding-top: 40px; }
  .sec-title { font-size: 22px; }
  .sec-sub { font-size: var(--f-md); margin-bottom: 20px; }
  .page-title { font-size: 24px; margin-top: 36px; }
  .sec-head { margin-top: 36px; }
  .code, .math { padding: 14px 16px; font-size: 12px; }
  .notice { flex-direction: column; gap: 6px; padding: 14px 16px; }
  .ca-bar { padding: 14px 16px; }
  .ca-actions { margin-left: 0; }
  .linkbox { flex-wrap: wrap; }
  .linkbox code { flex-basis: 100%; }
  .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .toast-close { width: 40px; height: 40px; margin: -10px -4px -10px 0; }
  .menu-pop-item { min-height: 48px; }
  .foot { margin-top: 56px; padding-block: 24px 32px; }
  .foot-links { gap: 0 16px; }
  .foot-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; min-width: 40px; }
  .foot-links .pill { margin-block: 7px; }
}
@media (max-width: 380px) {
  .leg { grid-template-columns: auto minmax(0, 1fr); }
  .leg-val { grid-column: 2; text-align: left; }
  .picks { gap: 6px; }
  .pick { padding-inline: 10px; gap: 8px; }
}

/* ---------- print ---------- */
@media print {
  #bgfx, #bgmark, .toasts, .menu-pop, .nav-burger { display: none !important; }
  .nav { position: static; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
