/* --- Core Variable Framework & Resets --- */
:root {
    --primary: #E2136E;
    --primary-glow: rgba(226, 19, 110, 0.2);
    --secondary: #FFFFFF;
    --accent: #F8F9FA;
    --success: #00C853;
    --warning: #FFB300;
    --text-dark: #1E293B;
    --text-muted: #64748B;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background: #0F172A; /* Slate 900 background mimicking natural external ecosystem surroundings */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-dark);
    overflow: hidden;
}

/* App Containment Layer (Simulating high end hardware viewports on large monitors) */
.app-container {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    background: #F1F5F9;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media(min-width: 421px) {
    .app-container {
        height: 840px;
        border-radius: 32px;
    }
}

/* --- Views Management Layer --- */
.view, .app-view {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.app-view {
    padding: 80px 20px 100px 20px;
    box-sizing: border-box;
    overflow-y: auto;
    height: 100%;
}

.hidden {
    opacity: 0 !important;
    transform: scale(0.96) !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

/* --- Splash Screen CSS --- */
#splash-screen {
    background: linear-gradient(135deg, var(--primary) 0%, #9d0547 100%);
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 100;
}

.brand-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-lg);
    animation: pulseGlow 2s infinite ease-in-out;
}

.brand-logo span {
    font-size: 45px;
    color: var(--primary);
}

#splash-screen h1 {
    font-size: 32px;
    font-weight: 700;
    margin-top: 16px;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 6px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    margin-top: 40px;
    animation: spin 0.8s linear infinite;
}

/* --- Authentication Interfaces --- */
#login-view {
    background: #F8F9FA;
    padding: 40px 24px;
    justify-content: space-between;
}

.brand-logo.mini {
    width: 50px;
    height: 50px;
    border-radius: 14px;
}
.brand-logo.mini span { font-size: 28px; }

.login-header { margin-top: 40px; }
.login-header h2 { font-size: 26px; margin-top: 16px; font-weight: 700; color: var(--text-dark); }
.login-header p { color: var(--text-muted); margin-top: 4px; }

.auth-form { margin-top: 40px; flex-grow: 1; }

.input-group {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}
.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.prefix {
    position: absolute;
    left: 16px;
    font-weight: 600;
    color: var(--text-dark);
    border-right: 1px solid #CBD5E1;
    padding-right: 10px;
}
.input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 75px;
    border-radius: 14px;
    border: 1px solid #E2E8F0;
    background: white;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    outline: none;
    transition: all 0.2s;
}
.input-wrapper .icon-left {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
}
.input-wrapper input[type="password"] {
    padding-left: 48px;
    letter-spacing: 6px;
}
.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 20px -5px rgba(226, 19, 110, 0.4);
}
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
    background: #E2E8F0;
    color: var(--text-dark);
}

.auth-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.btn-biometric {
    background: white;
    border: 1px solid #E2E8F0;
    padding: 12px 24px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-dark);
    box-shadow: var(--shadow-sm);
}

