/* Account cards: open affordance, reorder grip, selection chips. */

.account-card {
  /* The asset's tone (js/ui/asset-colors.js accountAutoTone; the ring
     repaints it with its segment color). Gray until a tone is known. */
  --acct-tone: #8a8a90;
  position: relative;
  display: flex;
  align-items: center;
  /* Grid items default to min-width:auto; let the name/value ellipses absorb
     a long item instead of feeding its intrinsic width back into the track. */
  min-width: 0;
  min-height: 4.85rem;
  gap: 1rem;
  padding: 0.85rem 1.15rem 0.85rem 0.45rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.2s var(--ease);
}

/* Open affordance: a quiet chevron that brightens and slides on hover. */
.account-card::after {
  content: "";
  flex: 0 0 0.45rem;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: -0.25rem;
  border-top: 1.5px solid var(--muted-2);
  border-right: 1.5px solid var(--muted-2);
  transform: translateX(-3px) rotate(45deg);
  opacity: 0.5;
  transition: transform 0.22s var(--ease), opacity 0.2s ease, border-color 0.2s ease;
}

.account-card:hover {
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 70%),
    var(--surface-2);
}

.account-card:hover::after,
.account-card:focus-visible::after {
  transform: translateX(0) rotate(45deg);
  opacity: 1;
  border-color: var(--text);
}

.account-card:active { transform: scale(0.995); }

/* The reorder grip: a die's six (two columns, three rows), drawn inside a
   larger touch target. The dots are clipped to the content box, whose size
   is exact multiples of the dot pitch, so no dot is ever cut in half.
   One size, one opacity, always visible. */
.drag-handle {
  width: 1.5rem;
  height: 2.9rem;
  flex-shrink: 0;
  align-self: center;
  box-sizing: border-box;
  padding: 0.82rem 0.35rem;
  border-radius: 6px;
  cursor: grab;
  opacity: 0.55;
  touch-action: none;
  background-image: radial-gradient(circle, var(--muted) 1.15px, transparent 1.35px);
  background-size: 0.4rem 0.42rem;
  background-origin: content-box;
  background-clip: content-box;
  background-position: 0 0;
  background-repeat: repeat;
  transition: opacity 0.2s ease;
}

.account-card:hover .drag-handle,
.trade-block:hover .drag-handle { opacity: 0.9; }
.drag-handle:hover { opacity: 1 !important; }
.drag-handle:active { cursor: grabbing; }

.account-card.drag-src { opacity: 0.35; }
.account-card.drop-before { box-shadow: 0 -2px 0 var(--accent); }
.account-card.drop-after { box-shadow: 0 2px 0 var(--accent); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.page-btn { min-width: 2.5rem; min-height: 2.5rem; padding: 0.4rem 0.85rem; border-radius: 999px; font-weight: 600; }
.page-btn[disabled] { opacity: 0.3; cursor: default; }
.page-btn[disabled]:hover { background: none; border-color: var(--border-strong); }
.page-btn[disabled]:active { transform: none; background: none; }
.page-btn[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.pager-ellipsis {
  min-width: 1.1rem;
  text-align: center;
  color: var(--muted);
  user-select: none;
  pointer-events: none;
}
.page-btn.hot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
  color: var(--accent-ink);
  transform: scale(1.12);
}

.pager-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.35rem 0.5rem 0;
}

.trade-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  flex-wrap: nowrap;
  margin: 0.9rem 0 0.4rem;
}

.trade-bottom-bar .trade-range {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.trade-bottom-bar .trade-pager {
  margin: 0;
  flex-wrap: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

.trade-bottom-bar .trade-pager .page-btn { flex: 0 0 auto; }

.per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  white-space: nowrap;
  flex: 0 0 auto;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

.per-page select {
  width: auto;
  min-width: 4.6rem;
  min-height: 2.3rem;
  padding: 0.3rem 2.2rem 0.3rem 0.8rem;
  text-align: center;
  border-radius: 999px;
}

.trade-pager { margin: 0.9rem 0 0.4rem; }

.drag-ghost {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  opacity: 0.95;
  margin: 0;
  border-color: var(--accent-line);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.6);
}

.acct-avatar {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  /* A disc tinted with the asset's tone, lit from the top left. */
  background:
    radial-gradient(circle at 32% 24%, color-mix(in srgb, var(--acct-tone) 30%, transparent), transparent 72%),
    color-mix(in srgb, var(--acct-tone) 12%, var(--surface-2));
  border: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acct-tone) 40%, transparent);
  color: color-mix(in srgb, var(--acct-tone) 50%, #ffffff);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.05em;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.account-card:hover .acct-avatar { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acct-tone) 65%, transparent); }

.acct-mid { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; margin-right: auto; gap: 0.2rem; }

.account-name {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sub line: "BTC · 0.35000000" — ticker in small caps, then the holding. */
.acct-sub {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  line-height: 1.25;
  white-space: nowrap;
}
.account-ticker { flex: 0 0 auto; color: var(--muted-2); font-size: 0.68rem; font-weight: 650; letter-spacing: 0.1em; }
.acct-hold {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.acct-hold::before { content: "\00b7"; margin-right: 0.45rem; color: var(--muted-2); }

/* Weight: share of the available balance (wide screens only). A fixed
   column, so every row lines up whether or not a share is known. */
.acct-weight {
  flex: 0 0 9.5rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.acct-weight-pct {
  flex: 0 0 3rem;
  order: 2;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.acct-weight-bar {
  flex: 1 1 auto;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}
.acct-weight-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--acct-tone);
  opacity: 0.85;
}

.acct-figs {
  display: flex;
  flex: 0 0 11.5rem;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  line-height: 1.3;
  min-width: 0;
  text-align: right;
}

.acct-value { font-family: var(--font-display); font-weight: 500; font-size: 1.08rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-pl { font-size: 0.78rem; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-pl.gain { color: var(--gain); }
.acct-pl.loss { color: var(--loss); }

/* P&L amount + return pill on one line; the amount truncates first. */
.acct-pl-line { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; max-width: 100%; min-width: 0; }
.acct-pl-line .acct-pl { flex: 0 1 auto; min-width: 0; }
.acct-ret {
  flex: 0 0 auto;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The arrow carries the direction, so meaning never rests on color alone. */
.acct-ret.gain { color: var(--gain); background: var(--gain-bg); }
.acct-ret.loss { color: var(--loss); background: var(--loss-bg); }
.acct-ret.gain::before { content: "\25b2"; margin-right: 0.3em; font-size: 0.75em; vertical-align: 0.08em; }
.acct-ret.loss::before { content: "\25bc"; margin-right: 0.3em; font-size: 0.75em; vertical-align: 0.08em; }
.acct-open { flex-shrink: 0; }

/* Mid widths: the name needs the room more than the weight bar does. */
@media (max-width: 960px) {
  .acct-weight { flex-basis: 6.5rem; }
  .acct-weight-bar { display: none; }
  .acct-weight-pct { flex: 1 1 auto; }
}
