/* ==========================================================================
   STOXVAULT — components
   Everything here is state-driven from markup attributes so the JS layer only
   ever sets: data-state, data-mode, data-dir, data-status, data-ok,
   data-picked, aria-*, hidden, and a handful of is-* classes documented in
   web/DOM.md.
   ========================================================================== */

/* ==========================================================================
   1. Pane state machine  (loading | ready | empty | error)
   Put data-state on the SMALLEST container that owns the states.
   Children opt into a state with .pane + .pane--<state>.
   Override the shown display type with .pane-as-grid / -flex / -tbody.
   ========================================================================== */
[data-state] > .pane { display: none; }
[data-state="ready"]   > .pane--ready   { display: var(--pane-display, block); }
[data-state="empty"]   > .pane--empty   { display: var(--pane-display, block); }
[data-state="error"]   > .pane--error   { display: var(--pane-display, block); }
[data-state="loading"] > .pane--loading { display: var(--pane-display, block); }

.pane-as-grid  { --pane-display: grid; }
.pane-as-flex  { --pane-display: flex; }
.pane-as-tbody { --pane-display: table-row-group; }

/* Inline skeletons: a value that keeps its own markup and is masked while the
   nearest [data-state] ancestor is loading. Reset rules come first on purpose,
   so a widget refreshing inside a ready page still shows its skeleton. */
[data-state="ready"] .skel-text,
[data-state="empty"] .skel-text,
[data-state="error"] .skel-text {
  background: none;
  color: inherit;
  animation: none;
}
[data-state="loading"] .skel-text {
  color: transparent;
  background: var(--skel);
  border-radius: var(--radius-sm);
  animation: skel-pulse 1.5s var(--ease) infinite;
  user-select: none;
  pointer-events: none;
}
[data-state="loading"] .skel-text > * { visibility: hidden; }
[data-state="loading"] .numeral__value.skel-text { display: inline-block; min-width: 4ch; }
[data-state="loading"] .kvpair__val.skel-text    { display: inline-block; min-width: 72px; }
[data-state="loading"] .kv__val.skel-text        { display: inline-block; min-width: 86px; }

.skel {
  display: block;
  background: var(--skel);
  border-radius: var(--radius-sm);
  height: 10px;
}
/* One animation per loading pane, not one per bar. */
[data-state="loading"] > .pane--loading {
  animation: skel-pulse 1.6s var(--ease) infinite;
}
.skel--sm   { height: 8px; }
.skel--lg   { height: 16px; }
.skel--pill { border-radius: var(--radius-pill); }
.skel--circle { border-radius: 50%; height: 22px; width: 22px; }
.skel--w20  { width: 20%; }
.skel--w30  { width: 30%; }
.skel--w40  { width: 40%; }
.skel--w50  { width: 50%; }
.skel--w60  { width: 60%; }
.skel--w70  { width: 70%; }
.skel--w80  { width: 80%; }
.skel--w100 { width: 100%; }

@keyframes skel-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* ==========================================================================
   2. Cards — dark panels a shade above the page, hairline border, generous
   padding, 14px radius. No drop shadows anywhere.
   ========================================================================== */
.card {
  position: relative;
  background-color: var(--surface);
  background-image: var(--card-wash);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--s-3);
  min-width: 0;
}
.card--list  { padding-inline: var(--s-3); }
.card__eyebrow { margin-bottom: var(--s-2); }
.card__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: var(--ink);
  min-width: 0;
}
.card__sub {
  margin-top: var(--s-1);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}
.card__block {
  margin-top: var(--s-3);
  padding-top: var(--s-2);
  border-top: var(--hairline) solid var(--rule-soft);
  display: grid;
  gap: var(--s-15);
}
.card__foot {
  margin-top: var(--s-3);
  padding-top: var(--s-15);
  border-top: var(--hairline) solid var(--rule-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-1) var(--s-2);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* Big mono figures: the vault balance, the countdown, the holder count. */
.numeral {
  display: flex;
  align-items: baseline;
  gap: var(--s-1);
  margin-top: var(--s-1);
  min-width: 0;
}
.numeral__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "zero" 1;
  font-size: var(--fs-numeral);
  font-weight: var(--fw-medium);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--gold-bright);
  /* a display numeral takes a value, not a sentence (DOM.md §16) — but if a
     long string ever lands here it wraps inside the card instead of pushing
     the page sideways */
  min-width: 0;
  overflow-wrap: anywhere;
}
.numeral--time .numeral__value {
  font-size: var(--fs-numeral-sm);
  letter-spacing: -0.01em;
}
.numeral__unit {
  font-size: 1.125rem;
  font-weight: var(--fw-semi);
  color: var(--gold-label);
  letter-spacing: 0.02em;
}

