/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast), opacity var(--dur-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--text-primary);
  color: #0a0b0e;
}

.btn--primary:hover:not(:disabled) {
  background: #fff;
}

.btn--secondary {
  background: var(--surface-card);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--surface-card-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-soft);
  color: var(--text-primary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-card);
}

.btn--danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.3);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.2);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 13px 26px;
  font-size: 15px;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* ---------- Portfolio card (dashboard hero) ---------- */
.balance-card {
  background: linear-gradient(160deg, #16171e 0%, #0e0f13 100%);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-raised);
}

.balance-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 220px at 88% -15%, rgba(91, 109, 250, 0.14), transparent 62%);
  pointer-events: none;
}

.balance-card__identity {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.balance-card__name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.balance-card__address {
  font-size: 12px;
  color: var(--text-tertiary);
}

.balance-card__row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.balance-card__label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.eye-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--text-tertiary);
  transition: color var(--dur-fast), background var(--dur-fast);
}

.eye-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-card);
}

.eye-btn svg {
  transition: transform var(--dur-med) var(--ease-out);
}

.eye-btn:active svg {
  transform: scale(0.85);
}

.balance-card__figure {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 4px;
  transition: opacity var(--dur-fast);
}

.balance-card__figure.is-hidden {
  letter-spacing: 0.02em;
}

.balance-card__change {
  position: relative;
  z-index: 1;
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 8px;
}

.balance-card__change.is-up {
  color: var(--success);
}
.balance-card__change.is-down {
  color: var(--danger);
}

/* ---------- Range filters (Asset Detail page chart) ---------- */
.range-filters {
  display: flex;
  gap: 4px;
  padding-bottom: 14px;
  overflow-x: auto;
}

.range-filter {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
}

.range-filter:hover {
  color: var(--text-secondary);
}

.range-filter.is-active {
  background: var(--surface-card-hover);
  color: var(--text-primary);
  border-color: var(--border-soft);
}

/* ---------- Quick actions ---------- */
.quick-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 4px;
}

.quick-actions--compact {
  justify-content: flex-start;
  gap: 10px;
  margin: 16px 0 0;
}

.quick-actions--compact .btn {
  flex: 1;
}

.quick-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.quick-action__circle {
  width: 100%;
  max-width: 64px;
  aspect-ratio: 1;
  border-radius: 18px;
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  display: grid;
  place-items: center;
  color: var(--text-primary);
  transition: background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}

.quick-action:hover .quick-action__circle {
  background: var(--surface-card-hover);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
}

.quick-action:active .quick-action__circle {
  transform: scale(0.94);
}

.quick-action__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

@media (max-width: 380px) {
  .quick-actions {
    gap: 6px;
  }
  .quick-action__circle {
    border-radius: 15px;
  }
  .quick-action__label {
    font-size: 11px;
  }
}

/* ---------- Token icon ---------- */
.token-icon {
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

/* ---------- Network switcher ---------- */
.network-switcher {
  position: relative;
}

.network-switcher__trigger {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  padding: 8px 13px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}

.network-switcher__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-gradient);
}

.network-switcher__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 190px;
  z-index: 20;
  box-shadow: var(--shadow-raised);
  max-height: 320px;
  overflow-y: auto;
}

.network-switcher__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
}

.network-switcher__item:hover {
  background: var(--surface-card);
  color: var(--text-primary);
}

.network-switcher__item.is-active {
  background: var(--brand-primary-soft);
  color: var(--text-primary);
}

/* ---------- Asset row ---------- */
.asset-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.asset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease-out);
  cursor: pointer;
}

.asset-row:hover {
  background: var(--surface-card);
}

.asset-row:active {
  background: var(--surface-card-hover);
}

.asset-row__main {
  flex: 1;
  min-width: 0;
}

.asset-row__name {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--text-primary);
}

.asset-row__sub {
  font-size: 12.5px;
  color: var(--text-tertiary);
  margin-top: 2px;
  font-weight: 500;
}

.asset-row__value {
  text-align: right;
}

.asset-row__usd {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.asset-row__change {
  font-size: 11.5px;
  margin-top: 3px;
  font-weight: 600;
}

.asset-row__change.is-up {
  color: var(--success);
}
.asset-row__change.is-down {
  color: var(--danger);
}

/* ---------- Transaction rows / groups ---------- */
.tx-group {
  margin-bottom: 18px;
}

.tx-group__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  padding: 0 6px;
}

.tx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease-out);
}

.tx-row:hover {
  background: var(--surface-card);
}

.tx-row:active {
  background: var(--surface-card-hover);
}

.tx-row__icon {
  position: relative;
  flex-shrink: 0;
}

.tx-row__dir {
  position: absolute;
  bottom: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-elevated-2);
  border: 2px solid var(--bg-base);
}

.tx-row__dir.is-in { color: var(--success); }
.tx-row__dir.is-out { color: var(--text-primary); }
.tx-row__dir.is-gas { color: var(--warning); }
.tx-row__dir.is-swap { color: var(--brand-primary); }
.tx-row__amount.is-swap { color: var(--text-primary); font-size: 12.5px; }

.tx-row__main {
  flex: 1;
  min-width: 0;
}

.tx-row__top {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
}

.tx-row__amount.is-in { color: var(--success); }
.tx-row__amount.is-out { color: var(--text-primary); }

.tx-row__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-tertiary);
  margin-top: 3px;
}

/* ---------- Status badge ---------- */
.status-badge {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: capitalize;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
}

.status-badge--confirmed {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge--pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge--failed {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Filter tabs ---------- */
.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.filter-tab {
  padding: 8px 15px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  white-space: nowrap;
}

.filter-tab.is-active {
  background: var(--brand-primary-soft);
  color: var(--text-primary);
  border-color: transparent;
}

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span:first-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input,
.field select,
input,
select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  transition: border-color var(--dur-fast);
}

.field input:focus,
input:focus,
select:focus {
  border-color: var(--brand-primary);
}

.field__error {
  font-size: 12px;
  color: var(--danger);
}

.field__hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ---------- Alerts ---------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert--error {
  background: var(--danger-soft);
  color: #ff9f9f;
  border-color: rgba(255, 107, 107, 0.3);
}

.alert--warning {
  background: var(--warning-soft);
  color: #ffcf8a;
  border-color: rgba(245, 166, 35, 0.3);
}

.alert--success {
  background: var(--success-soft);
  color: #8ff0c4;
  border-color: rgba(61, 220, 151, 0.3);
}

/* ---------- Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.pill--muted {
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  color: var(--text-secondary);
}

.pill--accent {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 84px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-soft);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  animation: toast-in var(--dur-med) var(--ease-out);
  max-width: 320px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  flex-shrink: 0;
}

.toast--success .toast__icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast__icon { background: var(--danger-soft); color: var(--danger); }
.toast--info .toast__icon { background: var(--brand-primary-soft); color: var(--brand-primary); }

@media (min-width: 861px) {
  .toast-stack {
    bottom: 24px;
  }
}

/* ---------- Skeleton ---------- */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.035) 25%, rgba(255,255,255,0.08) 37%, rgba(255,255,255,0.035) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-secondary);
}

.empty-state__icon {
  font-size: 26px;
  margin-bottom: 10px;
  opacity: 0.55;
}

.empty-state h3 {
  font-size: 14.5px;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.empty-state p {
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------- Spinner ---------- */
.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--brand-primary);
  animation: spin 0.8s linear infinite;
}

.spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.full-spinner {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Copy button ---------- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  padding: 7px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.copy-btn:hover {
  color: var(--text-primary);
  background: var(--surface-card-hover);
}

.copy-btn--tiny {
  padding: 4px 5px;
  gap: 0;
}

.copy-btn--tiny svg {
  display: block;
}

.text-gradient {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
