/* =============================================================
   BankDash — Complete Design System V2
   Pure Black Theme | Mobile-First | App-Like Workflow
   Inspired by Khata Book / Ledger App UX
   ============================================================= */

/* ── CSS Custom Properties ──────────────────────────────── */
:root {
  /* Core Colors — Pure Black Theme */
  --bg-app: #000000;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --bg-input: #111111;
  --bg-header: #111111;
  --bg-sheet: #1a1a1a;

  /* Accent */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.2);
  --fab-color: #e91e8a;
  --fab-hover: #d6176f;

  /* Credits & Debits */
  --credit: #22c55e;
  --credit-dark: #16a34a;
  --credit-bg: rgba(34, 197, 94, 0.12);
  --debit: #ef4444;
  --debit-dark: #dc2626;
  --debit-bg: rgba(239, 68, 68, 0.12);

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Borders */
  --border: #2a2a2a;
  --border-light: #3a3a3a;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slide: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Safe Areas */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Reset & Base ───────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

/* ══════════════════════════════════════════════════════════
   APP LAYOUT — Mobile-First, View-Based Navigation
   ══════════════════════════════════════════════════════════ */

.app-wrapper {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Desktop centering */
@media (min-width: 501px) {
  body {
    background: #0a0a0a;
  }

  .app-wrapper {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  }
}

/* ── Views (Screen Switching) ───────────────────────────── */
.view {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-app);
}

.view.active {
  display: flex;
  animation: viewFadeIn 0.25s ease;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ══════════════════════════════════════════════════════════
   VIEW 1: HOME — CUSTOMER LIST
   ══════════════════════════════════════════════════════════ */

/* ── App Header ─────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.app-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.app-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

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

.icon-btn-sm {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.icon-btn-sm:hover {
  background: var(--bg-card);
}

/* ── Summary Bar ────────────────────────────────────────── */
.summary-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  margin: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.summary-item {
  flex: 1;
  padding: var(--space-md);
  text-align: center;
}

.summary-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.summary-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
}

.summary-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

/* ── Search Bar ─────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 var(--space-md) var(--space-sm);
  padding: 0 var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  height: 44px;
}

.search-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ── Customer List ──────────────────────────────────────── */
.customer-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 140px;
  /* Space for FAB + bottom nav */
}

.customer-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.customer-card:active {
  background: var(--bg-card-hover);
}

.customer-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* Rotating avatar colors */
.avatar-blue {
  background: #3b82f6;
}

.avatar-green {
  background: #22c55e;
}

.avatar-purple {
  background: #8b5cf6;
}

.avatar-orange {
  background: #f97316;
}

.avatar-pink {
  background: #ec4899;
}

.avatar-teal {
  background: #14b8a6;
}

.customer-info {
  flex: 1;
  min-width: 0;
}

.customer-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.customer-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.customer-balance {
  text-align: right;
  flex-shrink: 0;
}

.customer-balance-amount {
  font-weight: 700;
  font-size: 0.95rem;
}

.customer-balance-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Floating Action Button ─────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(70px + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  background: var(--fab-color);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(233, 30, 138, 0.4);
  transition: all var(--transition-base);
  z-index: 60;
}

.fab:hover {
  background: var(--fab-hover);
  transform: translateX(-50%) scale(1.05);
}

.fab:active {
  transform: translateX(-50%) scale(0.95);
}

.fab-icon {
  font-size: 1rem;
}

/* Constrain FAB to app-wrapper on desktop */
@media (min-width: 501px) {
  .fab {
    max-width: 500px;
  }
}

/* ── Bottom Navigation ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  display: flex;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 50;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 0;
  cursor: pointer;
  transition: color var(--transition-fast);
  color: var(--text-muted);
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ══════════════════════════════════════════════════════════
   VIEW 2: CUSTOMER DETAIL
   ══════════════════════════════════════════════════════════ */

/* ── Detail Header ──────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.back-btn:hover {
  background: var(--bg-card);
}

.detail-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.detail-user-info {
  flex: 1;
  min-width: 0;
}

.detail-user-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.detail-user-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ── Detail Balance Bar ─────────────────────────────────── */
.detail-balance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.detail-balance-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.detail-balance-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--accent);
}

