:root {
  --radius: 0.875rem;
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --primary-glow: #3b82f6;
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --success: #16a34a;
  --success-foreground: #ffffff;
  --destructive: #dc2626;
  --destructive-foreground: #ffffff;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --gradient-primary: linear-gradient(135deg, #2563eb, #3b82f6);
  --gradient-surface: linear-gradient(180deg, #ffffff, #f1f5f9);
  --shadow-card: 0 4px 16px -6px rgba(37, 99, 235, 0.12);
  --shadow-elevated: 0 12px 40px -12px rgba(37, 99, 235, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.page {
  min-height: 100vh;
  background: var(--background);
}

.page-success {
  background: var(--gradient-surface);
}

/* Header */
.header {
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: var(--shadow-card);
}

.header--sticky {
  position: sticky;
  top: 0;
  z-index: 20;
}

.header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.header__user-id {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  opacity: 0.9;
  letter-spacing: 0.03em;
}

.header__saldo {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.header__saldo--error {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.95;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  color: inherit;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 1.2rem;
}

.icon-btn:hover,
a.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.icon-btn--placeholder {
  visibility: hidden;
}

/* Search */
.search {
  position: relative;
  margin-top: 1.25rem;
}

.search__icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}

.search__input {
  padding-left: 2.5rem !important;
  border: 0 !important;
  box-shadow: var(--shadow-card);
}

/* Main */
.main {
  padding: 1.25rem 1.25rem 2rem;
}

.section-label {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* Bank list */
.bank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bank-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.bank-item:hover {
  border-color: rgba(37, 99, 235, 0.4);
  box-shadow: var(--shadow-card);
}

.bank-item:active {
  transform: scale(0.99);
}

.bank-logo {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  border-radius: 0.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: center;
  padding: 0 0.15rem;
  overflow: hidden;
}

.bank-logo--img {
  display: block;
  object-fit: cover;
  border-radius: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  padding: 0;
}

.bank-item__info {
  min-width: 0;
  flex: 1;
}

.bank-item__name {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-item__name--upper {
  text-transform: uppercase;
}

.bank-item__code {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.empty-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  padding: 2rem;
  text-align: center;
}

.empty-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* History */
.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.history-groups {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.history-item__amount {
  text-align: right;
}

.history-item__value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.125rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 700;
}

.history-item__status {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--success);
}

/* Empty state */
.empty-state {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
}

.empty-state__title {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.empty-state__desc {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}

.btn--primary {
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-card);
}

.btn--outline {
  background: var(--card);
  border-color: var(--border);
  color: var(--foreground);
}

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

.btn--lg {
  min-height: 3rem;
  padding: 0 1rem;
}

.btn--pill {
  margin-top: 1.25rem;
  padding: 0.625rem 1.25rem;
  border-radius: 9999px;
}

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

/* Inputs */
.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--foreground);
}

.input--lg {
  height: 3rem;
  font-size: 1rem;
}

.input--amount {
  padding-left: 2.75rem !important;
  font-weight: 600;
}

.input-prefix {
  position: relative;
}

.input-prefix__label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field + .field,
.field + .btn {
  margin-top: 1.25rem;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 500;
}

.field__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.field__error {
  margin: 0;
  font-size: 0.75rem;
  color: var(--destructive);
}

/* Sheet */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.45);
  opacity: 1;
  transition: opacity 0.2s;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 1.5rem 1.5rem 0 0;
  background: var(--card);
  transform: translateY(0);
  transition: transform 0.25s ease;
}

.sheet.hidden,
.sheet-overlay.hidden {
  pointer-events: none;
}

.sheet.hidden {
  transform: translateY(100%);
}

.sheet-overlay.hidden {
  opacity: 0;
}

.sheet__handle {
  width: 3rem;
  height: 0.375rem;
  margin: 0.75rem auto 0;
  border-radius: 9999px;
  background: var(--muted);
}

.sheet__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem 0.5rem;
}

.sheet__header-text {
  min-width: 0;
  flex: 1;
}

.sheet__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet__subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.sheet__close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: pointer;
}

