.wallet-page {
  --wallet-gap: clamp(14px, 2vw, 24px);
}
.wallet-panel { display: grid; gap: var(--wallet-gap); }
.wallet-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: var(--wallet-gap);
}
.wallet-top-up-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
}
.wallet-balance-card, .wallet-history, .wallet-card {
  min-width: 0;
  padding: clamp(18px, 2.5vw, 30px);
  border: 1px solid var(--graphite-hairline);
  border-radius: 18px;
  background: var(--graphite-stage);
  color: var(--graphite-ink);
}
.wallet-balance-card {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 20px;
  background:
    radial-gradient(ellipse at 91% 0, #75638f21, transparent 70%),
    var(--graphite-panel);
}
.wallet-summary .wallet-balance-card { min-height: 204px; }
.wallet-page[data-wallet-view="billing-transactions"] > .wallet-balance-card {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: var(--wallet-gap);
  padding-block: 18px;
}
.wallet-page[data-wallet-view="billing-transactions"] > .wallet-balance-card strong {
  font-size: clamp(26px, 3vw, 42px);
}
.wallet-brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--graphite-hairline);
  border-radius: 12px;
  background: #d3bbff14;
  color: #e2d6f1;
}
.wallet-brand-mark svg { width: 20px; height: 20px; }
.wallet-balance { display: grid; gap: 5px; }
.wallet-balance span, .wallet-status, .wallet-person span {
  color: var(--graphite-muted);
  font-size: 13px;
  line-height: 1.55;
}
.wallet-balance strong {
  color: var(--graphite-ink);
  font-family: Manrope, sans-serif;
  font-size: clamp(36px, 4.65vw, 60px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.wallet-topup { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.wallet-top-up-grid .wallet-topup { width: 100%; border-top: 1px solid var(--graphite-hairline); padding-top: 18px; }
.wallet-topup .icon { width: 15px; height: 15px; }
.wallet-shortcuts { display: grid; gap: 12px; }
.wallet-shortcut {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.5vw, 19px);
  min-width: 0;
  min-height: 96px;
  padding: clamp(14px, 1.9vw, 23px);
  border: 1px solid var(--graphite-hairline);
  border-radius: 17px;
  background: var(--graphite-stage);
  color: var(--graphite-ink);
  transition: background .2s, border-color .2s;
}
.wallet-shortcut:hover { background: var(--graphite-panel); border-color: var(--graphite-line); }
.wallet-shortcut-icon, .wallet-entry-icon, .wallet-empty-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 12px;
  background: var(--graphite-raised);
  color: var(--graphite-accent);
}
.wallet-shortcut-icon .icon, .wallet-empty-icon .icon { width: 18px; height: 18px; }
.wallet-shortcut-copy { display: grid; gap: 4px; }
.wallet-shortcut-copy strong { font-size: 15px; }
.wallet-shortcut-copy small { color: var(--graphite-muted); font-size: 12px; line-height: 1.45; }
.wallet-shortcut-arrow { display: grid; place-items: center; color: var(--graphite-muted); }
.wallet-shortcut-arrow .icon { width: 16px; height: 16px; }
.wallet-card h2, .wallet-history h2 { font-size: clamp(18px, 2vw, 21px); letter-spacing: -.035em; }
.wallet-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; }
.wallet-history-link .icon { width: 14px; height: 14px; }
.wallet-status { margin-top: 10px; }
.wallet-status:empty { display: none; }
.wallet-admin > .wallet-status { margin: 11px 0; }

.wallet-history-state[hidden], .wallet-ledger-heading[hidden] { display: none; }
.wallet-history-state {
  display: grid;
  justify-items: start;
  gap: 7px;
  margin-top: 18px;
  padding: 13px 15px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 12px;
  color: var(--graphite-muted);
  font-size: 13px;
  line-height: 1.5;
}
.wallet-history-state.is-empty {
  justify-items: center;
  padding: 26px 15px;
  border-style: dashed;
  text-align: center;
}
.wallet-history-state .wallet-empty-icon { display: none; }
.wallet-history-state.is-empty .wallet-empty-icon { display: grid; margin-bottom: 4px; }
.wallet-history-state.is-empty > [role="status"] { color: var(--graphite-ink); font-weight: 700; }
.wallet-empty-detail { max-width: 60ch; }
.wallet-ledger-heading, .wallet-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(8em, .54fr);
  align-items: center;
  gap: clamp(10px, 1.8vw, 24px);
}
.wallet-ledger-heading {
  margin-top: 16px;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--graphite-panel);
  color: var(--graphite-muted);
  font-size: 12px;
  font-weight: 700;
}
.wallet-ledger-heading span:last-child, .wallet-entry-amount { text-align: right; }
.wallet-entries { padding: 0; margin: 6px 0 0; list-style: none; }
.wallet-entries:empty { margin: 0; }
.wallet-entry { padding: 12px; }
.wallet-entry + .wallet-entry { border-top: 1px solid var(--graphite-hairline); }
.wallet-entry-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.wallet-entry-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #83bba416;
  color: #badbca;
}
.wallet-entry-icon.is-debit { background: #c5ace715; color: #dacced; }
.wallet-entry-icon .icon { width: 16px; height: 16px; }
.wallet-entry-copy { min-width: 0; }
.wallet-entry-copy strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.wallet-entry-copy small, .wallet-entry-date {
  display: block;
  color: var(--graphite-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.wallet-entry-copy small { margin-top: 4px; }
.wallet-entry-amount {
  overflow-wrap: anywhere;
  color: #b7dac8;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.wallet-entry-amount.is-debit { color: #e6c6b7; }
.wallet-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--graphite-hairline); }
.wallet-pager[hidden] { display: none; }
.wallet-pager span { color: var(--graphite-muted); font-size: 12px; text-align: center; }

.wallet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 24px;
  padding: 4px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 12px;
  background: var(--graphite-stage);
}
.wallet-tabs a {
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--graphite-muted);
  font-size: 13px;
  font-weight: 700;
  transition: background .2s, color .2s;
}
.wallet-tabs a:hover { color: var(--graphite-ink); background: #ffffff0a; }
.wallet-tabs a[aria-current="page"] {
  border-color: var(--graphite-hairline);
  background: var(--graphite-raised);
  color: var(--graphite-ink);
}
.wallet-fund-title { display: flex; align-items: center; gap: 12px; }
.wallet-fund fieldset { margin: 22px 0 0; padding: 0; border: 0; min-width: 0; }
.wallet-fund legend { margin-bottom: 10px; color: var(--graphite-muted); font-size: 13px; font-weight: 700; }
.wallet-amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 94px), 1fr)); gap: 8px; }
.wallet-amount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  padding: 8px 11px;
  border: 1px solid var(--graphite-hairline);
  border-radius: 10px;
  background: var(--graphite-panel);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.wallet-amount:hover { border-color: var(--graphite-line); background: var(--graphite-raised); }
