/*
 * css/site.css: Arbiter shared primitives (owner: shell agent). Read docs/SHELL.md for the class list and the
 * js/ui module APIs. Colours, type and geometry come from css/tokens.css. Dark theme only.
 *
 * Rules: glass sparingly, no boxes inside boxes, glows instead of outlines, transform/opacity motion only,
 * 44 px tap targets on phones, inputs at 16 px or more (no iOS zoom), safe-area padding on fixed bars.
 */

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }
body::before {
  /* the quiet cosmic ground behind every page (the landing paints its own hero on top) */
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vw 40vh at 12% -6%, rgba(52, 66, 255, 0.20), transparent 70%),
    radial-gradient(50vw 50vh at 100% 10%, rgba(17, 27, 196, 0.22), transparent 70%),
    radial-gradient(80vw 50vh at 50% 110%, rgba(52, 66, 255, 0.16), transparent 70%),
    var(--bg);
}
main { flex: 1 0 auto; }
img, svg, video, canvas { display: block; max-width: 100%; }
svg.mark, .icon { display: inline-block; vertical-align: middle; flex: none; }
a { color: var(--ice); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: #fff; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 0.5em; line-height: 1.12; letter-spacing: var(--track-tight); font-weight: 600; }
h1 { font-size: clamp(34px, 5.4vw, 64px); font-weight: 300; }
h1 b, h1 strong, h2 b, h2 strong, .display b, .display strong { font-weight: 700; }
h2 { font-size: clamp(26px, 3.4vw, 42px); font-weight: 300; }
h3 { font-size: 20px; letter-spacing: -0.015em; }
h4 { font-size: 16px; letter-spacing: -0.01em; }
small { font-size: 13px; }
hr { border: 0; height: 1px; background: var(--line); margin: 24px 0; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, samp { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--glass-2); padding: 0.1em 0.4em; border-radius: 6px; color: var(--ink); }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap-narrow { max-width: 760px; }
.page { padding-top: calc(var(--nav-h) + 28px); padding-bottom: 72px; }
.display { font-weight: 300; letter-spacing: var(--track-tight); color: var(--ink); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ice); }
.lead { font-size: clamp(17px, 1.6vw, 19px); color: var(--body); max-width: 60ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ink { color: var(--ink); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.center { text-align: center; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.addr { font-family: var(--mono); font-size: 0.94em; color: var(--ink); overflow-wrap: anywhere; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(30px, 4vw, 46px); margin: 6px 0 4px; }
.page-head p { margin: 0; color: var(--muted); max-width: 56ch; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.section-title h2, .section-title h3 { margin: 0; }

/* ------------------------------------------------------------------ icons */
.icon { width: 1.15em; height: 1.15em; }

/* ------------------------------------------------------------------ buttons */
.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 20px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: var(--glass-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--glass-3); border-color: rgba(170, 182, 255, 0.36); color: #fff; }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn .icon { width: 18px; height: 18px; }
.btn-glass { /* the secondary pill (same as .btn, named for clarity) */ }
.btn-primary {
  position: relative;
  border: 0;
  color: #fff;
  background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 6px 22px -8px rgba(52, 66, 255, 0.7);
}
.btn-primary:hover { background: var(--grad); color: #fff; transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32), inset 0 -1px 0 rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(109, 123, 255, 0.5), 0 10px 36px -6px rgba(52, 66, 255, 0.85); }
.btn-primary:active { transform: translateY(0) scale(0.985); }
.btn-ghost { background: transparent; border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--ice); padding: 0 12px; }
.btn-ghost:hover { background: var(--glass); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: rgba(255, 111, 142, 0.35); background: var(--bad-tint); }
.btn-danger:hover { color: #fff; background: rgba(255, 111, 142, 0.24); border-color: rgba(255, 111, 142, 0.55); }
.btn-sm { --btn-h: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { --btn-h: 54px; padding: 0 28px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: var(--btn-h); padding: 0; flex: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.is-loading { pointer-events: none; color: transparent !important; position: relative; }
.btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; animation: spin 0.8s linear infinite; }
.link-quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--ice); font-weight: 500; }
.link-quiet .icon { width: 16px; height: 16px; transition: transform var(--dur) var(--ease); }
.link-quiet:hover .icon { transform: translateX(3px); }
.soon { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: var(--pill); background: var(--glass-2); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.9s linear infinite; }

/* ------------------------------------------------------------------ fields */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--body); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.field-label small { font-weight: 400; color: var(--muted); }
.field-hint { font-size: 13px; color: var(--muted); margin: 0; }
.field-error { font-size: 13px; color: var(--bad); margin: 0; min-height: 0; }
.field-error:empty { display: none; }
.input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(6, 8, 40, 0.6);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: var(--line-2); }
.input:focus { border-color: rgba(109, 123, 255, 0.7); box-shadow: 0 0 0 4px rgba(52, 66, 255, 0.22); background: rgba(6, 8, 40, 0.85); }
.input[aria-invalid="true"] { border-color: rgba(255, 111, 142, 0.6); box-shadow: 0 0 0 4px rgba(255, 111, 142, 0.14); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
textarea.input { min-height: 96px; resize: vertical; }
select.input { padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a92c9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; }
.input-mono, .input.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.input-big { font-size: clamp(26px, 4vw, 34px); font-family: var(--mono); font-weight: 500; min-height: 64px; letter-spacing: -0.02em; }
.input-group { position: relative; display: flex; align-items: center; min-width: 0; }
.input-group > .input { flex: 1 1 auto; min-width: 0; }
.input-group > .input-affix { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 6px; pointer-events: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.input-group > .input-affix.is-button { pointer-events: auto; }
.input-group > .input-prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-group.has-affix > .input { padding-right: 112px; }
.input-group.has-prefix > .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid > .span-2 { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* checkbox switch: <label class="switch"><input type="checkbox"><span></span> Label</label> */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; color: var(--body); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch > span { position: relative; width: 44px; height: 26px; border-radius: var(--pill); background: var(--glass-3); border: 1px solid var(--line-2); transition: background-color var(--dur) var(--ease); flex: none; }
.switch > span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--dur) var(--ease); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
.switch input:checked + span { background: var(--brand-hi); border-color: transparent; }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand-hi); outline-offset: 3px; }

/* ------------------------------------------------------------------ range sliders (cosmic)
 * <input type="range" class="range" style="--val:40%; --c:#43dfae">   js/ui/controls.js rangeFill(input) keeps --val in sync.
 */
.range {
  --val: 50%;
  --c: var(--brand-hi);
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
  margin: 0;
}
.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--c) 0, var(--c) var(--val), rgba(170, 182, 255, 0.16) var(--val));
  box-shadow: 0 0 14px -2px color-mix(in srgb, var(--c) 60%, transparent);
}
.range::-moz-range-track { height: 6px; border-radius: var(--pill); background: rgba(170, 182, 255, 0.16); }
.range::-moz-range-progress { height: 6px; border-radius: var(--pill); background: var(--c); }
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0, #e8ebff 45%, #c9cffc 100%);
  border: 0;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent), 0 0 20px 2px color-mix(in srgb, var(--c) 70%, transparent);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 35%, transparent), 0 0 20px 2px color-mix(in srgb, var(--c) 70%, transparent); }