/* --- Application Layout Shell --- */
.app-header {
    position: absolute;
    top: 0;
    width: 100%;
    height: 72px;
    background: rgba(241, 245, 249, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 90;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.header-user { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
}
.user-info .greeting { font-size: 11px; color: var(--text-muted); }
.user-info .user-name { font-size: 15px; font-weight: 600; }

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.icon-btn .badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

/* --- Premium Balance Card Layout --- */
.balance-card {
    position: relative;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    border-radius: 24px;
    padding: 24px;
    color: white;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.card-bg-glow {
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(226,19,110,0.35) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}
.balance-title { font-size: 12px; opacity: 0.7; text-transform: uppercase; letter-spacing: 1px; }
.balance-container {
    margin: 12px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: rgba(255,255,255,0.06);
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.2s;
}
.balance-container:active { background: rgba(255,255,255,0.15); }
.balance-container .currency { font-size: 24px; font-weight: 700; color: var(--primary); }
#balance-text { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; transition: all 0.2s;}
.balance-masked {
    font-size: 14px !important;
    opacity: 0.9;
}
.card-footer { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.5; margin-top: 12px;}
.tier-tag { color: #38BDF8; font-weight: 600; }

/* --- Feature Interactive Matrix Grid --- */
.section-title { font-size: 14px; font-weight: 700; color: var(--text-dark); margin: 16px 0 12px 0; letter-spacing: -0.2px;}

.services-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 16px 12px;
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.services-grid.extended { grid-template-columns: repeat(3, 1fr); gap: 16px 8px; }

.service-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}
.service-item:active { transform: scale(0.92); }
.service-item .icon-box {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: #F1F5F9;
    color: #475569;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.02);
}
.service-item span { font-size: 11px; font-weight: 500; color: #334155; white-space: nowrap;}

/* Dynamic core system color maps */
.p-send { background: rgba(14, 165, 233, 0.1) !important; color: #0EA5E9 !important; }
.p-req { background: rgba(139, 92, 246, 0.1) !important; color: #8B5CF6 !important; }
.p-cashout { background: rgba(245, 158, 11, 0.1) !important; color: #F59E0B !important; }
.p-add { background: rgba(16, 185, 129, 0.1) !important; color: #10B981 !important; }

/* Promotional Banners */
.promo-banner {
    background: linear-gradient(90deg, #6366F1 0%, #4F46E5 100%);
    border-radius: 16px;
    padding: 16px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.promo-text h5 { font-size: 14px; font-weight: 600; }
.promo-text p { font-size: 11px; opacity: 0.8; margin-top: 2px; line-height: 1.4; }
.promo-icon { font-size: 36px; opacity: 0.3; }

/* --- Bottom Navigation Styles --- */
.bottom-nav {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 72px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 90;
    padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    font-size: 10px;
    gap: 4px;
    width: 60px;
    transition: color 0.2s;
}
.nav-item span.material-icons-round { font-size: 24px; transition: transform 0.2s; }
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-item.active span.material-icons-round { transform: translateY(-2px); }
.nav-placeholder { width: 48px; pointer-events: none; }

/* Floating Action Center Button */
.fab-qr {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    background: var(--primary);
    border-radius: 50%;
    border: 5px solid #F1F5F9;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 20px rgba(226, 19, 110, 0.35);
    z-index: 95;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.fab-qr span { font-size: 28px; }
.fab-label { display: none; }
.fab-qr:active { transform: translateX(-50%) scale(0.92); box-shadow: none; }

/* --- Transaction Interface Structure --- */
.view-header-sticky {
    position: sticky;
    top: -80px;
    background: #F1F5F9;
    z-index: 20;
    padding-bottom: 12px;
}
.search-box {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
}
.search-box input { border: none; outline: none; width: 100%; font-size: 14px; }
.search-box span { color: var(--text-muted); }

.filter-chips { display: flex; gap: 8px; }
.chip {
    background: white;
    border: 1px solid #E2E8F0;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}
.chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.transaction-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px;}
.tx-card {
    background: white;
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}
.tx-left { display: flex; align-items: center; gap: 12px; }
.tx-icon-frame {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}
.tx-details h5 { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.tx-details p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tx-right { text-align: right; }
.tx-amount { font-size: 14px; font-weight: 700; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--text-dark); }
.tx-id { font-size: 9px; color: var(--text-muted); font-family: monospace; margin-top: 4px; }

/* --- Bottom Sheet Core --- */
.bottom-sheet-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.4);
    z-index: 200;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.bottom-sheet-overlay.active { opacity: 1; pointer-events: auto; }

.bottom-sheet-container {
    position: absolute;
    bottom: 0; width: 100%;
    background: white;
    border-radius: 24px 24px 0 0;
    padding: 20px 24px 40px 24px;
    box-sizing: border-box;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
}
.bottom-sheet-overlay.active .bottom-sheet-container { transform: translateY(0); }
.sheet-handle {
    width: 40px; height: 4px; background: #E2E8F0; border-radius: 2px; margin: 0 auto 20px auto;
}

/* --- Modals & Custom Keyboard Interface --- */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    box-sizing: border-box;
}
.modal-box {
    background: white; width: 100%; border-radius: 24px; padding: 24px; box-shadow: var(--shadow-lg);
    text-center: center;
}
.modal-box h4 { font-size: 18px; font-weight: 700; margin-bottom: 6px; text-align: center;}
.modal-box p { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 20px; line-height: 1.4;}

/* Dot verification systems */
.pin-display-dots { display: flex; justify-content: center; gap: 16px; margin: 20px 0; }
.pin-display-dots .dot {
    width: 14px; height: 14px; border: 2px solid #CBD5E1; border-radius: 50%; transition: all 0.1s;
}
.pin-display-dots .dot.filled { background: var(--primary); border-color: var(--primary); transform: scale(1.1); }

.pin-pad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 24px;
}
.pin-btn {
    background: #F8F9FA; border: none; height: 54px; border-radius: 14px;
    font-size: 18px; font-weight: 600; color: var(--text-dark); cursor: pointer;
    display: flex; justify-content: center; align-items: center; transition: background 0.1s;
}
.pin-btn:active { background: #E2E8F0; }

/* --- Profile Styling Structural Architecture --- */
.profile-hero {
    display: flex; flex-direction: column; align-items: center; margin-bottom: 24px; text-align: center;
}
.profile-avatar-large {
    width: 72px; height: 72px; background: #E2E8F0; color: var(--text-dark);
    font-size: 24px; font-weight: 700; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; margin-bottom: 12px;
    border: 3px solid white; box-shadow: var(--shadow-sm);
}
.badge-verified {
    display: inline-flex; align-items: center; gap: 4px; background: rgba(0,200,83,0.1);
    color: var(--success); font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; margin-top: 8px;
}
.settings-group {
    background: white; border-radius: 20px; padding: 8px; box-shadow: var(--shadow-sm);
}
.settings-item {
    display: flex; justify-content: space-between; align-items: center; padding: 14px 12px;
    border-bottom: 1px solid #F1F5F9; cursor: pointer;
}
.settings-item:last-child { border: none; }
.item-left { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; }
.item-left span:first-child { font-size: 20px; color: #64748B; }
.text-danger { color: #EF4444 !important; }
.badge-count { background: #E2E8F0; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;}

/* --- Hardware Utilities Simulation (QR / Success) --- */
.qr-overlay {
    position: absolute; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85);
    z-index: 400; display:flex; justify-content:center; align-items:center;
}
.qr-scanner-frame {
    position: relative; width: 240px; height: 240px; border: 4px solid var(--primary); border-radius: 24px;
    box-shadow: 0 0 0 400px rgba(0,0,0,0.4);
}
.scanner-laser {
    position: absolute; width:100%; height:3px; background:var(--primary); top:0;
    box-shadow: 0 0 8px var(--primary); animation: scanning 2s linear infinite;
}
.close-qr-btn {
    position: absolute; top: -60px; right: 0; background: rgba(255,255,255,0.2);
    border: none; width: 40px; height: 40px; border-radius: 50%; color: white; cursor: pointer;
}
.qr-tip {
    position: absolute; bottom: -50px; width: 100%; text-align: center; color: white; font-size: 12px; opacity: 0.8;
}

.success-screen {
    position: absolute; top:0; left:0; width:100%; height:100%; background:#F1F5F9;
    z-index: 500; padding: 40px 24px; display:flex; flex-direction:column; align-items:center; justify-content: center;
}
.success-icon-glow { font-size: 72px; color: var(--success); animation: scaleUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.success-screen h2 { font-size: 22px; font-weight: 700; margin: 16px 0 24px 0; }
.receipt-card {
    background: white; width: 100%; border-radius: 20px; padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 40px;
}
.receipt-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 13px;}
.receipt-row span { color: var(--text-muted); }
.receipt-row strong { color: var(--text-dark); }
.receipt-card hr { border: none; border-top: 1px dashed #E2E8F0; margin: 16px 0; }

/* --- Toast Framework Elements --- */
#toast-container {
    position: absolute; top: 20px; left: 50%; transform: translateX(-50%); width: calc(100% - 40px);
    z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    background: rgba(30, 41, 59, 0.95); color: white; padding: 12px 16px; border-radius: 12px;
    font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-lg); animation: slideDownToast 0.3s ease forward;
}

/* --- Toggle Switch UI Component --- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #CBD5E1; transition: .3s; border-radius: 24px;
}
.slider:before {
    position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- Skeleton Infrastructure CSS --- */
.skeleton-item {
    width: 100%; height: 74px; background: linear-gradient(90deg, #E2E8F0 25%, #F1F5F9 50%, #E2E8F0 75%);
    background-size: 200% 100%; animation: loadingShimmer 1.5s infinite; border-radius: 16px; margin-bottom: 10px;
}

/* --- Native Touch Material Ripple Utility --- */
.ripple { position: relative; overflow: hidden; }
.ripple-effect {
    position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.3);
    transform: scale(0); animation: rippleAnim 0.5s linear; pointer-events: none;
}

/* --- Keyframe Matrix (60fps Accelerated HW) --- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseGlow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes scanning { 0% { top: 0%; } 50% { top: 100%; } 100% { top: 0%; } }
@keyframes scaleUp { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideDownToast { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }
@keyframes loadingShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }