:root {
    --bg-outer: #060911;
    --bg-app: #0f172a;
    --bg-card: #1e293b;
    --bg-card-soft: #162032;
    --bg-input: #0b1120;
    --border-subtle: rgba(148, 163, 184, 0.14);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --green: #10b981;
    --green-dark: #059669;
    --blue: #3b82f6;
    --cyan: #06b6d4;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --red: #ef4444;
    --purple: #8b5cf6;
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-outer);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.45;
    display: flex;
    justify-content: center;
}

/* MOLDURA DE APLICATIVO MOBILE (Centralizada no PC, 100% nativa no celular) */
.mobile-shell {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background-color: var(--bg-app);
    position: relative;
    padding-bottom: 92px; /* Espaço para a barra inferior fixa */
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.75);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    transition: max-width 0.3s ease;
}

/* Opção caso o usuário queira expandir em telas grandes */
.mobile-shell.expanded-mode {
    max-width: 960px;
}

@media (max-width: 520px) {
    .mobile-shell {
        max-width: 100%;
        border: none;
    }
}

/* TOPO DO APP (STICKY) */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    padding: 0.85rem 1rem 0.7rem;
    border-bottom: 1px solid var(--border-subtle);
}

.topbar-row1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-logo {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.app-title {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

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

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    height: 34px;
    padding: 0 0.65rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.icon-btn:active {
    transform: scale(0.97);
}

/* SELETOR DE PERFIL ESTILO iOS SEGMENTED CONTROL */
.profile-pills {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: var(--bg-input);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 0.55rem;
}

.profile-pill {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.48rem 0.3rem;
    border-radius: 9px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: 0.2s;
}

.profile-pill.active {
    background: var(--bg-card);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* SELETOR DE MÊS COMPACTO E CLARO */
.month-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card-soft);
    border-radius: 10px;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-subtle);
}

.month-arrow {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 32px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.month-arrow:hover {
    background: rgba(255, 255, 255, 0.08);
}

.month-input-clean {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.84rem;
    text-align: center;
    outline: none;
    color-scheme: dark;
    cursor: pointer;
}

/* CONTEÚDO INTERNO DO APP */
.app-body {
    padding: 0.9rem 1rem;
}

/* CARTÃO PRINCIPAL DE SALDO (ESTILO NUBANK / CARTEIRA DIGITAL) */
.hero-wallet-card {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-xl);
    padding: 1.15rem;
    margin-bottom: 1rem;
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.5);
}

.wallet-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.85rem;
}

.wallet-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.wallet-big-balance {
    font-size: 1.85rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-top: 0.15rem;
}

.wallet-sub-pill {
    display: inline-block;
    margin-top: 0.3rem;
    font-size: 0.73rem;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.55rem;
    border-radius: 99px;
}

.wallet-mini-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border-subtle);
}

.wallet-mini-box {
    background: rgba(11, 17, 32, 0.55);
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
}

.wallet-mini-box span {
    display: block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
}

.wallet-mini-box strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-top: 2px;
}

/* BARRA DE FÔLEGO FINANCEIRO (RUNWAY SIMPLIFICADO) */
.folego-banner {
    margin-top: 0.8rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* CARD DE ANOTAÇÃO RÁPIDA DE 1 TOQUE (PENSADO PARA O POLEGAR NO CELULAR) */
.quick-tap-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
}

.quick-tap-title {
    font-size: 0.86rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Chips horizontais deslizáveis no celular */
.chip-scroll {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 0.55rem;
    scrollbar-width: none;
}
.chip-scroll::-webkit-scrollbar {
    display: none;
}

.Preset-chip {
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 0.45rem 0.75rem;
    border-radius: 99px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: 0.15s;
}

.Preset-chip.active {
    background: rgba(16, 185, 129, 0.18);
    border-color: var(--green);
    color: #fff;
}

.quick-inputs-row {
    display: grid;
    grid-template-columns: 1.35fr 0.9fr;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
}

.app-input, .app-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
}

.app-input:focus, .app-select:focus {
    border-color: var(--green);
}

.btn-block-green {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    padding: 0.78rem 1rem;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-block-green:active {
    transform: scale(0.98);
}

/* SEÇÕES E CARTÕES DO APP */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.05rem;
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.section-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    margin-bottom: 0.8rem;
}

/* LISTA SIMPLES DE "PARA ONDE VAI O DINHEIRO" */
.nature-row-card {
    background: var(--bg-card-soft);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 0.85rem;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: 0.15s;
}

.nature-row-card:active {
    transform: scale(0.99);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 99px;
    overflow: hidden;
    margin: 0.45rem 0;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.35s ease;
}

/* ALERTAS FÁCEIS DE ENTENDER */
.easy-alert {
    padding: 0.85rem;
    border-radius: 14px;
    margin-bottom: 0.6rem;
    border-left: 4px solid var(--green);
    background: var(--bg-card-soft);
    font-size: 0.82rem;
}
.easy-alert.critico { border-left-color: var(--red); background: rgba(239, 68, 68, 0.1); }
.easy-alert.alerta { border-left-color: var(--amber); background: rgba(245, 158, 11, 0.1); }
.easy-alert.info { border-left-color: var(--blue); background: rgba(59, 130, 246, 0.1); }