.range:active::-webkit-slider-thumb { transform: scale(1.12); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--brand-hi), 0 0 24px 4px color-mix(in srgb, var(--c) 80%, transparent); }
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--brand-hi); }
.range:disabled { opacity: 0.5; cursor: not-allowed; }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 14px; }
.range-row .range { grid-column: 1 / -1; }
.range-row .range-value { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------------ segmented control
 * <div class="seg" role="radiogroup"><button role="radio" aria-checked="true">USDG</button>...</div>
 */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--pill); background: rgba(6, 8, 40, 0.6); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg > button, .seg > label {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: var(--pill); border: 0; background: transparent;
  color: var(--muted); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.seg > button:hover, .seg > label:hover { color: var(--ink); }
.seg > [aria-checked="true"], .seg > [aria-pressed="true"], .seg > [aria-selected="true"], .seg > label:has(input:checked) {
  background: var(--grad); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 4px 16px -6px rgba(52, 66, 255, 0.8);
}
.seg > label input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-block { display: flex; width: 100%; }
.seg-block > * { flex: 1 1 0; }

/* ------------------------------------------------------------------ chips and dots */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: var(--pill);
  background: var(--glass-2); color: var(--body); font-size: 13px; font-weight: 600; white-space: nowrap; line-height: 1;
  border: 1px solid transparent;
}
.chip .icon { width: 14px; height: 14px; }
.chip-sm { height: 22px; padding: 0 8px; font-size: 12px; }
.chip-brand { background: rgba(52, 66, 255, 0.2); color: var(--ice); }
.chip-ok { background: var(--ok-tint); color: var(--ok); }
.chip-bad { background: var(--bad-tint); color: var(--bad); }
.chip-warn { background: var(--warn-tint); color: var(--warn); }
.chip-outline { background: transparent; border-color: var(--line-2); }
button.chip, a.chip { cursor: pointer; transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
button.chip:hover, a.chip:hover { background: var(--glass-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: rgba(52, 66, 255, 0.3); color: #fff; border-color: rgba(109, 123, 255, 0.5); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--brand-hi)); box-shadow: 0 0 10px var(--c, var(--brand-hi)); flex: none; }
.dot-ok { --c: var(--ok); }
.dot-bad { --c: var(--bad); }
.dot-warn { --c: var(--warn); }

/* asset chip (js/ui/assets.js assetChip): logo + symbol */
.asset-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); white-space: nowrap; vertical-align: middle; }
.asset-chip img, .asset-chip .logo-disc { flex: none; border-radius: 50%; }
.asset-chip.is-pill { height: 30px; padding: 0 11px 0 4px; border-radius: var(--pill); background: var(--glass-2); font-size: 14px; }
.asset-chip.is-sm { font-size: 13px; gap: 5px; }
.asset-amount { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

/* stock logo disc (js/ui/logo.js) */
.logo-disc {
  --size: 20px;
  display: inline-grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden; flex: none;
  background: #fff; color: var(--brand); font-size: calc(var(--size) * 0.46); font-weight: 800; line-height: 1;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.logo-disc img { width: 100%; height: 100%; object-fit: cover; }
.logo-disc[data-fallback] { background: linear-gradient(135deg, #3442ff, #111bc4); color: #fff; }

/* ------------------------------------------------------------------ tabs
 * <div class="tabs" role="tablist"><button role="tab" aria-selected="true">Links</button>...</div>
 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs > [role="tab"], .tabs > a, .tabs > button {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 0; background: none;
  color: var(--muted); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
}
.tabs > [role="tab"]:hover, .tabs > a:hover, .tabs > button:hover { color: var(--ink); }
.tabs > [aria-selected="true"], .tabs > .is-active { color: var(--ink); }
.tabs > [aria-selected="true"]::after, .tabs > .is-active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--glow), transparent); box-shadow: 0 0 12px var(--glow);
}
.tabs .count { font-family: var(--mono); font-size: 12px; color: var(--faint); }

/* ------------------------------------------------------------------ glass surfaces (use sparingly; never nest) */
.glass {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.card { padding: 24px; }
.card.glass, .glass.card { position: relative; }
.card-sm { padding: 18px; border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.card-glow { position: relative; isolation: isolate; }
.card-glow::before { content: ''; position: absolute; inset: -30% 0 auto; height: 70%; z-index: -1; background: radial-gradient(closest-side, rgba(52, 66, 255, 0.35), transparent); filter: blur(10px); pointer-events: none; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line-2), transparent); border: 0; margin: 20px 0; }
@media (max-width: 760px) { .card { padding: 18px; } .glass { border-radius: 20px; } }

/* ------------------------------------------------------------------ KPI tiles
 * <div class="kpis"><div class="kpi"><span class="kpi-label">Received</span><strong class="kpi-value">$1,204</strong>
 *   <span class="kpi-delta is-up">+12%</span><span class="kpi-sub">vs last month</span></div></div>
 */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: var(--radius-l); background: var(--glass); border: 1px solid var(--line); min-width: 0; overflow: hidden; }
.kpi::after { content: ''; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--c, var(--brand-hi)) 40%, transparent), transparent); pointer-events: none; }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(22px, 2.4vw, 28px); font-weight: 500; color: var(--ink); letter-spacing: -0.03em; line-height: 1.1; overflow-wrap: anywhere; }
.kpi-sub { font-size: 12.5px; color: var(--faint); }
.kpi-delta { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-delta.is-up { color: var(--ok); }
.kpi-delta.is-down { color: var(--bad); }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 14px 16px; border-radius: 18px; } }
@media (max-width: 340px) { .kpis { grid-template-columns: minmax(0, 1fr); } }

/* split bar: <div class="split-bar"><i style="--w:70%;--c:var(--dest-wallet)"></i>...</div> */
.split-bar { display: flex; height: 8px; border-radius: var(--pill); overflow: hidden; background: rgba(170, 182, 255, 0.12); gap: 2px; }
.split-bar > i { display: block; width: var(--w); background: var(--c); box-shadow: 0 0 12px var(--c); transition: width 320ms var(--ease); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }

/* meter: <div class="meter" style="--w:60%"><i></i></div> */
.meter { height: 6px; border-radius: var(--pill); background: rgba(170, 182, 255, 0.14); overflow: hidden; }
.meter > i { display: block; height: 100%; width: var(--w, 0%); background: var(--grad); box-shadow: 0 0 12px var(--glow); border-radius: inherit; transition: width 320ms var(--ease); }

/* ------------------------------------------------------------------ tables (rows become cards on phones)
 * <table class="table"><thead>...</thead><tbody><tr><td data-label="Amount">...</td></tr></tbody></table>
 */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px; border-bottom: 1px solid rgba(170, 182, 255, 0.07); color: var(--body); vertical-align: middle; }
.table tbody tr { transition: background-color var(--dur) var(--ease); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table .num, .table td.num, .table th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table td.ink, .table td strong { color: var(--ink); }
.table tr.is-link { cursor: pointer; }
@media (max-width: 760px) {
  .table.is-cards thead, .table-cards thead { display: none; }
  .table.is-cards, .table.is-cards tbody, .table.is-cards tr, .table.is-cards td,
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table.is-cards tr, .table-cards tr { padding: 14px 16px; margin-bottom: 10px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); }
  .table.is-cards td, .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border: 0; text-align: right; min-width: 0; }
  .table.is-cards td::before, .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; }
  .table.is-cards td[data-label=""]::before, .table-cards td[data-label=""]::before, .table.is-cards td:not([data-label])::before, .table-cards td:not([data-label])::before { content: none; }
  .table.is-cards td.cell-main, .table-cards td.cell-main { justify-content: flex-start; text-align: left; font-size: 16px; padding-bottom: 8px; }
  .table.is-cards td.num, .table-cards td.num { text-align: right; }
}

/* ------------------------------------------------------------------ stepper (approve then pay)
 * js/ui/stepper.js stepper([{ key, title, sub }]) -> { el, set(key, state, sub) }   state: idle|active|done|error
 */
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 14px; padding: 0 0 18px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ''; position: absolute; left: 16px; top: 34px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-dot { grid-row: span 2; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line-2); color: var(--muted); font-family: var(--mono); font-size: 13px; font-weight: 600; transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), color var(--dur) var(--ease); }
.step-dot .icon { width: 16px; height: 16px; }
.step-title { color: var(--body); font-weight: 600; padding-top: 6px; }
.step-sub { color: var(--muted); font-size: 13px; min-height: 0; overflow-wrap: anywhere; }
.step-sub a { color: var(--ice); }
.step.is-active .step-dot { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 0 0 5px rgba(52, 66, 255, 0.18), 0 0 22px rgba(52, 66, 255, 0.7); }
.step.is-active .step-title { color: var(--ink); }
.step.is-done .step-dot { background: var(--ok-tint); color: var(--ok); border-color: rgba(67, 223, 174, 0.4); }
.step.is-done::before { background: linear-gradient(180deg, rgba(67, 223, 174, 0.6), var(--line)); }
.step.is-error .step-dot { background: var(--bad-tint); color: var(--bad); border-color: rgba(255, 111, 142, 0.45); }
.step.is-error .step-sub { color: var(--bad); }
.stepper.is-inline { flex-direction: row; gap: 10px; flex-wrap: wrap; }
.stepper.is-inline .step { grid-template-columns: 28px auto; padding: 0; align-items: center; }
.stepper.is-inline .step::before { display: none; }
.stepper.is-inline .step-dot { width: 28px; height: 28px; grid-row: auto; }
.stepper.is-inline .step-title { padding: 0; font-size: 14px; }
.stepper.is-inline .step-sub { display: none; }

/* ------------------------------------------------------------------ receipt (a ticket with a perforated edge)
 * js/ui/receipt.js receipt({ title, amount, asset, rows: [[label, value]], tx, note, actions }) -> element
 */
.receipt {
  --notch: 12px;
  position: relative; max-width: 440px; margin: 0 auto; padding: 30px 26px 24px; border-radius: var(--radius-l);
  background: linear-gradient(180deg, rgba(52, 66, 255, 0.16), rgba(255, 255, 255, 0.035) 40%);
  border: 1px solid var(--line-2); text-align: center; isolation: isolate;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.receipt-badge { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 0 0 8px rgba(52, 66, 255, 0.14), 0 0 40px rgba(52, 66, 255, 0.75); }
.receipt-badge .icon { width: 30px; height: 30px; }
.receipt.is-ok .receipt-badge { background: linear-gradient(135deg, #43dfae, #1f9f7a); box-shadow: 0 0 0 8px rgba(67, 223, 174, 0.12), 0 0 40px rgba(67, 223, 174, 0.55); }
.receipt-title { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.receipt-amount { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(30px, 6vw, 40px); font-weight: 500; color: var(--ink); letter-spacing: -0.03em; margin-bottom: 18px; overflow-wrap: anywhere; }
.receipt-amount img { width: 30px; height: 30px; }
.receipt-perf { position: relative; height: 1px; margin: 4px calc(-26px) 18px; border-top: 1px dashed var(--line-2); }
.receipt-perf::before, .receipt-perf::after { content: ''; position: absolute; top: calc(var(--notch) * -1); width: calc(var(--notch) * 2); height: calc(var(--notch) * 2); border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); }
.receipt-perf::before { left: calc(var(--notch) * -1 - 1px); clip-path: inset(0 0 0 50%); }
.receipt-perf::after { right: calc(var(--notch) * -1 - 1px); clip-path: inset(0 50% 0 0); }
.receipt-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; margin: 0; text-align: left; font-size: 14px; }
.receipt-rows dt { color: var(--muted); }
.receipt-rows dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; min-width: 0; }
.receipt-rows dd.mono { font-size: 13px; }
.receipt-note { margin: 18px 0 0; font-size: 13px; color: var(--muted); }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 20px; }
@media print {
  .receipt { background: #fff; color: #000; border-color: #ccc; box-shadow: none; }
  .receipt-perf::before, .receipt-perf::after { background: #fff; }
}

/* ------------------------------------------------------------------ toasts (js/ui/toast.js notify) */
.toast {
  position: fixed; z-index: 90; left: 24px; bottom: calc(24px + var(--safe-b)); max-width: min(440px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 16px; border-radius: 18px;
  background: rgba(11, 15, 58, 0.92); border: 1px solid var(--line-2); color: var(--ink); font-size: 14.5px;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(109, 123, 255, 0.08);
  animation: toast-in 260ms var(--ease);
}
.toast > .icon { width: 20px; height: 20px; color: var(--ice); flex: none; }
.toast.is-ok > .icon { color: var(--ok); }
.toast.is-bad > .icon { color: var(--bad); }
.toast.is-bad { border-color: rgba(255, 111, 142, 0.4); }
.toast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.toast-text a { color: var(--ice); text-decoration: underline; text-underline-offset: 3px; }
.toast-action { flex: none; border: 0; background: var(--glass-2); color: var(--ink); border-radius: var(--pill); min-height: 34px; padding: 0 12px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.toast-action:hover { background: var(--glass-3); }
.toast-close { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--glass-2); color: var(--ink); }
.toast-close .icon { width: 16px; height: 16px; }
.toast.is-leaving { animation: toast-out 180ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }
@media (max-width: 760px) { .toast { left: 16px; right: 16px; max-width: none; bottom: calc(16px + var(--safe-b)); } body.has-action-bar .toast { bottom: calc(96px + var(--safe-b)); } }

/* ------------------------------------------------------------------ sheets (js/ui/sheet.js openSheet) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center;
  background: var(--scrim); opacity: 0; transition: opacity 200ms var(--ease);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sheet-backdrop.is-open { opacity: 1; }
.sheet-backdrop.is-closing { opacity: 0; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d1248, #070a2e 40%); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 0 0 var(--safe-b); outline: none;
  box-shadow: 0 -20px 60px -10px rgba(0, 0, 0, 0.6), 0 -1px 0 rgba(255, 255, 255, 0.06) inset;
  transform: translateY(24px); transition: transform 260ms var(--ease);
}
.sheet-backdrop.is-open .sheet { transform: none; }
.sheet-backdrop.is-closing .sheet { transform: translateY(40px); }
.sheet-handle { display: grid; place-items: center; height: 26px; cursor: grab; touch-action: none; flex: none; }
.sheet-handle i { width: 42px; height: 5px; border-radius: 5px; background: rgba(170, 182, 255, 0.32); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 0 20px 12px; flex: none; }
.sheet-head h2 { margin: 2px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.sheet-close { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--glass-2); color: var(--body); cursor: pointer; }
.sheet > .sheet-close { position: absolute; right: 14px; top: 14px; z-index: 1; }
.sheet-close:hover { background: var(--glass-3); color: #fff; }
.sheet-close .icon { width: 18px; height: 18px; }
.sheet-body { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
@media (min-width: 761px) {
  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: var(--radius-l); border-bottom: 1px solid var(--line-2); max-height: 86vh; transform: translateY(12px) scale(0.985); }
  .sheet-handle { visibility: hidden; height: 18px; }
}

/* ------------------------------------------------------------------ dialogs (js/ui/dialog.js, js/ui/wallet-modal.js) */
dialog.modal {
  width: min(480px, calc(100vw - 32px)); max-height: min(86vh, 760px); padding: 28px; margin: auto; overflow-y: auto;
  border-radius: var(--radius-l); border: 1px solid var(--line-2); color: var(--body);
  background: linear-gradient(180deg, #0f1550, #070a2e 55%);
  box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(109, 123, 255, 0.08), 0 0 80px -20px rgba(52, 66, 255, 0.45);
  animation: modal-in 240ms var(--ease);
}
dialog.modal::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.modal h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 8px 40px 8px 0; }
dialog.modal .eyebrow { margin-top: 2px; }
.modal-close { position: absolute; right: 16px; top: 16px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--glass-2); color: var(--body); cursor: pointer; }
.modal-close:hover { background: var(--glass-3); color: #fff; }
.modal-close .icon { width: 18px; height: 18px; }
.modal-lead { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form label { display: flex; flex-direction: column; gap: 7px; font-weight: 600; font-size: 13.5px; }
.modal-form input { width: 100%; min-height: 48px; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(6, 8, 40, 0.6); color: var(--ink); font-size: 16px; outline: none; }
.modal-form input:focus { border-color: rgba(109, 123, 255, 0.7); box-shadow: 0 0 0 4px rgba(52, 66, 255, 0.22); }
.modal-error { color: var(--bad); font-size: 13.5px; margin: 0; }
.modal-error:empty { display: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.modal-foot { margin: 18px 0 0; font-size: 12.5px; color: var(--faint); display: flex; align-items: center; gap: 8px; justify-content: center; }
dialog.modal-small { width: min(420px, calc(100vw - 32px)); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@media (max-width: 760px) {
  dialog.modal { padding: 24px 20px calc(20px + var(--safe-b)); margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 26px 26px 0 0; border-bottom: 0; max-height: 90dvh; animation: sheet-up 260ms var(--ease); }
  .modal-actions > .btn { flex: 1 1 auto; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } }

/* ------------------------------------------------------------------ wallet modal */
.wallet-list { display: flex; flex-direction: column; gap: 8px; }
.wallet-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 14px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink); text-align: left; cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.wallet-row:hover { background: rgba(52, 66, 255, 0.14); border-color: rgba(109, 123, 255, 0.45); }
.wallet-row:active { transform: scale(0.99); }
.wallet-row:disabled { opacity: 0.55; cursor: wait; }
.wallet-icon { width: 36px; height: 36px; border-radius: 11px; flex: none; object-fit: cover; }
.wallet-icon.is-generic { display: grid; place-items: center; background: var(--grad); color: #fff; }
.wallet-icon.is-generic .icon { width: 18px; height: 18px; }
.wallet-name { flex: 1 1 auto; display: flex; flex-direction: column; font-weight: 600; min-width: 0; }
.wallet-name small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.wallet-go { color: var(--faint); width: 18px; height: 18px; }
.wallet-status { margin: 6px 2px 0; font-size: 13.5px; color: var(--muted); min-height: 0; }
.wallet-status:empty { display: none; }
.wallet-chain { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 4px 0; }
.wallet-chain-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--warn-tint); color: var(--warn); }
.wallet-chain strong { color: var(--ink); font-size: 17px; }
.wallet-chain p { margin: 0; color: var(--muted); font-size: 14.5px; }
.wallet-chain-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.wallet-orb { position: relative; width: 64px; height: 64px; margin: 0 0 14px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4b58ff, #111bc4 70%); box-shadow: 0 0 0 8px rgba(52, 66, 255, 0.12), 0 0 40px rgba(52, 66, 255, 0.6); }
.wallet-orb svg.mark { width: 36px; height: auto; }

/* wallet gate (pages that need a connected wallet): <section class="gate">... walletList().el ...</section> */
.gate { max-width: 460px; margin: 6vh auto 0; padding: 32px 28px; text-align: center; }
.gate .wallet-orb { margin: 0 auto 16px; }
.gate h1, .gate h2 { font-size: clamp(26px, 4vw, 34px); font-weight: 300; margin-bottom: 8px; }
.gate p { color: var(--muted); }
.gate .wallet-list { text-align: left; margin-top: 18px; }

/* ------------------------------------------------------------------ menus (js/ui/menu.js) */
.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-pop {
  position: fixed; z-index: 85; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px; border-radius: 18px;
  background: rgba(11, 15, 58, 0.96); border: 1px solid var(--line-2);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.75); outline: none; animation: modal-in 160ms var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--body); font-size: 14.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--glass-2); color: var(--ink); outline: none; }
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-item.is-danger { color: var(--bad); }
.menu-item.is-danger .icon { color: var(--bad); }
.menu-item:disabled { opacity: 0.5; cursor: not-allowed; }
.menu-label { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.menu-label small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.menu-gap { width: 18px; flex: none; }
.menu-check { color: var(--ok) !important; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-heading { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.menu kbd { font-size: 12px; color: var(--faint); }
.menu-in-sheet .menu-item { min-height: 52px; font-size: 16px; }

/* ------------------------------------------------------------------ empty states and skeletons
 * js/ui/empty.js empty({ icon, title, body, action }) -> element
 */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; }
.empty-orb { position: relative; width: 72px; height: 72px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; color: var(--ice); background: radial-gradient(circle at 35% 30%, rgba(109, 123, 255, 0.4), rgba(17, 27, 196, 0.18) 60%, transparent 72%); }
.empty-orb::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 1px dashed rgba(170, 182, 255, 0.22); animation: spin 30s linear infinite; }
.empty-orb::after { content: ''; position: absolute; width: 6px; height: 6px; top: -12px; left: 50%; border-radius: 50%; background: var(--glow); box-shadow: 0 0 10px var(--glow); transform-origin: 0 48px; animation: orbit 6s linear infinite; }
.empty-orb .icon { width: 28px; height: 28px; }
.empty h3 { margin: 0; font-size: 18px; font-weight: 600; }
.empty p { margin: 0; color: var(--muted); max-width: 40ch; font-size: 14.5px; }
.empty .btn { margin-top: 14px; }
.empty-sm { padding: 24px 12px; }
.empty-sm .empty-orb { width: 52px; height: 52px; }
.empty-sm .empty-orb .icon { width: 22px; height: 22px; }
.empty-sm .empty-orb::after { transform-origin: 0 38px; }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.skel { position: relative; overflow: hidden; border-radius: 10px; background: rgba(170, 182, 255, 0.08); color: transparent !important; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(170, 182, 255, 0.12), transparent); animation: shimmer 1.4s var(--ease) infinite; }
.skel-line { display: block; height: 12px; margin: 8px 0; }
.skel-line.is-lg { height: 26px; width: 60%; }
.skel-circle { display: inline-block; width: 36px; height: 36px; border-radius: 50%; }
.skel-block { display: block; height: 120px; border-radius: var(--radius); }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ------------------------------------------------------------------ QR (js/ui/qr.js qrSvg) */
.qr { display: inline-grid; place-items: center; padding: 12px; border-radius: 20px; background: #fff; box-shadow: 0 0 0 6px rgba(52, 66, 255, 0.12), 0 0 40px -6px rgba(52, 66, 255, 0.6); }
.qr svg { width: var(--qr, 168px); height: var(--qr, 168px); }

/* ------------------------------------------------------------------ sticky bottom action bar (phones)
 * <div class="action-bar"><div class="action-bar-info">...</div><button class="btn btn-primary">Pay</button></div>
 * Add body.has-action-bar so toasts sit above it. On desktop it is a normal row.
 */
.action-bar { display: flex; align-items: center; gap: 12px; }
.action-bar-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.action-bar-info strong { font-family: var(--mono); color: var(--ink); font-size: 17px; font-weight: 500; }
@media (max-width: 760px) {
  .action-bar {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b));
    background: rgba(5, 7, 32, 0.9); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  }
  .action-bar > .btn { flex: 1 1 auto; min-height: 52px; }
  body.has-action-bar main { padding-bottom: calc(96px + var(--safe-b)); }
  /* A bar that sits inside a card lives in that card's stacking context (.card-glow isolates), below the footer that
     follows it: lift that card over the footer, or the footer's text paints across the bar while it scrolls past. */
  body.has-action-bar main :has(> .action-bar) { z-index: 1; }
  /* the bar is fixed over the end of the page: the footer's last line must scroll clear of it too */
  body.has-action-bar .foot { padding-bottom: calc(128px + var(--safe-b)); }
}

/* ------------------------------------------------------------------ asset picker (js/ui/asset-picker.js) */
.asset-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 8px; border-radius: var(--pill); border: 1px solid var(--line-2); background: var(--glass-2); color: var(--ink); font-weight: 600; cursor: pointer; max-width: 100%; }
.asset-btn:hover { background: var(--glass-3); }
.asset-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.asset-sym { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-chev { width: 16px; height: 16px; color: var(--muted); }
.asset-pop { position: fixed; z-index: 85; display: flex; flex-direction: column; overflow: hidden; border-radius: 20px; background: rgba(11, 15, 58, 0.97); border: 1px solid var(--line-2); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.75); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); animation: modal-in 160ms var(--ease); }
.asset-pop-body { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.asset-searchrow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
.asset-search { flex: 1 1 auto; min-width: 0; min-height: 40px; border: 0; background: transparent; color: var(--ink); font-size: 16px; outline: none; }
.asset-holder { overflow-y: auto; overscroll-behavior: contain; padding: 6px; flex: 1 1 auto; min-height: 0; }
.asset-list { display: flex; flex-direction: column; gap: 2px; }
.asset-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.asset-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--body); text-align: left; cursor: pointer; }
.asset-opt:hover, .asset-opt:focus-visible { background: var(--glass-2); outline: none; color: var(--ink); }
.asset-opt.is-current { background: rgba(52, 66, 255, 0.2); color: var(--ink); }
.asset-opt-text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.asset-opt-text strong { color: var(--ink); font-weight: 600; }
.asset-opt-text small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-feed { font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-tint); padding: 3px 7px; border-radius: var(--pill); }
.asset-empty { padding: 20px; text-align: center; color: var(--muted); margin: 0; }
.asset-sheet .sheet-body { padding: 0; display: flex; flex-direction: column; min-height: 50vh; }

/* ------------------------------------------------------------------ the shell: nav */
.nav {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0; height: calc(var(--nav-h) + var(--safe-t)); padding-top: var(--safe-t);
  transition: background-color 260ms var(--ease), border-color 260ms var(--ease), -webkit-backdrop-filter 260ms var(--ease), backdrop-filter 260ms var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled, .nav.is-solid {
  background: rgba(3, 4, 26, 0.72); border-bottom-color: var(--line);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.nav-row { height: var(--nav-h); display: flex; align-items: center; gap: 14px; }
.nav-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; flex: none; min-height: 44px; }
.nav-brand:hover { color: #fff; }
.nav-brand svg.mark { height: 24px; width: auto; filter: drop-shadow(0 0 10px rgba(109, 123, 255, 0.55)); transition: transform 600ms var(--ease); }
.nav-brand:hover svg.mark { transform: rotate(-24deg); }
.nav-word { font-size: 20px; font-weight: 600; letter-spacing: -0.03em; color: #fff; line-height: 1; }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 18px; min-width: 0; }
.nav-links a { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: var(--pill); color: var(--body); font-size: 14.5px; font-weight: 500; white-space: nowrap; transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.nav-links a:hover { color: #fff; background: var(--glass); }
.nav-links a.is-active, .nav-links a[aria-current="page"] { color: #fff; }
.nav-links a.is-active::after, .nav-links a[aria-current="page"]::after { content: ''; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 8px var(--glow); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.nav-x { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--body); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.nav-x:hover { color: #fff; background: var(--glass-2); }
.nav-x svg { width: 16px; height: 16px; }
.nav-menu-btn { display: none; }
.acct-chip {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 14px 0 12px; border-radius: var(--pill);
  border: 1px solid var(--line-2); background: var(--glass-2); color: var(--ink); font-family: var(--mono); font-size: 13.5px; font-weight: 500; cursor: pointer;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.acct-chip:hover { background: var(--glass-3); border-color: rgba(170, 182, 255, 0.4); }
.acct-chip .dot { width: 8px; height: 8px; }
.acct-chip.is-wrong .dot { --c: var(--warn); }
.acct-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.nav .wallet-btn { min-height: 40px; --btn-h: 40px; padding: 0 18px; font-size: 14.5px; }

.nav-sheet { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.nav-sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 220ms var(--ease); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.nav-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; padding: 8px 16px calc(20px + var(--safe-b));
  border-radius: 26px 26px 0 0; background: linear-gradient(180deg, #0f1550, #060828 50%); border: 1px solid var(--line-2); border-bottom: 0;
  transform: translateY(100%); transition: transform 300ms var(--ease);
}
.nav-sheet.is-open { pointer-events: auto; }
.nav-sheet.is-open .nav-sheet-scrim { opacity: 1; }
.nav-sheet.is-open .nav-sheet-panel { transform: none; }
.nav-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 10px; }
.nav-sheet-links { display: flex; flex-direction: column; gap: 2px; }
.nav-sheet-links a { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 0 14px; border-radius: 16px; color: var(--ink); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.nav-sheet-links a .icon { width: 20px; height: 20px; color: var(--muted); }
.nav-sheet-links a:hover, .nav-sheet-links a.is-active { background: var(--glass-2); }
.nav-sheet-links a.is-active .icon { color: var(--ice); }
.nav-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 14px 4px 0; border-top: 1px solid var(--line); }

@media (max-width: 1080px) { .nav-links a { padding: 0 9px; font-size: 14px; } .nav-links { margin-left: 8px; } }
@media (max-width: 960px) {
  .nav-links, .nav-right > .nav-x { display: none; }
  .nav-menu-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--glass-2); color: var(--ink); cursor: pointer; padding: 0; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  .nav-menu-btn .icon { width: 20px; height: 20px; }
}
@media (max-width: 760px) {
  .nav-brand svg.mark { height: 22px; }
  .nav-word { font-size: 19px; }
  .nav-right { gap: 6px; }
  .nav .wallet-btn { padding: 0 14px; font-size: 14px; min-height: 44px; --btn-h: 44px; }
  .acct-chip { min-height: 44px; padding: 0 12px; font-size: 13px; }
}
@media (max-width: 380px) {
  .nav-row { gap: 8px; }
  .nav-word { font-size: 18px; }
  .nav .wallet-btn .wallet-btn-long { display: none; }
  .acct-chip .icon { display: none; }
}
@media (max-width: 340px) { .nav-word { display: none; } }

/* ------------------------------------------------------------------ the shell: footer */
.foot { position: relative; margin-top: 80px; padding: 56px 0 calc(32px + var(--safe-b)); color: var(--muted); font-size: 14.5px; isolation: isolate; }
.foot::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--line-2) 30%, var(--line-2) 70%, transparent); }
.foot::after { content: ''; position: absolute; left: 50%; top: 0; width: min(720px, 90vw); height: 220px; transform: translate(-50%, -50%); z-index: -1; background: radial-gradient(closest-side, rgba(52, 66, 255, 0.18), transparent); pointer-events: none; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr); gap: 32px 48px; align-items: start; }
.foot-brand { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.foot-lockup { display: inline-flex; align-items: center; gap: 10px; color: #fff; }
.foot-lockup svg.mark { height: 26px; width: auto; }
.foot-lockup span { font-size: 21px; font-weight: 600; letter-spacing: -0.03em; }
.foot-tag { margin: 0; color: var(--muted); max-width: 32ch; }
.foot-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.foot-col h4 { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 0 0 12px; }
.foot-col a { display: flex; align-items: center; gap: 8px; min-height: 34px; color: var(--body); }
.foot-col a:hover { color: #fff; }
.foot-col a svg { width: 14px; height: 14px; }
.foot-token { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 36px; padding: 14px 16px; border-radius: var(--pill); background: var(--glass); border: 1px solid var(--line); width: fit-content; max-width: 100%; }
.tk-chip { display: inline-flex; align-items: center; gap: 8px; padding: 0 6px 0 2px; color: var(--ink); font-weight: 700; letter-spacing: -0.01em; }
.tk-chip i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; box-shadow: 0 0 14px rgba(52, 66, 255, 0.6); }
.tk-chip i svg.mark { height: 12px; width: auto; }
.foot-token .btn { --btn-h: 38px; padding: 0 14px; font-size: 13.5px; }
.foot-token .btn .soon { margin-left: 2px; }
.foot-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; color: var(--faint); font-size: 13.5px; }
.foot-chain { display: inline-flex; align-items: center; gap: 8px; }
@media (max-width: 359px) { .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 760px) {
  .foot { margin-top: 56px; padding-top: 40px; }
  .foot-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .foot-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
  .foot-col a { min-height: 44px; }
  .foot-token { border-radius: 22px; width: 100%; }
  .foot-token .tk-chip { flex: 1 0 100%; }
  .foot-token .btn { flex: 1 1 0; min-height: 44px; --btn-h: 44px; }
}

/* ------------------------------------------------------------------ reveal on scroll (js/ui/reveal.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); transition-delay: var(--d, 0ms); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ print */
@media print {
  .nav, .foot, .toast, .action-bar, .nav-sheet { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
}

/* wallet slot placeholder while the shell reconnects a remembered wallet */
.nav-wallet { display: flex; align-items: center; }
.wallet-skel { display: block; width: 150px; height: 40px; border-radius: var(--pill); }
@media (max-width: 760px) { .wallet-skel { width: 112px; height: 44px; } }

/* ------------------------------------------------------------------ tap targets on phones (SPEC section 2: 44 px)
 * At 760 px and under every shared control a thumb presses has a hit area of at least 44 x 44 px. The gate is
 * `node tools/verify.mjs --only=tap` (it measures the hit area from the centre of each control, not the box).
 * Pages need no overrides of their own for these primitives. Static chips (span.chip) keep their 28 px.
 */
@media (max-width: 760px) {
  .btn-sm { --btn-h: 44px; }
  .range { min-height: 44px; }             /* a page may draw a slimmer slider row on desktop; a thumb still gets 44 px */
  .seg > button, .seg > label { min-height: 44px; min-width: 44px; }
  button.chip, a.chip { height: auto; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 14px; }
  .sheet-close, .modal-close, .toast-close { width: 44px; height: 44px; }
  .toast-action { min-height: 44px; }
  .asset-search { min-height: 44px; }
  .link-quiet { min-height: 44px; }
  .nav-x { width: 44px; height: 44px; }
  .nav-brand { min-width: 44px; }           /* at 340 px and under the wordmark hides and the mark alone is 32 px wide */
  .foot-lockup { min-height: 44px; }
}
