:root {
  --pm-primary: #2563eb;
  --pm-primary-dark: #1e3a8a;
  --pm-bg: #f4f6fb;
  --pm-surface: #ffffff;
  --pm-border: rgba(15, 23, 42, 0.08);
  --pm-radius-sm: 0.6rem;
  --pm-radius: 1rem;
  --pm-radius-lg: 1.25rem;
  --pm-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --pm-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.12);
  --pm-nav-height: 3.5rem;
  --pm-bottom-nav-height: 4rem;
  --bs-primary: var(--pm-primary);
  --bs-primary-rgb: 37, 99, 235;
}

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

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

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background-color: var(--pm-bg);
  -webkit-tap-highlight-color: transparent;
}

body.has-bottom-nav {
  padding-bottom: calc(var(--pm-bottom-nav-height) + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  body.has-bottom-nav {
    padding-bottom: 0;
  }
}

main {
  flex: 1 1 auto;
  width: 100%;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.validation-summary-valid {
  display: none;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Buttons and form controls sized for touch */
.btn {
  min-height: 2.75rem;
}

.btn-lg {
  min-height: 3.25rem;
}

.form-control, .form-select {
  min-height: 2.75rem;
}

.form-control-lg {
  min-height: 3.25rem;
}

/* App header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1040;
  background: var(--pm-surface);
  border-bottom: 1px solid var(--pm-border);
  padding-top: env(safe-area-inset-top);
}

.app-header .navbar {
  min-height: var(--pm-nav-height);
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--pm-primary-dark) !important;
}

.app-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--pm-primary-dark), var(--pm-primary));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--pm-bg);
  color: var(--pm-primary-dark);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  background: var(--pm-surface);
  border-top: 1px solid var(--pm-border);
  box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
  padding-bottom: env(safe-area-inset-bottom);
}

@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav-link {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.5rem 0 0.4rem;
  min-height: var(--pm-bottom-nav-height);
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
}

.bottom-nav-link svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-link.active {
  color: var(--pm-primary);
}

.bottom-nav form {
  display: contents;
}

/* Hero banner */
.hero-banner {
  background: linear-gradient(135deg, var(--pm-primary-dark) 0%, var(--pm-primary) 100%);
  border-radius: var(--pm-radius-lg);
}

.hero-banner .btn-cta {
  width: 100%;
}

@media (min-width: 768px) {
  .hero-banner .btn-cta {
    width: auto;
  }
}

/* Cards */
.card {
  border-radius: var(--pm-radius);
}

.stat-card {
  transition: transform 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Auth card (Login page) */
.auth-shell {
  min-height: calc(100dvh - var(--pm-nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  background: var(--pm-surface);
  border-radius: var(--pm-radius-lg);
  box-shadow: var(--pm-shadow);
  padding: 2rem 1.5rem;
}

@media (min-width: 576px) {
  .auth-card {
    padding: 2.5rem;
  }
}

.auth-step-dots {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-step-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--pm-border);
}

.auth-step-dots span.active {
  background: var(--pm-primary);
  width: 1.25rem;
  border-radius: 1rem;
  transition: width 0.2s ease-in-out;
}

.otp-input {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
}

/* Statement page: mobile transaction cards */
.txn-card {
  background: var(--pm-surface);
  border: 1px solid var(--pm-border);
  border-radius: var(--pm-radius-sm);
  padding: 0.75rem 0.9rem;
}

.txn-card + .txn-card {
  margin-top: 0.5rem;
}

.txn-amounts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--pm-border);
}

.txn-amounts > div {
  display: flex;
  flex-direction: column;
}

.txn-amount-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bs-secondary-color);
  font-weight: 600;
}

.txn-amount-value {
  font-weight: 600;
  font-size: 0.85rem;
}

.balance-banner {
  border-radius: var(--pm-radius-sm);
  padding: 0.75rem 0.9rem;
  background: var(--pm-bg);
  font-weight: 600;
}

.type-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.08);
  color: var(--pm-primary-dark);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Statement page: desktop table */
.statement-table {
  --bs-table-bg: transparent;
}

.statement-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
  font-weight: 600;
  border-bottom: 1px solid var(--pm-border);
  padding: 0.9rem 1rem;
}

.statement-table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--pm-border);
  vertical-align: middle;
}

.statement-table tbody tr:last-child td {
  border-bottom: 0;
}

.statement-table tbody tr:not(.balance-row):hover {
  background-color: var(--pm-bg);
}

.statement-table tbody tr.balance-row td {
  background-color: var(--pm-bg);
  font-weight: 600;
}

.statement-table .amount-cell {
  font-variant-numeric: tabular-nums;
}