/* EXTRATO EM CARTÕES DE APLICATIVO (SEM TABELAS ESPREMIDAS!) */
.tx-mobile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 0.85rem;
    background: var(--bg-card-soft);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    margin-bottom: 0.55rem;
}

.tx-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.tx-circle-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.tx-info {
    min-width: 0;
}

.tx-title {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tx-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 2px;
}

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

.tx-amount {
    font-weight: 800;
    font-size: 0.94rem;
}

.mini-tag {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: 6px;
    font-size: 0.67rem;
    font-weight: 700;
}
.tag-pf { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.tag-pj { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tag-pago { background: rgba(16, 185, 129, 0.16); color: #34d399; cursor: pointer; }
.tag-pendente { background: rgba(245, 158, 11, 0.18); color: #fbbf24; cursor: pointer; }

/* BARRA DE NAVEGAÇÃO INFERIOR FIXA (ESTILO APP iOS / ANDROID) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    padding: 0.4rem 0.25rem 0.55rem;
    z-index: 100;
    transition: max-width 0.3s ease;
}

.mobile-shell.expanded-mode .bottom-nav {
    max-width: 960px;
}

.bnav-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    padding: 0.35rem 0.1rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.63rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: 0.15s;
}

.bnav-btn i {
    font-size: 1.12rem;
}

.bnav-btn.active {
    color: var(--green);
    background: rgba(16, 185, 129, 0.1);
}

/* ABAS (TELAS DO APP) */
.tab-pane {
    display: none;
    animation: slideUp 0.2s ease;
}
.tab-pane.active {
    display: block;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* BOTTOM SHEET MODAL (MODAL QUE SOBE DE BAIXO NO CELULAR) */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
}

.modal-backdrop.open {
    display: flex;
}

.modal-sheet {
    background: var(--bg-card);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    padding: 1.25rem 1.15rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    animation: sheetRise 0.25s ease;
}

@keyframes sheetRise {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.sheet-handle {
    width: 42px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 99px;
    margin: 0 auto 0.9rem;
}

.chart-box {
    position: relative;
    height: 220px;
    width: 100%;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--green);
    height: 6px;
    cursor: pointer;
}

/* Toast no topo para celular */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: 92%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    pointer-events: none;
}

.toast {
    background: #064e3b;
    border: 1px solid var(--green);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    font-size: 0.84rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

/* ============================================================================
   BOTÃO "POR QUÊ? ▾" E CAIXA DE EXPLICAÇÃO EXPANSÍVEL (ZERO POLUIÇÃO VISUAL)
   ============================================================================ */
.why-toggle-btn {
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    transition: 0.15s;
}
.why-toggle-btn:hover {
    border-color: var(--green);
    color: var(--green);
}
.why-dropdown-box {
    display: none;
    margin-top: 0.45rem;
    padding: 0.55rem 0.65rem;
    border-radius: 9px;
    background: var(--bg-card-soft);
    border: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-main);
    line-height: 1.45;
}
.why-dropdown-box.open {
    display: block;
}

/* ============================================================================
   TEMA CLARO (LIGHT THEME) COMPLETO E LIMPO
   ============================================================================ */
body.light-theme {
    --bg-outer: #e2e8f0;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-soft: #f1f5f9;
    --bg-input: #ffffff;
    --border-subtle: rgba(15, 23, 42, 0.12);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
}

body.light-theme .mobile-shell {
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.12);
    border-left: 1px solid rgba(15, 23, 42, 0.08);
    border-right: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .app-topbar,
body.light-theme .bottom-nav {
    background: rgba(255, 255, 255, 0.94);
    border-color: rgba(15, 23, 42, 0.1);
}

body.light-theme .profile-pill.active,
body.light-theme .chart-mode-btn.active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

body.light-theme .month-input-clean {
    color-scheme: light;
}

body.light-theme .hero-wallet-card {
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 8px 20px -6px rgba(15, 23, 42, 0.08);
}

body.light-theme .wallet-mini-box {
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

body.light-theme .section-card,
body.light-theme .quick-tap-card {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

body.light-theme #jeniPromptCard {
    background: linear-gradient(145deg, rgba(16, 185, 129, 0.1), #ffffff) !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06) !important;
}

body.light-theme #aiPreviewCard {
    background: #f8fafc !important;
    color: #0f172a !important;
}

body.light-theme #openFinanceBarCard {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), #ffffff) !important;
}

body.light-theme .btn-toggle-data {
    background: #f1f5f9;
    color: #1e293b;
}

body.light-theme .tx-amount {
    color: #0f172a;
}

body.light-theme .easy-alert.critico { background: rgba(239, 68, 68, 0.08); }
body.light-theme .easy-alert.alerta { background: rgba(245, 158, 11, 0.1); }
body.light-theme .easy-alert.info { background: rgba(59, 130, 246, 0.08); }

