:root {
  --primary: #E2136E;
  --primary-light: #ff4d94;
  --primary-dark: #b80f58;
  --primary-glow: rgba(226, 19, 110, 0.2);
  --secondary: #6366f1;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  
  /* Light Mode */
  --bg: #f4f7fa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-solid: #ffffff;
  --bg-input: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 8px 30px var(--primary-glow);
  --nav-height: 72px;
  --topbar-height: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font-display: Arial, 'Plus Jakarta Sans', sans-serif;
  --font-body: Arial, 'Hind Siliguri', sans-serif;
  --bkash: #E2136E;
  --nagad: #F6921E;
  --upay: #0066CC;
  --rocket: #8B008B;
}

[data-theme="dark"] {
  --bg: #070b14;
  --bg-elevated: #0f172a;
  --bg-card: #1e293b;
  --bg-card-solid: #1e293b;
  --bg-input: rgba(51, 65, 85, 0.45);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --primary-glow: rgba(226, 19, 110, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; transition: background .3s ease; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: color .3s ease, background .3s ease;
}

.app-bg { position: fixed; inset: 0; z-index: -1; background: var(--bg); }
[data-theme="dark"] .app-bg {
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(226, 19, 110, 0.15), transparent), #070b14;
}
[data-theme="light"] .app-bg {
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(226, 19, 110, 0.05), transparent), #f8fafc;
}

/* Global Icons */
svg { width: 24px; height: 24px; display: block; flex-shrink: 0; }
img { max-width: 100%; height: auto; }

.main-content {
  padding: 16px;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 30px);
  max-width: 480px;
  margin: 0 auto;
}
.main-content.has-topbar { padding-top: calc(var(--topbar-height) + var(--safe-top) + 12px); }

/* Brand Logo */
.brand-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo__mark { border-radius: 12px; object-fit: contain; box-shadow: 0 4px 12px var(--primary-glow); }
.brand-logo__text {
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.02em;
}
.brand-logo--lg .brand-logo__mark { width: 60px; height: 60px; border-radius: 18px; }
.brand-logo--sm .brand-logo__mark { width: 36px; height: 36px; }

/* Top App Bar */
.app-topbar {
  position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(var(--topbar-height) + var(--safe-top));
  padding: calc(8px + var(--safe-top)) 16px 8px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); z-index: 900;
  transition: background .3s ease;
}
.app-topbar__meta { text-align: right; }
.app-topbar__page { display: block; font-size: .65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.app-topbar__date { font-size: .85rem; font-weight: 800; color: var(--text); }

/* Theme Toggle */
.theme-toggle-btn {
  background: var(--bg-input) !important; width: 44px; height: 44px; border-radius: 14px !important;
  display: flex; align-items: center; justify-content: center; color: var(--text) !important;
  transition: transform .2s, background .2s;
}
.theme-toggle-btn:active { transform: scale(.9); }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.back-btn { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); text-decoration: none; font-size: .95rem; font-weight: 700; }

/* Hero Card */
.hero-card {
  position: relative; border-radius: 28px; padding: 28px; margin-bottom: 24px; overflow: hidden;
  background: linear-gradient(135deg, #E2136E 0%, #b80f58 50%, #0f172a 100%);
  box-shadow: 0 12px 40px var(--primary-glow); color: #fff;
}
.hero-card__name { font-family: var(--font-display); font-size: 1.35rem; font-weight: 800; margin-bottom: 24px; }
.hero-card__balance-label { font-size: .75rem; opacity: .85; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.hero-card__balance { font-family: var(--font-display); font-size: 2.5rem; font-weight: 800; margin: 8px 0 24px; letter-spacing: -0.04em; }
.hero-card__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hero-card__mini { background: rgba(255, 255, 255, 0.12); backdrop-filter: blur(10px); border-radius: 18px; padding: 14px 8px; text-align: center; border: 1px solid rgba(255,255,255,0.1); }
.hero-card__mini-label { font-size: .6rem; opacity: .85; text-transform: uppercase; font-weight: 700; }
.hero-card__mini-value { font-family: var(--font-display); font-size: .95rem; font-weight: 800; margin-top: 6px; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 28px; }
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--text);
  padding: 14px 4px; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border); transition: all .2s;
}
.quick-action:active { transform: scale(.92); background: var(--bg-input); }
.quick-action__icon {
  width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; background: var(--bg-input); transition: background .2s;
}
.quick-action__icon svg { width: 22px; height: 22px; }
.quick-action span:last-child { font-size: .62rem; font-weight: 800; color: var(--text); text-align: center; }
[data-theme="dark"] .quick-action span:last-child { color: var(--text-muted); }

/* Search Box */
.search-box { position: relative; margin-bottom: 24px; }
.search-box input { padding-left: 52px; height: 56px; background: var(--bg-card); border-radius: 18px; font-weight: 700; border: 1px solid var(--border); font-size: 1.05rem; }
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.search-box svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; color: var(--text-muted); pointer-events: none; }

/* Cards & Stats */
.card { background: var(--bg-card); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-title { font-family: var(--font-display); font-size: .85rem; color: var(--text-muted); margin-bottom: 18px; text-transform: uppercase; font-weight: 800; letter-spacing: .05em; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border-radius: 22px; padding: 20px; border: 1px solid var(--border); position: relative; border-left: 5px solid var(--accent, var(--primary)); }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-bottom: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 900; color: var(--text); letter-spacing: -0.03em; }
.stat-value.in { color: var(--success) !important; }
.stat-value.out { color: var(--danger) !important; }
.stat-value.profit { color: var(--warning) !important; }