.sheet__body {
  padding: 1rem 1.5rem 2rem;
}

.sheet-step--center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 0;
  text-align: center;
}

.sheet-step__title {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.sheet-step__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.sheet-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Confirm */
.confirm-card {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  padding: 1rem;
}

.confirm-card + .confirm-card,
.confirm-card + .sheet-actions {
  margin-top: 1rem;
}

.confirm-card--surface {
  background: var(--gradient-surface);
  box-shadow: var(--shadow-card);
}

.confirm-card__badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
}

.confirm-card__user {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.confirm-card__avatar {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.confirm-card__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.confirm-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.confirm-row + .confirm-row,
.confirm-row + .divider {
  margin-top: 0.25rem;
}

.confirm-row--total {
  margin-top: 0.25rem;
  font-weight: 600;
}

.confirm-row__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted-foreground);
}

.confirm-row__value--lg {
  font-size: 1.125rem;
  font-weight: 700;
}

.divider {
  border: 0;
  height: 1px;
  margin: 0.5rem 0;
  background: var(--border);
}

/* Spinner */
.spinner__icon {
  animation: spin 1s linear infinite;
}

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

.processing-badge {
  position: relative;
  width: 4rem;
  height: 4rem;
}

.processing-badge__ping,
.success-hero__ping {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.processing-badge__ping {
  background: rgba(37, 99, 235, 0.2);
}

.success-hero__ping {
  background: rgba(22, 163, 74, 0.2);
}

.processing-badge__circle {
  position: relative;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-elevated);
}

@keyframes ping {
  75%, 100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Success page */
.success-page {
  min-height: 100vh;
  padding: 2.5rem 1.25rem 2rem;
}

.success-page__inner {
  max-width: 28rem;
  margin: 0 auto;
}

.success-hero {
  text-align: center;
}

.success-hero__badge {
  position: relative;
  display: inline-block;
  width: 5rem;
  height: 5rem;
}

.success-hero__circle {
  position: relative;
  display: grid;
  place-items: center;
  width: 5rem;
  height: 5rem;
  border-radius: 9999px;
  background: var(--success);
  color: #fff;
  box-shadow: var(--shadow-elevated);
  animation: scaleIn 0.35s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-hero__title {
  margin: 1.5rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.success-hero__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.success-hero__amount {
  margin: 1rem 0 0;
  font-size: 1.875rem;
  font-weight: 700;
}

.detail-card {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--card);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.detail-row__label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.detail-row__value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.875rem;
  text-align: right;
}

.copy-btn {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
}

.copy-btn:hover {
  color: var(--foreground);
}

.success-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-destructive { color: var(--destructive); }
.text-success { color: var(--success); }
.font-semibold { font-weight: 600; }

.icon-btn .bx,
.search__icon .bx,
.btn .bx {
  line-height: 1;
  vertical-align: middle;
}

.icon-xs { font-size: 0.875rem !important; }
.icon-sm { font-size: 1rem !important; }
.icon-md { font-size: 1.25rem !important; }
.icon-lg { font-size: 1.75rem !important; }
.icon-xl { font-size: 2.5rem !important; }

.icon-xs.bx,
.icon-sm.bx,
.icon-md.bx,
.icon-lg.bx,
.icon-xl.bx {
  width: auto;
  height: auto;
}

/* legacy svg sizing (if any remain) */
.icon-sm svg { width: 1rem; height: 1rem; }
.icon-md svg { width: 1.25rem; height: 1.25rem; }
.icon-lg svg { width: 1.75rem; height: 1.75rem; }
.icon-xl svg { width: 2.5rem; height: 2.5rem; }
.icon-xs svg { width: 0.875rem; height: 0.875rem; }

.animate-fade-in {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 640px) {
  .page,
  .success-page {
    max-width: 480px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }

  .sheet {
    left: 50%;
    right: auto;
    width: min(480px, 100%);
    transform: translateX(-50%) translateY(0);
  }

  .sheet.hidden {
    transform: translateX(-50%) translateY(100%);
  }
}