/* thin gold progress bar */
.meter {
  position: relative;
  display: block;
  height: 4px;
  width: 100%;
  margin-top: var(--s-3);
  border-radius: var(--radius-pill);
  background: var(--rule);
  overflow: hidden;
}
.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  transition: width var(--dur-slow) var(--ease), background var(--dur) var(--ease);
}
.meter[data-ok="false"] .meter__fill { background: var(--ink-4); }
.meter[data-ok="true"]  .meter__fill { background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright)); }

/* two figures side by side under a bar */
.kvpair {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding-top: var(--s-15);
}
.kvpair--ruled { border-top: var(--hairline) solid var(--rule-soft); margin-top: var(--s-3); }
.kvpair__cell { display: grid; gap: var(--s-05); min-width: 0; }
.kvpair__cell--end { text-align: right; justify-items: end; }
.kvpair__val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--ink);
  letter-spacing: 0.01em;
}

/* ==========================================================================
   3. Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-1);
  height: 34px;
  padding-inline: var(--s-2);
  border: var(--hairline) solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; }

/* The primary button is a solid gold bar with near-black text. */
.btn--primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  border-color: var(--gold);
  color: var(--accent-ink);
  font-weight: var(--fw-semi);
}
.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #FBE29A, var(--accent-hover));
  border-color: var(--accent-hover);
}
.btn--primary:active:not(:disabled) {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
}
.btn--primary:disabled {
  background: var(--surface-3);
  border-color: var(--rule);
  color: var(--ink-3);
  opacity: 1;
}

.btn--ink {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--ink-invert);
}
.btn--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn--quiet:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }

.btn--sm { height: 30px; padding-inline: var(--s-15); font-size: var(--fs-xs); }
.btn--lg { height: 46px; font-size: var(--fs-body); border-radius: var(--radius); }
.btn--block { width: 100%; }

.btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--ink-3);
}
.btn--icon:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.btn--icon.btn--sm { width: 30px; height: 30px; }
.btn__icon { width: 16px; height: 16px; flex: 0 0 auto; }
.btn__icon--sm { width: 13px; height: 13px; }

/* Copy buttons flash a confirmation set by JS: .is-copied for ~1.2s */
.btn.is-copied {
  border-color: var(--gold-line);
  background: var(--gold-wash);
  color: var(--gold-bright);
}

/* ==========================================================================
   4. Pills, badges, chips, dots
   ========================================================================== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding-inline: var(--s-1) var(--s-15);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
}
.pill__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  flex: 0 0 auto;
}
.pill[data-mode="LIVE"]      .pill__dot { background: var(--wallet-dot); animation: pulse-dot 2.4s var(--ease) infinite; }
.pill[data-mode="DRY_RUN"]   .pill__dot { background: var(--sim); }
.pill[data-mode="READ_ONLY"] .pill__dot { background: var(--warn); }
.pill[data-mode="OFFLINE"]   .pill__dot { background: var(--down); }
.pill[data-mode="LIVE"]      { border-color: var(--gold-line); }
.pill[data-mode="OFFLINE"]   { border-color: var(--down); color: var(--down); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* The wallet badge in the header: a dark pill, a small green dot, a
   truncated address. */
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding-inline: var(--s-15);
  border-radius: var(--radius-pill);
  border: var(--hairline) solid var(--rule);
  background: var(--purple-wash);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  white-space: nowrap;
}
.wallet-pill__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--wallet-dot);
  flex: 0 0 auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--s-1);
  border-radius: var(--radius-sm);
  border: var(--hairline) solid var(--rule);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.badge__key { color: var(--gold-label); letter-spacing: var(--ls-eyebrow); }
.badge--tba    { border-color: var(--rule); color: var(--ink-2); background: var(--surface-2); text-transform: none; letter-spacing: 0; }
.badge--sim    { border-color: var(--gold-line); background: var(--sim-wash); color: var(--sim); }
.badge--live   { border-color: var(--gold-line); background: var(--gold-wash); color: var(--gold-bright); }
.badge--warn   { border-color: transparent; background: var(--warn-wash); color: var(--warn); }
.badge--up     { border-color: transparent; background: var(--up-wash);   color: var(--up); }
.badge--down   { border-color: transparent; background: var(--down-wash); color: var(--down); }
.badge--muted  { border-color: transparent; background: var(--surface-3); color: var(--ink-3); }
.badge--wallet { border-color: transparent; background: var(--purple-wash); color: var(--purple-text); }