/* Services */
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.service-card { display: block; text-decoration: none; color: var(--text); background: var(--bg-card); border-radius: 22px; padding: 18px; border: 1px solid var(--border); position: relative; transition: all .2s; }
.service-card:active { transform: scale(.97); }
.service-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.svc-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; color: #fff; flex-shrink: 0; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.svc-icon--bkash { background: var(--bkash); }
.svc-icon--nagad { background: var(--nagad); }
.svc-icon--upay { background: var(--upay); }
.svc-icon--rocket { background: var(--rocket); }
.service-name { font-weight: 800; font-size: .85rem; color: var(--text); }
.service-balance { font-family: var(--font-display); font-size: 1.2rem; font-weight: 800; color: var(--text); }
.service-meta { font-size: .72rem; color: var(--text-muted); margin-top: 10px; font-weight: 600; }

/* Forms & Inputs */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: .9rem; color: var(--text); margin-bottom: 10px; font-weight: 700; }
[data-theme="dark"] .form-label { color: var(--text-muted); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 16px 18px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 16px;
  color: var(--text); font-family: inherit; font-size: 1.05rem; font-weight: 600; transition: all .2s;
}
.form-input:focus { outline: none; border-color: var(--primary); background: var(--bg-card-solid); box-shadow: 0 0 0 4px var(--primary-glow); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 16px 28px; border: none;
  border-radius: 18px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 800; cursor: pointer; transition: all .2s; width: 100%;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 8px 24px var(--primary-glow); }
.btn-primary:active { transform: scale(.96); }
.btn-outline { background: transparent; border: 2.5px solid var(--border-strong); color: var(--text); }
.btn-outline:hover { background: var(--bg-input); }
.btn-sm { padding: 12px 20px; font-size: .9rem; width: auto; border-radius: 14px; }

/* Bottom Nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: calc(var(--nav-height) + var(--safe-bottom));
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--bg-card); backdrop-filter: blur(24px); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center; z-index: 1000; border-radius: 28px 28px 0 0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.03); transition: background .3s;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--text-muted); font-size: .68rem; font-weight: 800; transition: all .2s; }
.nav-item__icon { width: 44px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 14px; transition: all .2s; }
.nav-item.active { color: var(--primary); }
.nav-item.active .nav-item__icon { background: var(--success-soft); color: var(--primary); }

/* Customers */
.customer-card { display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: var(--text); background: var(--bg-card); border-radius: 24px; padding: 20px; border: 1px solid var(--border); margin-bottom: 14px; transition: all .2s; box-shadow: var(--shadow); }
.customer-card:active { transform: scale(.97); }
.customer-card__avatar { width: 54px; height: 54px; border-radius: 18px; background: var(--bg-input); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--primary); border: 1px solid var(--border); margin-right: 16px; }
.customer-name { font-weight: 800; font-size: 1.05rem; color: var(--text); }
.due-label { font-size: .65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-bottom: 4px; }
.due-value { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: var(--bg-card-solid); width: 100%; max-width: 420px; border-radius: 32px; padding: 32px; border: 1px solid var(--border); box-shadow: 0 20px 60px rgba(0,0,0,0.5); }

/* Cash Calculator Specifics */
.denom-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.denom-label { width: 65px; font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }
.denom-input { width: 85px !important; text-align: center; font-weight: 800; border-radius: 12px; height: 48px; }
.denom-result { flex: 1; text-align: right; font-family: var(--font-display); font-weight: 800; font-size: 1rem; color: var(--success); }

/* Toasts */
.toast { position: fixed; top: calc(20px + var(--safe-top)); left: 20px; right: 20px; max-width: 460px; margin: 0 auto; padding: 18px 24px; border-radius: 18px; font-weight: 800; z-index: 9999; animation: slideDown .4s ease; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }

.bg-danger-light { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.bg-success-light { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }

[data-theme="light"] .bg-danger-light { background: #fee2e2; color: #dc2626; }
[data-theme="light"] .bg-success-light { background: #dcfce7; color: #16a34a; }

/* Transaction Items */
.transaction-list { display: flex; flex-direction: column; gap: 4px; }
.transaction-item {
  display: flex; align-items: center; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border);
}
.transaction-item__icon {
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem; color: #fff;
}
.transaction-item__icon.bg-danger { background: var(--danger); }
.transaction-item__icon.bg-success { background: var(--success); }
.transaction-item__info { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.transaction-type { font-weight: 800; font-size: .95rem; color: var(--text); }
.transaction-date { font-size: .75rem; color: var(--text-muted); font-weight: 600; }
.transaction-note { font-size: .8rem; color: var(--text-muted); font-style: italic; margin-top: 2px; }
.transaction-item__amount { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; }

.action-buttons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

/* Action Tabs (In/Out) */
.action-tabs {
  display: flex;
  background: var(--bg-input);
  padding: 6px;
  border-radius: 16px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.action-tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  transition: all .3s ease;
}

.action-tab.active.in { background: var(--success); color: #fff; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.action-tab.active.out { background: var(--danger); color: #fff; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

