/* ---------- CSS VARIABLES — STANDARDIZED ---------- */
:root,
[data-theme="light"] {
  /* Brand Colors */
  --rw-primary: #0066FF;
  --rw-primary-dark: #0052CC;
  --rw-primary-soft: rgba(0, 102, 255, 0.08);
  --rw-primary-light: rgba(0, 102, 255, 0.04);
  
  --rw-success: #10B981;
  --rw-success-soft: rgba(16, 185, 129, 0.08);
  --rw-error: #EF4444;
  --rw-error-soft: rgba(239, 68, 68, 0.06);
  --rw-warning: #F59E0B;
  --rw-warning-soft: rgba(245, 158, 11, 0.08);
  
  /* Backgrounds */
  --bg-page: #FFFFFF;
  --bg-secondary: #F8FAFC;
  --bg-tertiary: #F1F5F9;
  --bg-card: rgba(255, 255, 255, 0.85);
  
  /* Borders */
  --border-light: #E2E8F0;
  --border-soft: rgba(226, 232, 240, 0.6);
  
  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;
  
  /* Spacing System — 4px base */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 102, 255, 0.12);
  
  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-blur: 24px;
  
  /* Safe Area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- DARK MODE VARIABLES ---------- */
.dark,
[data-theme="dark"] {
  --bg-page: #050A14;
  --bg-secondary: #0F172A;
  --bg-tertiary: #1E293B;
  --bg-card: rgba(14, 20, 33, 0.7);
  
  --border-light: #1E293B;
  --border-soft: rgba(255, 255, 255, 0.06);
  
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-tertiary: #64748B;
  
  --glass-bg: rgba(14, 20, 33, 0.65);
}

/* ---------- BODY & LAYOUT ---------- */
body {
  background: var(--bg-page);
  color: var(--text-primary);
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

#app {
  max-width: 430px;
  margin: 0 auto;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-page);
}

/* ---------- STANDARD PAGE CONTENT ---------- */
.page-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-lg) var(--space-md) 120px;
  background: var(--bg-page);
}

/* ---------- TYPOGRAPHY — STANDARD HIERARCHY ---------- */
h1 { font-size: 28px; font-weight: 800; line-height: 1.2; color: var(--text-primary); }
h2 { font-size: 22px; font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h3 { font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--text-primary); }
h4 { font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--text-primary); }

.text-body { font-size: 15px; line-height: 1.6; color: var(--text-secondary); }
.text-secondary { font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.text-tertiary { font-size: 13px; line-height: 1.4; color: var(--text-tertiary); }
.text-meta { font-size: 12px; line-height: 1.3; color: var(--text-tertiary); }
.text-caption { font-size: 11px; line-height: 1.3; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.08em; }

.section-heading {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: var(--space-xl) 0 var(--space-md) var(--space-sm);
}

.date-header {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: var(--space-md) var(--space-md) var(--space-sm);
  background: var(--bg-secondary);
  margin: var(--space-lg) calc(-1 * var(--space-md)) var(--space-sm);
}

/* ---------- HEADER — BLUE STANDARD ---------- */
.rw-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  padding: calc(12px + var(--safe-top)) var(--space-md) 14px;
  background: linear-gradient(180deg, var(--rw-primary) 0%, var(--rw-primary-dark) 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}

.rw-page-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
  color: white;
}

.rw-header-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rw-header-btn:active {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(0.95);
}

.rw-back-chevron {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
  fill: none;
}

/* ---------- CARDS — STANDARD CONTAINER ---------- */
.card,
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.card-solid {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}

/* ---------- LIST ITEMS — STANDARD FOR PROFILE & TRANSACTIONS ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.list-item:active {
  background: var(--bg-secondary);
}

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--rw-primary-soft);
  color: var(--rw-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.list-item-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.list-item-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: right;
}

.list-item-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
  margin-top: 2px;
}

.list-item-arrow {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ---------- TRANSACTION LIST ITEM ---------- */
.tx-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--bg-secondary);
}

.tx-item:last-child {
  border-bottom: none;
}

.tx-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--rw-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: var(--rw-primary);
  flex-shrink: 0;
}

.tx-info {
  flex: 1;
}

.tx-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.tx-time {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.tx-amount {
  font-size: 16px;
  font-weight: 600;
  text-align: right;
}

.tx-amount.credit {
  color: var(--rw-success);
}

.tx-amount.debit {
  color: var(--text-primary);
}

/* ---------- PROFILE HEADER ---------- */
.profile-header {
  background: linear-gradient(180deg, var(--rw-primary) 0%, var(--rw-primary-dark) 100%);
  padding: calc(var(--space-xl) + var(--safe-top)) var(--space-lg) var(--space-2xl);
  color: white;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: var(--space-md);
}

.profile-name {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.profile-number {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 4px;
}

.profile-buttons {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.profile-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.profile-btn.primary {
  background: white;
  color: var(--rw-primary);
}

.profile-btn.secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--rw-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

.btn-primary:active:not(:disabled) {
  background: var(--rw-primary-dark);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-secondary:active:not(:disabled) {
  background: var(--bg-tertiary);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-sm {
  padding: 10px var(--space-md);
  font-size: 14px;
  width: auto;
}

/* ---------- BOTTOM NAVIGATION — STANDARD ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-md) + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(410px, calc(100% - var(--space-xl)));
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 24px;
  padding: var(--space-sm) var(--space-md);
  backdrop-filter: blur(26px) saturate(175%);
  -webkit-backdrop-filter: blur(26px) saturate(175%);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: var(--space-xs);
  z-index: 999;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-xs);
  text-decoration: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-radius: var(--radius-md);
  position: relative;
}

.nav-item i {
  font-size: 20px;
  line-height: 1;
}

.nav-item.active,
.nav-item[aria-current="page"] {
  color: var(--rw-primary);
}

.nav-item.active::after,
.nav-item[aria-current="page"]::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rw-primary);
  margin-top: 2px;
}

.nav-item-center {
  position: relative;
  top: -16px;
}

.nav-item-center .scan-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rw-primary), var(--rw-primary-dark));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 102, 255, 0.25);
  border: 4px solid var(--bg-page);
  font-size: 22px;
}

/* ---------- UTILITIES ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }
.m-0 { margin: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mx-md { margin-left: var(--space-md); margin-right: var(--space-md); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.w-full { width: 100%; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }