:root {
    --bg: #eef2ff;
    --bg-soft: #f7f8ff;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --text: #0a145f;
    --muted: #65729a;
    --line: rgba(38, 56, 244, 0.12);
    --primary: #185ce8;
    --secondary: #6f32f5;
    --deep: #07135e;
    --success: #0fbb73;
    --danger: #ea4d67;
    --shadow: 0 18px 45px rgba(18, 32, 115, 0.15);
}

body.dark-mode {
    --bg: #09102d;
    --bg-soft: #0b1338;
    --surface: rgba(16, 23, 61, 0.82);
    --surface-strong: #0e163f;
    --text: #f4f7ff;
    --muted: #a8b0d0;
    --line: rgba(138, 160, 255, 0.14);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(24, 92, 232, 0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(111, 50, 245, 0.18), transparent 30%),
        linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
    transition: background .25s ease, color .25s ease;
}

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding: 18px 16px 112px;
}

.screen { min-height: calc(100vh - 30px); }
.screen-active { display: block; }
.d-none { display: none !important; }

.glass-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.gradient-panel,
.btn-gradient,
.virtual-card {
    background: linear-gradient(135deg, #185ce8 0%, #3f45ed 52%, #6f32f5 100%);
    color: #fff;
}

.btn-gradient {
    border: none;
    border-radius: 16px;
    min-height: 52px;
    font-weight: 700;
}

.btn-soft,
.btn-install-secondary {
    border-radius: 16px;
    min-height: 50px;
}

.btn-soft {
    border: 1px solid rgba(24, 92, 232, 0.18);
    color: var(--primary);
    background: rgba(24, 92, 232, 0.06);
}

.install-prompt {
    position: fixed;
    left: 50%;
    top: 18px;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 448px;
    padding: 18px;
    z-index: 1090;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    border: 1px solid rgba(24, 92, 232, 0.1);
}

body.dark-mode .install-prompt { background: rgba(14, 22, 63, 0.96); }
.install-logo { width: 120px; margin-bottom: 8px; }
.install-actions { display: flex; gap: 10px; margin-top: 10px; }
.btn-install-primary {
    flex: 1;
    border-radius: 16px;
    background: linear-gradient(135deg, #185ce8 0%, #6f32f5 100%);
    color: #fff;
    font-weight: 700;
}
.btn-install-secondary {
    flex: 1;
    border: 1px solid var(--line);
    color: var(--text);
    background: transparent;
}

.login-hero { text-align: center; padding-top: 42px; }
.app-icon {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    box-shadow: 0 10px 35px rgba(38, 56, 244, 0.24);
}
.app-logo { width: 220px; margin-top: 18px; }
.hero-copy { margin: 16px auto 0; color: var(--muted); max-width: 310px; }

.auth-card {
    margin-top: 28px;
    padding: 22px;
}
.auth-card h1 { font-size: 1.55rem; margin: 0 0 6px; font-weight: 800; }
.auth-card p { color: var(--muted); margin-bottom: 0; }
.badge-soft {
    background: rgba(24, 92, 232, 0.12);
    color: var(--primary);
    padding: 8px 12px;
    font-weight: 700;
}
.form-control {
    min-height: 50px;
    border-radius: 16px;
    border: 1px solid rgba(24, 92, 232, 0.14);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text);
}
body.dark-mode .form-control {
    background: rgba(6, 10, 29, 0.4);
    color: var(--text);
}
.form-control::placeholder { color: #98a1c3; }
label { font-weight: 600; }
.auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    margin: 16px 0;
    position: relative;
}
.auth-divider:before,
.auth-divider:after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}
.auth-divider span { margin: 0 12px; }
.demo-note {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(24, 92, 232, 0.06);
    color: var(--muted);
}
.demo-note code {
    padding: 2px 6px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    color: var(--deep);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 2px 14px;
}
.topbar small { color: var(--muted); display: block; }
.topbar h2 { margin: 2px 0 0; font-size: 1.5rem; font-weight: 800; }
.topbar-actions { display: flex; gap: 10px; }
.circle-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow);
    font-size: 1.1rem;
    font-weight: 700;
}

.hero-balance {
    padding: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.mini-label {
    text-transform: uppercase;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    opacity: .8;
}
.hero-balance h3 {
    font-size: 2rem;
    margin: 10px 0 4px;
    font-weight: 800;
}
.hero-balance p { margin: 0; opacity: .9; }
.status-chip {
    padding: 10px 14px;
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.kpi-card {
    padding: 18px;
    min-height: 118px;
}
.kpi-card span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}
.kpi-card strong {
    display: block;
    margin-top: 14px;
    font-size: 1.08rem;
    font-weight: 800;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.section-head h4 { margin: 0; font-weight: 800; }
.section-head p { margin: 3px 0 0; color: var(--muted); }

.content-area .glass-card { padding: 18px; }
.movement-list { display: flex; flex-direction: column; gap: 12px; }
.movement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.62);
    border: 1px solid var(--line);
}
body.dark-mode .movement-item { background: rgba(255,255,255,0.03); }
.movement-item strong { display: block; font-size: 0.95rem; }
.movement-item small { color: var(--muted); display: block; margin-top: 2px; }
.amount-credit { color: var(--success); font-weight: 800; }
.amount-debit { color: var(--danger); font-weight: 800; }
.compact-list .movement-item { padding: 12px 14px; }

.virtual-card {
    min-height: 220px;
    padding: 24px;
    border-radius: 28px;
    box-shadow: 0 24px 52px rgba(38, 56, 244, 0.28);
}
.card-brand { font-weight: 800; opacity: 0.92; }
.card-number {
    margin: 42px 0 34px;
    font-size: 1.45rem;
    letter-spacing: 0.1em;
    font-weight: 700;
}
.card-meta {
    display: flex;
    justify-content: space-between;
}
.card-meta span {
    display: block;
    opacity: .75;
    text-transform: uppercase;
    font-size: 0.72rem;
}
.card-meta strong { font-size: 0.96rem; }
.action-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.action-item {
    min-height: 104px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(24, 92, 232, 0.04);
    color: var(--text);
    padding: 12px 10px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
}
.action-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(24, 92, 232, 0.12), rgba(111, 50, 245, 0.12));
    font-size: 1.2rem;
}
.cvv-box {
    min-width: 78px;
    min-height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, #185ce8 0%, #6f32f5 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 800;
}
.cvv-progress-wrap {
    height: 10px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(24, 92, 232, 0.1);
}
.cvv-progress { background: linear-gradient(135deg, #185ce8 0%, #6f32f5 100%); }

.bottom-nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 14px;
    width: calc(100% - 24px);
    max-width: 448px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    z-index: 1040;
}
.nav-item {
    min-height: 52px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}
.nav-item.active {
    background: linear-gradient(135deg, #185ce8 0%, #6f32f5 100%);
    color: #fff;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.setting-row:last-of-type { border-bottom: 0; }
.setting-row small { display: block; color: var(--muted); margin-top: 4px; }
.switch { position: relative; width: 56px; height: 32px; margin: 0; }
.switch input { display: none; }
.slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #c6d0f7;
    transition: .25s ease;
}
.slider:before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    top: 4px;
    left: 4px;
    transition: .25s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.switch input:checked + .slider {
    background: linear-gradient(135deg, #185ce8 0%, #6f32f5 100%);
}
.switch input:checked + .slider:before { transform: translateX(24px); }

.face-modal-content,
.modern-modal {
    border: 0;
    border-radius: 28px;
    background: var(--surface-strong);
    color: var(--text);
}
.face-logo { width: 148px; margin-bottom: 12px; }
.face-frame-wrap {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    margin: 16px auto 0;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(24, 92, 232, 0.18), rgba(111, 50, 245, 0.18));
    border: 4px solid rgba(24, 92, 232, 0.14);
}
#faceVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}
.face-ring {
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: inset 0 0 0 999px rgba(5, 11, 40, 0.10);
}
.scan-line {
    position: absolute;
    left: 8%;
    width: 84%;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.95) 50%, transparent 100%);
    box-shadow: 0 0 18px rgba(255,255,255,0.9);
    animation: scan 1.8s linear infinite;
}
@keyframes scan {
    0% { top: 24%; }
    50% { top: 70%; }
    100% { top: 24%; }
}
.face-status {
    margin-top: 16px;
    font-weight: 700;
    color: var(--primary);
}

.toast-area {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast-smile {
    min-width: 240px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(7, 19, 94, 0.92);
    color: #fff;
    box-shadow: var(--shadow);
}
.toast-smile.success { background: rgba(15, 187, 115, 0.94); }
.toast-smile.error { background: rgba(234, 77, 103, 0.94); }

@media (max-width: 390px) {
    .action-grid { grid-template-columns: 1fr; }
    .bottom-nav { grid-template-columns: repeat(3, 1fr); }
    .nav-item:nth-child(4), .nav-item:nth-child(5) { grid-column: span 1; }
}

#financeChart {
    display: block;
    width: 100% !important;
    height: 280px !important;
    min-height: 280px !important;
}

#cvvCode {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.25rem;
    margin-top: 12px;
    margin-bottom: 12px;
}