.wallet-amount:has(:checked) { border-color: #aa96cb; background: #d3bbff14; }
.wallet-amount:focus-within { outline: 2px solid var(--graphite-accent); outline-offset: 3px; }
.wallet-amount input { accent-color: var(--graphite-accent); }
.wallet-payment-status:not(:empty) { margin-top: 18px; padding: 12px; border-radius: 9px; background: var(--graphite-panel); }
.wallet-payment-status.is-test-mode { border: 1px solid #dcb77140; color: #edcc91; }
.wallet-payment-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--graphite-hairline);
}
.wallet-payment-footer .wallet-status { margin: 0; flex: 1 1 160px; }
.wallet-payment-error { color: #edb3a5; }
.wallet-notice {
  margin-bottom: 16px;
  padding: 12px 15px;
  border: 1px solid var(--graphite-line);
  border-radius: 10px;
  background: var(--graphite-raised);
  color: var(--graphite-ink);
  font-size: 13px;
}
.wallet-search, .wallet-credit-fields, .wallet-admin-grid { display: grid; gap: 14px; }
.wallet-search { grid-template-columns: minmax(0, 360px) auto; align-items: end; justify-content: start; }
.wallet-card .field { margin: 0; min-width: 0; }
.wallet-admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.8fr); margin: 16px 0; }
.wallet-admin-balance { display: grid; gap: 16px; align-content: start; background: var(--graphite-panel); }
.wallet-person { display: grid; gap: 3px; overflow-wrap: anywhere; }
.wallet-credit-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); margin-top: 15px; }
.wallet-credit-actions { margin-top: 15px; }
.wallet-credit .help-note { margin-top: 8px; }

@media (max-width: 820px) {
  .wallet-panel, .wallet-admin-grid { grid-template-columns: minmax(0, 1fr); }
  .wallet-summary .wallet-balance-card { min-height: 0; }
  .wallet-top-up-grid .wallet-balance-card { grid-row: 1; }
}
@media (max-width: 460px) {
  .wallet-search, .wallet-credit-fields { grid-template-columns: minmax(0, 1fr); }
  .wallet-search { justify-content: stretch; }
  .wallet-search > .btn { justify-self: start; }
  .wallet-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .wallet-tabs a { display: grid; place-items: center; padding-inline: 3px; font-size: 11px; text-align: center; overflow-wrap: anywhere; }
  .wallet-summary .wallet-balance-card, .wallet-top-up-grid .wallet-balance-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 14px;
    gap: 12px;
  }
  .wallet-summary .wallet-balance-card strong, .wallet-top-up-grid .wallet-balance-card strong {
    font-size: 28px;
  }
  .wallet-top-up-grid .wallet-balance-card { grid-row: auto; }
  .wallet-top-up-grid .wallet-brand-mark { width: 33px; height: 33px; }
  .wallet-top-up-grid .wallet-topup { grid-column: 1 / -1; width: auto; padding: 0; border-top: 0; }
  .wallet-page[data-wallet-view="billing-transactions"] > .wallet-balance-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
  }
  .wallet-page[data-wallet-view="billing-transactions"] .wallet-topup { grid-column: 1 / -1; }
  .wallet-shortcut { min-height: 76px; }
  .wallet-ledger-heading { display: none; }
  .wallet-entry {
    grid-template-columns: minmax(0, 1fr) minmax(66px, auto);
    grid-template-areas: "entry amount" "date amount";
    gap: 4px 8px;
    padding-inline: 0;
  }
  .wallet-entry-main { grid-area: entry; gap: 8px; }
  .wallet-entry-icon { width: 30px; height: 30px; }
  .wallet-entry-date { grid-area: date; padding-left: 38px; }
  .wallet-entry-amount { grid-area: amount; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .wallet-tabs a, .wallet-amount, .wallet-shortcut { transition: none; }
}