/* ── Detail Actions Row ─────────────────────────────────── */
.detail-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.detail-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.detail-action-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.detail-action-icon {
  font-size: 1.3rem;
}

/* ── Entries Header ─────────────────────────────────────── */
.entries-header {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.entries-col {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.entries-col:first-child {
  flex: 1;
}

.entries-col:nth-child(2),
.entries-col:nth-child(3) {
  width: 90px;
  text-align: right;
}

/* ── Entry Cards ────────────────────────────────────────── */
.entries-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px;
  /* Space for sticky buttons */
}

.entry-card {
  display: flex;
  align-items: flex-start;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
}

.entry-card:hover {
  background: var(--bg-card-hover);
}

.entry-card-info {
  flex: 1;
  min-width: 0;
}

.entry-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.entry-card-balance {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.entry-card-desc {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  margin-top: 4px;
}

.entry-card-debit,
.entry-card-credit {
  width: 90px;
  text-align: right;
  font-weight: 700;
  font-size: 0.9rem;
  padding-top: 2px;
}

.entry-card-debit {
  color: var(--debit);
}

.entry-card-credit {
  color: var(--credit);
}

/* ── Sticky Bottom Buttons ──────────────────────────────── */
.sticky-bottom-actions {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  display: flex;
  gap: 0;
  background: var(--bg-app);
  padding: 0;
  padding-bottom: var(--safe-bottom);
  z-index: 50;
}

.sticky-action-btn {
  flex: 1;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
}

.sticky-action-btn:active {
  transform: scale(0.98);
}

.debit-btn {
  background: var(--debit);
  color: white;
}

.debit-btn:hover {
  background: var(--debit-dark);
}

.credit-btn {
  background: var(--credit);
  color: white;
}

.credit-btn:hover {
  background: var(--credit-dark);
}

/* ══════════════════════════════════════════════════════════
   VIEW 3: TRANSACTION ENTRY
   ══════════════════════════════════════════════════════════ */

.entry-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.entry-header.credit-mode {
  background: var(--credit-dark);
}

.entry-header.debit-mode {
  background: var(--debit-dark);
}

.entry-title {
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.entry-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
}

/* Amount Input */
.amount-input-wrapper {
  display: flex;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  transition: border-color var(--transition-fast);
}

.amount-input-wrapper.credit-mode {
  border-color: var(--credit);
}

.amount-input-wrapper.debit-mode {
  border-color: var(--debit);
}

.amount-prefix {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: var(--space-sm);
}

.amount-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-sans);
  min-width: 0;
}

.amount-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Remove spinner from number input */
.amount-input::-webkit-outer-spin-button,
.amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-input[type=number] {
  -moz-appearance: textfield;
}

.amount-clear {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
}

/* Details Input */
.entry-details-input {
  margin-bottom: var(--space-lg);
}

.details-input {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

.details-input:focus {
  border-color: var(--accent);
}

.details-input::placeholder {
  color: var(--text-muted);
}

/* Meta Row */
.entry-meta-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.entry-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.entry-spacer {
  flex: 1;
}

/* Save Button */
.save-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--transition-fast);
  color: white;
  margin-top: auto;
}

.save-btn.credit-mode {
  background: var(--credit);
}

.save-btn.credit-mode:hover {
  background: var(--credit-dark);
}

.save-btn.debit-mode {
  background: var(--debit);
}

.save-btn.debit-mode:hover {
  background: var(--debit-dark);
}

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

/* ══════════════════════════════════════════════════════════
   BOTTOM SHEET (Modals)
   ══════════════════════════════════════════════════════════ */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}

.bottom-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--bg-sheet);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-xl) + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--transition-slide);
}

.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-lg);
}

.bottom-sheet-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.sheet-form-group {
  margin-bottom: var(--space-md);
}

.sheet-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.sheet-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast);
}

.sheet-input:focus {
  border-color: var(--accent);
}

.sheet-input::placeholder {
  color: var(--text-muted);
}

.sheet-save-btn {
  width: 100%;
  padding: 0.85rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-sm);
}

.sheet-save-btn:hover {
  background: var(--accent-hover);
}

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

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  background: var(--bg-app);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.login-logo .logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════
   USER DASHBOARD (index.html)
   ══════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 500px;
  margin: 0 auto;
}

@media (min-width: 501px) {
  .page-wrapper {
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

.navbar {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-brand .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.navbar-user .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.card-title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-top: 4px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.card-icon.balance {
  background: var(--accent-glow);
  color: var(--accent);
}

.card-icon.credit {
  background: var(--credit-bg);
  color: var(--credit);
}

.card-icon.debit {
  background: var(--debit-bg);
  color: var(--debit);
}

.summary-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 400px) {
  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .card-value {
    font-size: 1.1rem;
  }
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.55rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
}

/* ── Form Elements ──────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.table thead {
  background: var(--bg-card);
}

.table th {
  padding: 0.65rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.table td {
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-card-hover);
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
}

.badge-credit {
  background: var(--credit-bg);
  color: var(--credit);
}

.badge-debit {
  background: var(--debit-bg);
  color: var(--debit);
}

.amount-credit {
  color: var(--credit);
  font-weight: 700;
}

.amount-debit {
  color: var(--debit);
  font-weight: 700;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pagination-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
  background: var(--accent);
  color: white;
}

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

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 460px;
  width: 90%;
}

.toast {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 3.7s forwards;
  text-align: center;
}

.toast-success {
  background: var(--credit);
  color: white;
}

.toast-error {
  background: var(--debit);
  color: white;
}

.toast-info {
  background: var(--accent);
  color: white;
}

@keyframes toastIn {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ── Loading & Empty States ──────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-md);
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
}

.empty-state-text {
  font-size: 0.85rem;
}

/* ── Filters Bar ─────────────────────────────────────────── */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  align-items: flex-end;
}

.filters-bar .form-group {
  margin-bottom: 0;
  flex: 1;
  min-width: 100px;
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Welcome Bar ─────────────────────────────────────────── */
.welcome-bar {
  margin-bottom: var(--space-lg);
}

.welcome-bar h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.welcome-bar p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Content ─────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: var(--space-lg) 0;
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  margin-bottom: var(--space-md);
  border: 1px solid;
}

.alert-error {
  background: var(--debit-bg);
  color: var(--debit);
  border-color: rgba(239, 68, 68, 0.3);
}

.account-number {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

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

.text-credit {
  color: var(--credit);
}

.text-debit {
  color: var(--debit);
}

.text-muted {
  color: var(--text-muted);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* ══════════════════════════════════════════════════════════
   VIEW 4: ENTRY DETAILS
   ══════════════════════════════════════════════════════════ */

.entry-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.entry-detail-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.entry-detail-card {
  margin: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.entry-detail-top {
  padding: var(--space-lg);
}

.entry-detail-user-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.entry-detail-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.entry-detail-user-info {
  flex: 1;
  min-width: 0;
}

.entry-detail-user-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.entry-detail-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.entry-detail-amount-col {
  text-align: right;
  flex-shrink: 0;
}

.entry-detail-amount {
  font-weight: 700;
  font-size: 1.1rem;
}

.entry-detail-type {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: capitalize;
  margin-top: 2px;
}

.entry-detail-divider {
  height: 1px;
  background: var(--border);
}

.entry-detail-section {
  padding: var(--space-md) var(--space-lg);
}

.entry-detail-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.entry-detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}

.entry-detail-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.entry-detail-balance {
  font-weight: 700;
  font-size: 1rem;
}

.entry-detail-ref {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

.entry-detail-edit-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.entry-detail-edit-link:hover {
  background: var(--bg-card-hover);
}

.entry-detail-bottom-actions {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  padding-bottom: calc(var(--space-lg) + var(--safe-bottom));
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  background: var(--bg-app);
}

.entry-detail-delete-btn {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
}

.entry-detail-delete-btn:hover {
  border-color: var(--debit);
  color: var(--debit);
}

.entry-detail-share-btn {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: all var(--transition-fast);
}

.entry-detail-share-btn:hover {
  background: var(--accent-hover);
}

.entry-card {
  cursor: pointer;
}

/* ══════════════════════════════════════════════════════════
   USER DASHBOARD SUMMARY ROW
   ══════════════════════════════════════════════════════════ */

.user-summary-row {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.user-summary-item {
  flex: 1;
  text-align: center;
  padding: var(--space-md) var(--space-sm);
}

.user-summary-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.user-summary-value {
  font-size: 1rem;
  font-weight: 800;
}

.user-summary-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}