/* Round status uses the same chip, coloured by data-status */
.badge[data-status="DONE"]         { background: var(--up-wash);   color: var(--up);   border-color: transparent; }
.badge[data-status="SKIPPED"]      { background: var(--surface-3); color: var(--ink-3); border-color: transparent; }
.badge[data-status="FAILED"]       { background: var(--down-wash); color: var(--down); border-color: transparent; }
.badge[data-status="PENDING"],
.badge[data-status="SNAPSHOT"],
.badge[data-status="SWAPPING"],
.badge[data-status="DISTRIBUTING"] { background: var(--info-wash); color: var(--info); border-color: transparent; }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  border: var(--hairline) solid var(--gold-line);
  background: var(--gold-wash);
  color: var(--gold-bright);
  font-size: var(--fs-xs);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding-inline: var(--s-1);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
button.chip:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
button.chip:disabled { opacity: 0.4; }
.chip.is-selected {
  border-color: var(--gold-line);
  background: var(--gold-wash);
  color: var(--gold-bright);
}

/* ==========================================================================
   5. Logo slot (JS sets img src; monogram is the always-present fallback)
   ========================================================================== */
.logo-slot {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: var(--hairline) solid var(--rule);
  background: var(--surface-2);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: var(--fw-semi);
  color: var(--gold-label);
  letter-spacing: 0;
}
.logo-slot--xs { width: 16px; height: 16px; font-size: 7px; }
.logo-slot--lg { width: 32px; height: 32px; font-size: 11px; border-radius: var(--radius); }
.logo-slot__img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: var(--surface);
}
.logo-slot__img[hidden] { display: none; }

/* ==========================================================================
   5b. Direction colouring — the only green/red on the page. JS sets data-dir.
   ========================================================================== */
[data-dir="up"]   { color: var(--up); }
[data-dir="down"] { color: var(--down); }
[data-dir="flat"] { color: var(--ink-3); }

/* ==========================================================================
   6. Tables
   ========================================================================== */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  min-width: 0;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.table--picker { min-width: 360px; margin-top: var(--s-2); }
.table--ledger { min-width: 720px; margin-top: var(--s-2); }
.table--flush  { min-width: 0; }
/* With no rows there are no columns to size — let the empty/error block use
   the real viewport width instead of forcing a sideways scroll to read it. */
.table[data-state="empty"],
.table[data-state="error"] { min-width: 0; }

.table thead th {
  background: transparent;
  border-bottom: var(--hairline) solid var(--rule-soft);
  padding: var(--s-1) var(--s-15);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ink-4);
  white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; }
.table .col-tick { width: 40px; }
.table .col-rank { width: 64px; }

.table tbody td {
  padding: var(--s-1) var(--s-15);
  border-bottom: var(--hairline) solid var(--rule-soft);
  height: 46px;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-active { background: var(--gold-wash); }

.table tbody tr[data-clickable="true"] { cursor: pointer; }
.table tbody tr[data-clickable="true"]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}

.cell-identity {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.cell-identity__ticker {
  font-family: var(--font-mono);
  font-weight: var(--fw-semi);
  font-size: var(--fs-body);
  letter-spacing: 0.01em;
  color: var(--ink);
  justify-self: start;
}
.cell-identity__name {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank {
  font-family: var(--font-mono);
  color: var(--ink-4);
}
.rank::before { content: "#"; }

/* The picked state of a stock row: a gold wash and a gold left edge, exactly
   as in the frames. */
.stock-row[data-picked="true"] {
  background: var(--gold-wash);
}
.stock-row[data-picked="true"]:hover { background: var(--gold-wash-2); }

/* the checkbox-style control */
.tick {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  border: var(--hairline) solid var(--rule-strong);
  background: transparent;
  color: transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.tick__mark { width: 13px; height: 13px; }
.tick:hover { border-color: var(--gold-line); }
.tick[aria-checked="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--accent-ink);
}

/* Sortable headers: JS sets aria-sort on the th */
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}
.th-sort:hover { color: var(--ink-2); }
.th-sort__arrow { opacity: 0; transition: opacity var(--dur) var(--ease); }
th[aria-sort="ascending"]  .th-sort__arrow { opacity: 1; }
th[aria-sort="descending"] .th-sort__arrow { opacity: 1; transform: rotate(180deg); }
th[aria-sort="ascending"]  .th-sort,
th[aria-sort="descending"] .th-sort { color: var(--gold-label); }

.skel-row td { height: 46px; }

/* Expandable ledger rows */
.row-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  color: var(--ink-4);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.row-expand:hover { color: var(--ink); background: var(--surface-3); }
tr[aria-expanded="true"] .row-expand { transform: rotate(90deg); color: var(--gold-bright); }
tr.round-row[aria-expanded="true"] { background: var(--surface-2); }

.round-detail > td {
  padding: 0 !important;
  height: auto !important;
  background: var(--paper-sunk);
  border-bottom: var(--hairline) solid var(--rule);
}
.round-detail__inner {
  padding: var(--s-2);
  display: grid;
  gap: var(--s-2);
}

/* ==========================================================================
   7. Ticker tape
   ========================================================================== */
.tape {
  position: relative;
  height: var(--tape-h);
  background: var(--paper-sunk);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.tape__viewport {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  min-width: 0;
}
.tape__control {
  flex: 0 0 auto;
  border-left: var(--hairline) solid var(--rule);
  border-radius: 0;
}
.tape__track {
  display: flex;
  align-items: center;
  width: max-content;
  height: 100%;
  animation: tape-scroll var(--tape-speed) linear infinite;
  will-change: transform;
}
@keyframes tape-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
.tape:hover .tape__track,
.tape:focus-within .tape__track { animation-play-state: paused; }
.tape[data-paused="true"] .tape__track { animation-play-state: paused; }

.tape__item {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding-inline: var(--s-2);
  height: var(--tape-h);
  border-right: var(--hairline) solid var(--rule-soft);
  font-size: var(--fs-sm);
  white-space: nowrap;
}
.tape__symbol {
  font-family: var(--font-mono);
  font-weight: var(--fw-semi);
  color: var(--ink-2);
}
.tape__price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.tape__change {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
}
.tape__item .skel { width: 46px; height: 9px; }

.tape__empty {
  display: flex;
  align-items: center;
  height: var(--tape-h);
  padding-inline: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

/* ==========================================================================
   8. Round progress ring + snapshot state
   ========================================================================== */
.ring-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px; height: 96px;
  flex: 0 0 auto;
}
.ring svg { width: 100%; height: 100%; }
.ring__track {
  fill: none;
  stroke: var(--rule);
  stroke-width: 4;
}
.ring__arc {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dasharray var(--dur-slow) var(--ease);
}
.ring__pct {
  position: absolute;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--gold-bright);
}
.ring-row__text { display: grid; gap: 2px; min-width: 0; }
.ring-row__text .card__sub { margin-top: 0; }
.ring-row__status {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: var(--ink);
}

/* the snapshot moment, a state inside the next-round card */
.snapshot {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: var(--hairline) solid var(--rule-soft);
  display: grid;
  justify-items: center;
  gap: var(--s-1);
  text-align: center;
}
.snapshot__mark {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  color: var(--gold-bright);
  margin-bottom: var(--s-1);
}
.snapshot__mark svg { width: 24px; height: 24px; }
.snapshot__title {
  font-size: var(--fs-h2);
  font-weight: var(--fw-semi);
  color: var(--ink);
}
.snapshot__text {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  max-width: 34ch;
}
.snapshot__check {
  width: 100%;
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: var(--hairline) solid var(--rule-soft);
  text-align: left;
}

/* ==========================================================================
   9. Basket — allocation sliders
   ========================================================================== */
.alloc { margin-top: var(--s-2); }
.pick-list { display: grid; gap: var(--s-1); }
.pick {
  --pct: 20;
  padding: var(--s-15);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.pick.is-invalid { border-color: var(--down); }
.pick.is-stale   { border-color: var(--warn); }
.pick__top {
  display: flex;
  align-items: baseline;
  gap: var(--s-1);
}
.pick__id { min-width: 0; flex: 1 1 auto; }
.pick__ticker {
  font-size: var(--fs-body);
  font-weight: var(--fw-semi);
  color: var(--ink);
}
.pick__name {
  margin-left: 6px;
  font-size: var(--fs-xs);
  color: var(--ink-4);
}
.pick__pct {
  font-size: var(--fs-body);
  font-weight: var(--fw-semi);
  color: var(--gold-bright);
  flex: 0 0 auto;
}
.pick__remove {
  width: 20px; height: 20px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--ink-4);
  flex: 0 0 auto;
  align-self: center;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.pick__remove svg { width: 11px; height: 11px; }
.pick__remove:hover { color: var(--down); background: var(--surface-3); }
.pick__note {
  display: block;
  margin-top: var(--s-05);
  font-size: var(--fs-xs);
  color: var(--warn);
}

/* the slider. The filled portion is driven by --pct on the .pick, which JS
   sets alongside the input's value — no other inline style is written. */
.pick__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin-top: var(--s-1);
  background: transparent;
  cursor: pointer;
}
.pick__slider::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    var(--gold) 0 calc((var(--pct) - 10) / 50 * 100%),
    var(--rule) calc((var(--pct) - 10) / 50 * 100%) 100%);
}
.pick__slider::-moz-range-track {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--rule);
}
.pick__slider::-moz-range-progress {
  height: 3px;
  border-radius: var(--radius-pill);
  background: var(--gold);
}
.pick__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 0;
}
.pick__slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 0;
}
.pick__slider:focus-visible { outline-offset: 0; }

/* total row — turns gold at exactly 100% */
.total {
  display: flex;
  align-items: center;
  gap: var(--s-15);
  margin-top: var(--s-2);
  padding: var(--s-15);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.total__label { font-size: var(--fs-sm); color: var(--ink-2); flex: 0 0 auto; }
.total__meter { flex: 1 1 auto; margin-top: 0; }
.total__value {
  font-size: var(--fs-body);
  font-weight: var(--fw-semi);
  color: var(--ink-3);
  flex: 0 0 auto;
}
.total__value[data-ok="true"] { color: var(--gold-bright); }
.total:has(.total__value[data-ok="true"]) { border-color: var(--gold-line); }

.validation {
  display: block;
  margin-top: var(--s-1);
  margin-bottom: var(--s-2);
  font-size: var(--fs-sm);
  min-height: 1.4em;
  color: var(--ink-3);
}
.validation[data-level="error"] { color: var(--down); }
.validation[data-level="ok"]    { color: var(--gold-bright); }
.validation[data-level="warn"]  { color: var(--warn); }

.alloc__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  margin-top: var(--s-15);
}

.rules-list {
  display: grid;
  gap: var(--s-05);
  font-size: var(--fs-sm);
  color: var(--ink-3);
}
.rules-list li { display: flex; gap: var(--s-1); }
.rules-list li::before {
  content: "";
  flex: 0 0 auto;
  width: 4px; height: 4px;
  margin-top: 0.62em;
  border-radius: 50%;
  background: var(--gold-label);
}

/* stock picker (add to basket) */
.picker__search {
  width: 100%;
  height: 34px;
  padding-inline: var(--s-15);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-sm);
}
.picker__search::placeholder { color: var(--ink-4); }
.picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  max-height: 152px;
  overflow-y: auto;
  padding-top: var(--s-15);
}

/* ==========================================================================
   10. Key/value rows
   ========================================================================== */
.kv { display: grid; gap: 0; }
.kv__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-1) 0;
  border-bottom: var(--hairline) solid var(--rule-soft);
  font-size: var(--fs-sm);
}
.kv__row:last-child { border-bottom: 0; }
.kv__key { color: var(--ink-3); }
.kv__val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
}

/* ==========================================================================
   11. Community demand bars + the execution flow
   ========================================================================== */
.bars { display: grid; gap: var(--s-15); margin-top: var(--s-3); }
.bar-row { display: grid; gap: 6px; }
.bar-row__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--ink-2);
  min-width: 0;
}
.bar-row__track {
  position: relative;
  height: 8px;
  background: var(--rule);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.bar-row__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
  transition: width var(--dur-slow) var(--ease);
}
.bar-row.is-mine .bar-row__label { color: var(--gold-bright); }
.bar-row__value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.flow {
  display: grid;
  justify-items: center;
  gap: var(--s-1);
  margin-top: var(--s-4);
}
.flow__step {
  width: min(280px, 100%);
  padding: var(--s-2);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--gold-wash);
  text-align: center;
}
.flow__title { font-size: var(--fs-body); font-weight: var(--fw-semi); color: var(--ink); }
.flow__text  { margin-top: 4px; font-size: var(--fs-sm); color: var(--ink-3); }
.flow__arrow { color: var(--gold); }
.flow__arrow svg { width: 14px; height: 22px; }

/* ==========================================================================
   12. Arrivals card (rounds panel)
   ========================================================================== */
.card--arrivals { border-color: var(--gold-line); }
.arrivals { display: grid; gap: 0; margin-top: var(--s-2); }
.arrival {
  display: flex;
  align-items: center;
  gap: var(--s-15);
  padding: var(--s-15) 0;
  border-bottom: var(--hairline) solid var(--rule-soft);
}
.arrival:last-child { border-bottom: 0; }
.arrival__id { min-width: 0; flex: 1 1 auto; }
.arrival__ticker {
  display: block;
  font-size: var(--fs-body);
  font-weight: var(--fw-semi);
  color: var(--ink);
}
.arrival__name { display: block; font-size: var(--fs-xs); color: var(--ink-4); }
.arrival__amount {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--up);
  flex: 0 0 auto;
}

