/* Balance ledger shared by Trading, MoC and DAO staking. One ruled row per token: the symbol and its
   role beside one figure; for a market token, a meter and a Wallet / Market / In orders legend; then a
   four-slot toolbar whose columns line up from row to row (market actions left, wallet actions right). */
.aera-balances { min-width: 0; container-type: inline-size; }
.aera-balances [hidden] { display: none !important; }
.aera-balances .ab-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin: 0; padding: 0; border-bottom: 1px solid var(--terminal-rule); }
.aera-balances .ab-heading h2 { margin: 0; color: var(--text); font-size: .9375rem; font-weight: 500; line-height: 1.4; }
.aera-balances .ab-status { color: var(--text-muted); font: 500 .6875rem/1 var(--fontfam-term); white-space: nowrap; }
.aera-balances .ab-status[data-state=stale] { color: var(--network-label); }
.aera-balances .ab-caption { min-height: 0; margin: 14px 0 2px; color: var(--text-soft); font-size: .75rem; line-height: 1.5; }

.aera-balances .ab-rows { display: grid; min-width: 0; }
.aera-balances .ab-row { display: block; min-width: 0; padding: 14px 0 16px; border-top: 1px solid var(--terminal-rule); }
.aera-balances .ab-heading + .ab-caption[hidden] + .ab-rows > .ab-row:first-child { border-top: 0; }
.aera-balances .ab-line { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 12px; min-width: 0; }
.aera-balances .ab-identity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
.aera-balances .ab-symbol { color: var(--text); font-size: .875rem; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.aera-balances .ab-role { color: var(--text-muted); font-size: .75rem; line-height: 1.4; }
.aera-balances .ab-role:empty { display: none; }
.aera-balances .ab-figure { display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; min-width: 0; margin-inline-start: auto; }
.aera-balances .ab-amount-label { color: var(--text-muted); font-size: .75rem; line-height: 1.4; }
.aera-balances .ab-amount { min-width: 0; color: var(--text); font: 500 1rem/1.35 var(--fontfam-term); font-variant-numeric: tabular-nums slashed-zero; text-align: right; overflow-wrap: anywhere; transition: color 200ms ease-out; }
.aera-balances :is(.ab-amount, .ab-legend dd)[data-waiting=true] { color: var(--rule-bright); }

/* Market lane. The meter divides everything this market can see of the token: the wallet (neutral),
   funds free in the market (mint, ready for orders and withdrawal) and funds reserved by open orders. */
.aera-balances .ab-market { min-width: 0; margin-top: 12px; }
.aera-balances .ab-meter { display: flex; height: 3px; overflow: hidden; background: var(--rule-strong); transition: opacity 200ms ease-out; }
.aera-balances .ab-meter > i { display: block; flex: none; width: var(--w, 0%); height: 100%; transition: width 420ms cubic-bezier(.16, 1, .3, 1); }
.aera-balances .ab-meter > i[data-nonzero=true] { min-width: 2px; }
.aera-balances .ab-meter > i + i { box-shadow: -1px 0 0 var(--ground); }
.aera-balances .ab-meter > [data-part=wallet] { background: var(--text-muted); }
.aera-balances .ab-meter > [data-part=market] { background: var(--positive); }
.aera-balances .ab-meter > [data-part=orders] { background: var(--rule-bright); }
.aera-balances .ab-meter[data-state=empty] { background: repeating-linear-gradient(90deg, var(--rule-bright) 0 6px, transparent 6px 10px); }
.aera-balances .ab-meter[data-state=unknown] { opacity: .35; }
.aera-balances .ab-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 9px 0 0; }
.aera-balances .ab-legend > div { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; font-size: .75rem; line-height: 1.5; }
.aera-balances .ab-legend dt { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); white-space: nowrap; }
.aera-balances .ab-legend dt::before { content: ''; flex: none; width: 8px; height: 3px; background: var(--text-muted); }
.aera-balances .ab-legend [data-part=market] dt::before { background: var(--positive); }
.aera-balances .ab-legend [data-part=orders] dt::before { background: var(--rule-bright); }
.aera-balances .ab-legend dd { min-width: 0; margin: 0; color: var(--text-soft); font-family: var(--fontfam-term); font-variant-numeric: tabular-nums slashed-zero; text-align: right; overflow-wrap: anywhere; }
.aera-balances .ab-legend [data-part=market] dd[data-market-available] { color: var(--text); }
.aera-balances .ab-flag { color: var(--network-label); font: 500 .6875rem/1 var(--fontfam-term); }

/* Last-known values stay readable but read as stale; the meter dims with them. */
.aera-balances .ab-row[data-stale=true] :is(.ab-amount, .ab-legend dd[data-market-available]) { color: var(--text-muted); }
.aera-balances .ab-row[data-stale=true] .ab-meter { opacity: .6; }

/* Toolbar: two joined pairs in 92px slots, right-aligned, so every row's actions share columns. A slot
   grows only for a label that needs more (a longer language), never clipping it.
   Deposit | Withdraw move funds between the wallet and the market; Wrap or Unwrap | Send act on the
   wallet. A transaction in progress keeps its slot and shows only the shared ring or dots; its step is
   in the tooltip, accessible name and live region. Pairs join through `~` because progress places a
   hidden live region after its button. */
.aera-balances .ab-actions { display: grid; grid-template-columns: repeat(2, minmax(min-content, 92px)) 8px repeat(2, minmax(min-content, 92px)); justify-content: end; gap: 6px 0; margin-top: 12px; }
.aera-balances .ab-actions:not(:has(button)), .aera-balances[data-connected=false] .ab-actions { display: none; }
.aera-balances .ab-actions > [data-slot=deposit] { grid-column: 1; }
.aera-balances .ab-actions > [data-slot=withdraw] { grid-column: 2; }
.aera-balances .ab-actions > [data-slot=wrap] { grid-column: 4; }
.aera-balances .ab-actions > [data-slot=send] { grid-column: 5; }
.aera-balances .ab-actions > :is([data-slot=deposit]:has(~ [data-slot=withdraw]), [data-slot=wrap]:has(~ [data-slot=send])) { border-start-end-radius: 0; border-end-end-radius: 0; }
.aera-balances .ab-actions > :is([data-slot=deposit] ~ [data-slot=withdraw], [data-slot=wrap] ~ [data-slot=send]) { margin-inline-start: -1px; border-start-start-radius: 0; border-end-start-radius: 0; }
.aera-balances .btn.aera-asset-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; min-height: 32px; padding: 0 8px;
  border: 1px solid var(--rule-strong); border-radius: 4px; color: var(--text-soft); background: transparent;
  font: 500 .75rem/1.2 Geist, sans-serif; white-space: nowrap; cursor: pointer;
  transition: color 140ms ease-out, background-color 140ms ease-out, border-color 140ms ease-out;
}
.aera-balances .btn.aera-asset-action svg { flex: none; width: 13px; height: 13px; }
.aera-balances .btn.aera-asset-action:hover:not(:disabled) { position: relative; z-index: 1; color: var(--text); background: var(--terminal-raised); border-color: var(--rule-bright); }
.aera-balances .btn.aera-asset-action:focus-visible { position: relative; z-index: 2; outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.aera-balances .btn.aera-asset-action:disabled { opacity: .4; cursor: not-allowed; }

/* Narrow columns keep two slots per line; wide containers set token rows side by side. */
@container (max-width: 279px) {
  .aera-balances .ab-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aera-balances .ab-actions > :is([data-slot=deposit], [data-slot=wrap]) { grid-column: 1; }
  .aera-balances .ab-actions > :is([data-slot=withdraw], [data-slot=send]) { grid-column: 2; }
}
@container (min-width: 680px) {
  .aera-balances .ab-rows { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 32px; }
  .aera-balances .ab-rows > .ab-row { border-top: 0; border-bottom: 1px solid var(--terminal-rule); }
}

/* Shared control default; Portfolio's ledger keeps these 44px asset actions. */
.btn.aera-asset-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--terminal-rule); border-radius: 6px; color: var(--text-soft); background: transparent; font: 500 .8125rem/1.5 Geist, sans-serif; cursor: pointer; transition: color 150ms ease-out, background-color 150ms ease-out, border-color 150ms ease-out; }
.btn.aera-asset-action svg { flex: none; width: 16px; height: 16px; }
.btn.aera-asset-action:hover:not(:disabled) { color: var(--text); background: var(--terminal-control); border-color: var(--rule-bright); }
.btn.aera-asset-action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--focus); }
.btn.aera-asset-action:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 760px), (pointer: coarse) {
  .aera-balances .btn.aera-asset-action { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn.aera-asset-action, .aera-balances :is(.ab-amount, .ab-meter, .ab-meter > i) { transition: none; }
}