/* ==========================================================================
   13. Sparkline (still used in the drawer context)
   ========================================================================== */
.spark {
  display: inline-block;
  width: 84px;
  height: 24px;
  vertical-align: middle;
}
.spark svg { width: 100%; height: 100%; overflow: visible; }
.spark__line { fill: none; stroke: var(--ink-3); stroke-width: 1.25; vector-effect: non-scaling-stroke; }
.spark[data-dir="up"]   .spark__line { stroke: var(--up); }
.spark[data-dir="down"] .spark__line { stroke: var(--down); }
.spark__empty {
  display: block;
  height: 1px;
  width: 100%;
  background: var(--rule);
  margin-top: 11px;
}

/* ==========================================================================
   14. Address + copy + callouts
   ========================================================================== */
.addr {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  line-height: 1.35;
  color: var(--ink);
}
.addr--lg { font-size: var(--fs-addr); font-weight: var(--fw-medium); }
.addr--trunc { white-space: nowrap; word-break: normal; }

.addr-block {
  display: flex;
  align-items: center;
  gap: var(--s-15);
  padding: var(--s-2);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.addr-block .addr { flex: 1 1 auto; min-width: 0; }

.callout {
  border: var(--hairline) solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: var(--s-2);
  display: grid;
  gap: var(--s-1);
  margin-top: var(--s-2);
}
.callout--warn { border-left-color: var(--warn); }
.callout--info { border-left-color: var(--gold); }
.callout__title { font-size: var(--fs-h3); font-weight: var(--fw-semi); }
.callout__text  { font-size: var(--fs-sm); color: var(--ink-2); }

/* ==========================================================================
   15. Empty / error states
   ========================================================================== */
.state-block {
  display: grid;
  gap: var(--s-1);
  justify-items: start;
  padding: var(--s-3) 0;
  text-align: left;
}
.state-block--center { justify-items: center; text-align: center; }
.state-block__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: var(--ink);
}
.state-block__text {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  max-width: 52ch;
}
.state-block__actions { margin-top: var(--s-1); display: flex; gap: var(--s-1); }
td .state-block { padding-block: var(--s-4); padding-inline: var(--s-15); }

/* ==========================================================================
   16. Tabs (chart range, inside the drawer)
   ========================================================================== */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: var(--s-05);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: var(--hairline) solid var(--rule);
  background: var(--surface-2);
}
.tab {
  padding: 5px var(--s-15);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--ink-3);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tab:hover { color: var(--ink-2); }
.tab[aria-selected="true"] {
  background: var(--gold-wash);
  color: var(--gold-bright);
}

/* ==========================================================================
   17. Dialogs: wallet modal + stock drawer
   ========================================================================== */
dialog { border: 0; padding: 0; color: inherit; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: var(--overlay); }

.modal {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  background: var(--surface);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.modal__head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  border-bottom: var(--hairline) solid var(--rule);
}
.modal__title { font-size: var(--fs-h3); font-weight: var(--fw-semi); margin-right: auto; }
.modal__body { padding: var(--s-2); display: grid; gap: var(--s-1); }
.modal__foot {
  padding: var(--s-15) var(--s-2);
  border-top: var(--hairline) solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  background: var(--surface-2);
}

.wallet-option {
  display: flex;
  align-items: center;
  gap: var(--s-15);
  width: 100%;
  padding: var(--s-15);
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.wallet-option:hover { background: var(--surface-3); border-color: var(--gold-line); }
.wallet-option__mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  border: var(--hairline) solid var(--rule);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--fw-semi);
  color: var(--gold-label);
  flex: 0 0 auto;
}
.wallet-option__name { font-weight: var(--fw-medium); }
.wallet-option__meta { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.wallet-option__status { margin-left: auto; }

/* The <dialog> itself is the box the browser positions, so the side-sheet
   geometry has to live on the dialog, not on the panel inside it. */
.drawer-dialog {
  width: min(720px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
}
.drawer {
  height: 100%;
  background: var(--surface);
  border-left: var(--hairline) solid var(--rule);
  display: flex;
  flex-direction: column;
}
.drawer__head {
  display: flex;
  align-items: center;
  gap: var(--s-15);
  padding: var(--s-2);
  border-bottom: var(--hairline) solid var(--rule);
  flex: 0 0 auto;
}
.drawer__id { min-width: 0; }
.drawer__ticker { font-family: var(--font-mono); font-size: var(--fs-h2); font-weight: var(--fw-semi); }
.drawer__name { display: block; font-size: var(--fs-sm); color: var(--ink-3); }
.drawer__price {
  margin-left: auto;
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.drawer__price-main { font-size: var(--fs-h2); font-weight: var(--fw-medium); }
.drawer__price-change { display: block; font-size: var(--fs-sm); }
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: var(--s-2); display: grid; gap: var(--s-2); align-content: start; }
.drawer__foot {
  flex: 0 0 auto;
  padding: var(--s-15) var(--s-2);
  border-top: var(--hairline) solid var(--rule);
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.chart-frame {
  position: relative;
  width: 100%;
  height: 300px;
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}
.chart-frame > .pane { position: absolute; inset: 0; }
.chart-frame .state-block { place-content: center; justify-items: center; height: 100%; }
.chart-mount { position: absolute; inset: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: var(--hairline) solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat-grid > div {
  padding: var(--s-15);
  border-right: var(--hairline) solid var(--rule);
  border-bottom: var(--hairline) solid var(--rule);
}
.stat-grid > div:nth-child(2n) { border-right: 0; }
.stat-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.stat-grid dt {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--gold-label);
}
.stat-grid dd {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body);
}
@media (max-width: 767px) {
  /* On a phone the side sheet becomes a bottom sheet. */
  .drawer-dialog { width: 100vw; height: 92dvh; max-height: 92dvh; margin: auto 0 0; }
  .drawer {
    border-left: 0;
    border-top: var(--hairline) solid var(--rule);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .drawer__head { flex-wrap: wrap; }
  .chart-frame { height: 240px; }
}

/* ==========================================================================
   18. Toasts — a dark pill, bottom centre
   ========================================================================== */
.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--s-3);
  margin-inline: auto;
  z-index: var(--z-toast);
  display: grid;
  justify-items: center;
  gap: var(--s-1);
  /* percentages of the viewport, never 100vw — vw includes the scrollbar and
     would push the page sideways on Windows */
  width: min(440px, calc(100% - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s-15);
  padding: var(--s-15) var(--s-2);
  background: var(--surface);
  border: var(--hairline) solid var(--rule-strong);
  border-radius: var(--radius-pill);
  animation: toast-in var(--dur-slow) var(--ease);
  max-width: 100%;
}
.toast__icon { width: 15px; height: 15px; flex: 0 0 auto; color: var(--gold-bright); }
.toast[data-kind="error"]   .toast__icon { color: var(--down); }
.toast[data-kind="warn"]    .toast__icon { color: var(--warn); }
.toast[data-kind="info"]    .toast__icon { color: var(--ink-3); }
.toast[data-kind="error"]   { border-color: var(--down); }
.toast__body { min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.toast__title { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink); }
.toast__text  { font-size: var(--fs-sm); color: var(--ink-3); word-break: break-word; }
.toast__actions { display: flex; gap: var(--s-1); flex: 0 0 auto; }
.toast__close { flex: 0 0 auto; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (max-width: 767px) {
  .toasts { bottom: var(--s-2); }
  .toast { border-radius: var(--radius); }
}

/* ==========================================================================
   19. How it works
   ========================================================================== */
.step {
  padding: var(--s-3);
  border-bottom: var(--hairline) solid var(--rule);
  border-right: var(--hairline) solid var(--rule);
  display: grid;
  gap: var(--s-05);
  align-content: start;
}
.step__num {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-eyebrow);
  color: var(--gold-label);
}
.step__title { font-size: var(--fs-h3); font-weight: var(--fw-semi); }
.step__text  { font-size: var(--fs-sm); color: var(--ink-3); }
.step:last-child { border-bottom: 0; }
@media (min-width: 768px) {
  .step:nth-child(2n) { border-right: 0; }
  .step:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (min-width: 1024px) {
  .step:nth-child(2n) { border-right: var(--hairline) solid var(--rule); }
  .step:nth-child(3n) { border-right: 0; }
  .step:nth-last-child(-n+3) { border-bottom: 0; }
}

.how__intro { margin-top: 0; }
.how__intro .callout__text { font-size: var(--fs-body); color: var(--ink-2); max-width: 68ch; }
.how__interval { font-family: var(--font-mono); font-weight: var(--fw-semi); color: var(--gold-bright); }

.how__lede { font-size: var(--fs-sm); color: var(--ink-2); max-width: 60ch; margin-top: var(--s-2); }
.how__list {
  margin: var(--s-2) 0;
  display: grid;
  gap: var(--s-1);
}
.how__list li {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  padding-left: var(--s-2);
  position: relative;
}
.how__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--gold);
}
.how__fine {
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: var(--hairline) solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

/* Questions. A <dl>, so the question really is marked up as the term for its
   answer rather than as a bold paragraph that happens to sit above one. */
.faq { margin-top: var(--s-2); }
.faq__q {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--ink);
  padding-top: var(--s-2);
}
.faq__a {
  margin: 0;
  padding: var(--s-05) 0 var(--s-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  max-width: 62ch;
  border-bottom: var(--hairline) solid var(--rule-soft);
}
.faq__a:last-child { border-bottom: 0; }

/* ==========================================================================
   20. Misc
   ========================================================================== */
.hint { font-size: var(--fs-xs); color: var(--ink-3); }
.stack     { display: grid; gap: var(--s-2); align-content: start; }
.stack--sm { display: grid; gap: var(--s-1); }
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-width: 0;
}
.tba {
  font-family: var(--font-mono);
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.count-hint {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-4);
  min-width: 0;
  overflow-wrap: anywhere;
}

/* A button that reads as text — used for the ticker inside a table row so the
   drawer is reachable by keyboard without giving the <tr> a button role. */
.linklike {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-align: left;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.linklike:hover { border-bottom-color: var(--gold); }

/* The X link in the footer's bottom row. */
.foot__x { display: inline-flex; align-items: center; gap: 6px; }
.foot__x-icon { width: 11px; height: 11px; flex: 0 0 auto; }

/* ==========================================================================
   21. Call-to-action banner (#cta)

   One strip under the header, above every panel. It is deliberately built
   from the same parts as a .callout — surface-2 ground, hairline border, a
   3px gold edge — so it reads as part of the page rather than an ad dropped
   on top of it. The only accent is the gold already in tokens.css.

   Four painted states, set by JS on [data-state]:
     connect | choose   the two that ask for something — gold edge, gold mark
     saved              a receipt: neutral edge, muted mark, no gold bar
     below              a fact: neutral edge, muted mark
   ========================================================================== */
.cta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "mark body"
    ".    actions";
  align-items: start;
  gap: var(--s-1) var(--s-15);
  position: relative;
  margin-bottom: var(--s-3);
  padding: var(--s-2);
  padding-right: 44px;            /* room for the close button */
  border: var(--hairline) solid var(--rule);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.cta__mark {
  grid-area: mark;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--gold-wash);
  color: var(--gold-bright);
}
.cta__mark svg { width: 15px; height: 15px; }

.cta__body { grid-area: body; display: grid; gap: 5px; min-width: 0; }
.cta__title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.cta__text {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--ink-2);
  max-width: 78ch;
  overflow-wrap: anywhere;
}
.cta__meta {
  font-size: var(--fs-xs);
  color: var(--gold-bright);
  letter-spacing: 0.01em;
}

.cta__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1);
  align-items: center;
}

.cta__close {
  position: absolute;
  top: var(--s-15);
  right: var(--s-15);
  color: var(--ink-3);
}
.cta__close:hover:not(:disabled) { color: var(--ink); }

/* ---- the calm states ---------------------------------------------------- */
/* A receipt and a statement of fact must not shout. They keep the layout and
   lose the gold: neutral edge, muted mark, and (in JS) no primary button. */
.cta[data-state="saved"],
.cta[data-state="below"] {
  border-left-color: var(--rule-strong);
}
.cta[data-state="saved"] .cta__mark,
.cta[data-state="below"] .cta__mark {
  background: var(--surface-3);
  color: var(--ink-3);
}
.cta[data-state="saved"] .cta__title {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--ink-2);
}
.cta[data-state="saved"] .cta__text { color: var(--ink); }

/* ---- entrance ----------------------------------------------------------- */
/* Only under no-preference. base.css also neutralises animations under
   `reduce`, but declaring it here means the rule is never even applied. */
@media (prefers-reduced-motion: no-preference) {
  .cta { animation: cta-in var(--dur-slow) var(--ease) both; }
  @keyframes cta-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---- >= 768px: the actions move up beside the copy ---------------------- */
@media (min-width: 768px) {
  .cta {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "mark body actions";
    align-items: center;
    gap: var(--s-2);
    padding-right: 52px;
  }
  .cta__actions { justify-content: flex-end; }
}

/* ---- <= 374px: the close button stops squeezing the copy ---------------- */
@media (max-width: 400px) {
  .cta { padding: var(--s-15); padding-right: 40px; }
  .cta__close { top: var(--s-1); right: var(--s-1); }
  .cta__actions .btn { flex: 1 1 auto; justify-content: center; }
}
