@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Playfair+Display:wght@700&display=swap');

:root { 
    --primary: #B87C96; --primary-dark: #966178; --brand-dark: #2C2A2B;
    --logo-text: rgb(164, 125, 159); --bg-color: #Fdfbfb; --card-bg: #ffffff;
    --text-main: #4A4A4A; --border-color: #E8DDE1; --ai-color: #4285f4;
}

body { 
    font-family: 'Montserrat', sans-serif; background: var(--bg-color); margin: 0; padding: 20px; 
    display: flex; justify-content: center; color: var(--text-main); padding-bottom: 90px; 
}
.app-container { width: 100%; max-width: 600px; position: relative; }

.header { text-align: center; margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; position: relative; }
.header img.logo { width: 140px; height: auto; margin-bottom: 5px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(184, 124, 150, 0.15)); }
.header h1 { margin: 0; color: var(--logo-text); font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.7rem; text-transform: uppercase; letter-spacing: 3px; }

.app-version { position: absolute; left: 15px; top: 15px; font-size: 0.65rem; font-weight: 800; color: #d1d5db; letter-spacing: 1px; z-index: 10;}
.btn-settings { position: absolute; right: 0; top: 10px; background: transparent; border: none; font-size: 1.5rem; color: var(--primary-dark); cursor: pointer; transition: 0.2s; padding: 10px; border-radius: 50%; }
.btn-settings:active { transform: rotate(45deg) scale(0.9); background: var(--border-color); }

.sync-status { position: absolute; right: 45px; top: 15px; font-size: 1.1rem; color: var(--primary-dark); transition: 0.3s; display: flex; align-items: center; justify-content: center; opacity: 0.6;}
.spin-anim { animation: spin 1s linear infinite; opacity: 1; }

.card { background: var(--card-bg); padding: 25px 20px; border-radius: 20px; box-shadow: 0 15px 35px rgba(184, 124, 150, 0.1); border: 1px solid rgba(184, 124, 150, 0.05); position: relative; }

.bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 600px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); display: flex; justify-content: space-between; align-items: center; padding: 12px 10px; box-shadow: 0 -5px 20px rgba(184, 124, 150, 0.15); border-radius: 25px 25px 0 0; z-index: 1000; padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(184, 124, 150, 0.1); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #a1a1aa; text-decoration: none; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.2px; text-transform: uppercase; cursor: pointer; transition: all 0.3s ease; flex: 1; min-width: 0; }
.nav-item .icon { font-size: 1.35rem; margin-bottom: 4px; transition: all 0.3s ease; filter: grayscale(100%) opacity(0.5); }
.nav-item.active { color: var(--primary-dark); }
.nav-item.active .icon { filter: grayscale(0%) opacity(1); transform: translateY(-3px) scale(1.1); }

.tab-content { display: none; animation: fadeIn 0.3s ease; } .tab-content.active { display: block; }

.section-title { font-size: 0.85rem; color: var(--primary-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin: 25px 0 15px; border-left: 4px solid var(--primary); padding-left: 10px; display: flex; justify-content: space-between; align-items: center;}
.row { display: flex; gap: 15px; margin-bottom: 15px; } .col { flex: 1; }
@media (max-width: 480px) { .row { flex-direction: column; gap: 0; } }

.input-group { margin-bottom: 15px; }
label { font-weight: 600; font-size: 0.75rem; display: block; margin-bottom: 6px; color: var(--brand-dark); text-transform: uppercase; letter-spacing: 0.5px;}
input, select, textarea { width: 100%; padding: 14px; border: 2px solid var(--border-color); border-radius: 12px; font-family: 'Montserrat', sans-serif; font-size: 0.95rem; box-sizing: border-box; background: #fafafa; transition: 0.3s; font-weight: 600; color: var(--brand-dark); }
select { appearance: none; }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; background: #fff; box-shadow: 0 0 0 4px rgba(184, 124, 150, 0.15); }
input[type="file"] { background:#fff; border:2px dashed var(--border-color); padding:15px; text-align:center; cursor:pointer; color:#888; font-weight:600; font-size:0.8rem;}
input[readonly] { background: #E8DDE1; color: #7a4a5e; border-color: transparent; font-weight: 800;}

.resumo-box { background: linear-gradient(135deg, var(--primary-dark) 0%, #7a4a5e 100%); color: white; padding: 25px; border-radius: 16px; margin-top: 25px; box-shadow: 0 8px 25px rgba(150, 97, 120, 0.25);}
.resumo-linha { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 0.85rem; font-weight: 500; border-bottom: 1px dashed rgba(255,255,255,0.2); padding-bottom: 8px;}
.resumo-linha:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0;}
.custo-total { display: flex; justify-content: space-between; margin-top: 15px; font-size: 1.25rem; font-weight: 800; background: rgba(255,255,255,0.15); padding: 15px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.2);}

.btn-salvar { width: 100%; background: var(--primary); color: white; border: none; padding: 16px; border-radius: 12px; font-weight: 800; font-size: 1rem; cursor: pointer; text-transform: uppercase; letter-spacing: 1px; margin-top: 15px; transition: 0.2s; box-shadow: 0 5px 15px rgba(184, 124, 150, 0.35); font-family: 'Montserrat', sans-serif;}
.btn-salvar:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-salvar:active { transform: translateY(2px); box-shadow: none; }
.btn-salvar:disabled { background: #E8DDE1; color: #999; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-ai { background: var(--ai-color); box-shadow: 0 5px 15px rgba(66, 133, 244, 0.3); margin-top: 0; padding: 12px; font-size: 0.85rem;}
.btn-ai:hover { background: #3367d6; }

.rotulo-card { background: #fafafa; border: 1px solid var(--border-color); padding: 15px; border-radius: 14px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; transition: 0.2s;}
.rotulo-card:hover { border-color: var(--primary); background: #fff; box-shadow: 0 4px 15px rgba(184, 124, 150, 0.1);}
.rotulo-info h4 { margin: 0 0 5px; color: var(--brand-dark); font-size: 0.95rem; line-height: 1.3;}
.rotulo-info p { margin: 0; color: var(--text-muted); font-size: 0.75rem; }
.rotulo-badge { background: var(--primary-dark); color: white; padding: 5px 10px; border-radius: 8px; font-weight: 800; font-size: 0.8rem; letter-spacing: 1px;}
.custo-val { font-weight: 800; color: var(--primary-dark); font-size: 1.1rem; }
.list-img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; margin-right: 12px; background: #fdf5f7; border: 1px solid var(--border-color); flex-shrink: 0; transition: transform 0.2s; cursor: zoom-in;}
.list-img:active { transform: scale(0.9); }

.btn-acao { background: #fdf5f7; border: 1px solid #f3d8e2; font-size: 1.1rem; cursor: pointer; transition: 0.2s; border-radius: 10px; width: 35px; height: 35px; display: flex; justify-content: center; align-items: center;}
.btn-acao:active { transform: scale(0.9); }
.btn-acao:hover { background: var(--border-color); }

.status-badge { font-size: 0.65rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px; margin-left: 5px; vertical-align: middle;}
.status-pago { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.status-pendente { background: #fef08a; color: #b45309; border: 1px solid #fde047; }
.status-baixa { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.status-parcelado { background: #e0e7ff; color: #4f46e5; border: 1px solid #c7d2fe; }

.filtro-box { background: #fdfbfb; border: 1px solid var(--border-color); padding: 18px; border-radius: 16px; margin-bottom: 20px; box-shadow: inset 0 2px 10px rgba(0,0,0,0.02);}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.dash-card { background: #fff; border: 1px solid var(--border-color); padding: 18px; border-radius: 16px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.02); cursor: pointer; transition: 0.2s;}
.dash-card:active { transform: scale(0.95); }
.dash-card h3 { margin: 0 0 5px; font-size: 0.7rem; color: #888; text-transform: uppercase; letter-spacing: 0.5px; font-weight:800;}
.dash-card .valor { font-size: 1.6rem; font-weight: 900; color: var(--brand-dark);}
.dash-card.highlight { background: var(--primary-dark); color: white; border: none; box-shadow: 0 8px 20px rgba(150,97,120,0.3); grid-column: span 2;}
.dash-card.highlight h3 { color: #e8dde1; }
.dash-card.highlight .valor { color: white; font-size: 2.2rem;}

.dash-card.receita .valor { color: #2e7d32; }
.dash-card.receber .valor { color: #b45309; }
.dash-card.patrimonio { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); color: white; border: none; box-shadow: 0 8px 20px rgba(30, 58, 138, 0.3); grid-column: span 2; }
.dash-card.patrimonio h3 { color: #bfdbfe; }
.dash-card.patrimonio .valor { color: white; font-size: 2.5rem; }

.ranking-list { list-style: none; padding: 0; margin: 0; text-align: left; }
.ranking-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border-color); font-size: 0.85rem; }
.ranking-item:last-child { border-bottom: none; padding-bottom: 0;}
.ranking-pos { font-weight: 900; color: var(--primary-dark); margin-right: 8px; font-size: 1rem; width: 20px; display:inline-block;}
.ranking-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--brand-dark); font-weight: 600;}
.ranking-val { font-weight: 800; color: #2e7d32; margin-left: 10px;}

.chart-container { background: #fff; border: 1px solid var(--border-color); border-radius: 16px; padding: 15px; margin-bottom: 20px; box-shadow: 0 5px 15px rgba(184, 124, 150, 0.05);}
.dash-lucro-card { background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%); color: white; padding: 30px; border-radius: 20px; text-align: center; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(46, 125, 50, 0.3); transition: background 0.3s ease;}
.dash-lucro-card h3 { margin: 0 0 5px; font-size: 0.85rem; text-transform: uppercase; opacity: 0.9; letter-spacing: 1px; font-weight: 700;}
.dash-lucro-card p { margin: 0; font-size: 2.5rem; font-weight: 800; letter-spacing: -1px;}
.dash-lucro-card.negativo { background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%); box-shadow: 0 10px 30px rgba(198, 40, 40, 0.3); }
.dash-socios-linha { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border-color); font-size: 0.95rem; font-weight: 600;}
.dash-socios-linha:last-child { border-bottom: none; padding-bottom: 0; }

.modal-overlay-alert { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 10000; backdrop-filter: blur(3px); animation: fadeIn 0.2s ease;}
.modal-box-alert { background: #fff; width: 90%; max-width: 380px; border-radius: 24px; padding: 30px 20px 20px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.3); animation: popIn 0.3s ease-out; position: relative; max-height: 90vh; overflow-y: auto;}
.modal-icon-alert { font-size: 3.5rem; margin-bottom: 10px; display: inline-block;}
.modal-title-alert { font-size: 1.3rem; font-weight: 900; color: var(--brand-dark); margin: 0 0 10px; text-transform: uppercase;}
.modal-text-alert { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 25px; line-height: 1.4; font-weight: 600;}
.btn-modal-ok { color: white; border: none; padding: 14px; border-radius: 12px; width: 100%; cursor: pointer; font-weight: 800; font-size: 0.95rem; text-transform: uppercase; font-family: 'Montserrat', sans-serif; transition: transform 0.1s;}
.btn-modal-ok:active { transform: translateY(4px); box-shadow: 0 0 0 transparent !important; }
.btn-modal-cancel { flex: 1; background: #fdf5f7; color: var(--primary-dark); border: 1px solid #f3d8e2; padding: 14px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 0.9rem; text-transform: uppercase; font-family: 'Montserrat', sans-serif;}
.btn-modal-confirm { flex: 1; color: white; border: none; padding: 14px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 0.9rem; text-transform: uppercase; font-family: 'Montserrat', sans-serif; transition: 0.2s;}
.btn-modal-confirm:active { transform: translateY(4px); box-shadow: 0 0 0 transparent !important; }

.password-wrapper { position: relative; display: flex; align-items: center; }
.password-wrapper input { width: 100%; padding-right: 45px; }
.toggle-eye { position: absolute; right: 10px; background: transparent; border: none; font-size: 1.3rem; cursor: pointer; color: var(--primary-dark); padding: 5px; transition: 0.2s; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.toggle-eye:active { transform: scale(0.8); }

.loading-overlay { position: absolute; top:0; left:0; width: 100%; height: 100%; background: rgba(253, 251, 251, 0.95); z-index: 9999; display: none; flex-direction: column; justify-content: center; align-items: center; border-radius: 20px; backdrop-filter: blur(5px); }
.spinner { border: 5px solid #f3d8e2; border-top: 5px solid var(--primary-dark); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 20px;}

.checkbox-recibo { display: flex; align-items: center; background: #fff; border: 1px solid var(--border-color); padding: 12px; border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: 0.2s; }
.checkbox-recibo:hover { border-color: var(--primary); background: #fdf5f7; }
.checkbox-recibo input[type="checkbox"] { appearance: auto !important; -webkit-appearance: auto !important; width: 20px; height: 20px; margin: 0 15px 0 0; cursor: pointer; accent-color: var(--primary-dark); flex-shrink: 0; box-shadow: none; border-radius: 4px; padding: 0; }
.chk-info { display: flex; flex-direction: column; flex: 1;}
.chk-title { font-weight: 700; font-size: 0.85rem; color: var(--brand-dark); line-height: 1.2;}
.chk-desc { font-size: 0.7rem; color: #888; margin-top: 3px;}
.chk-val { font-weight: 800; color: var(--primary-dark); font-size: 0.9rem;}

.ai-choice-container { display: flex; gap: 10px; justify-content: center; margin-top: 15px; }
.ai-img-box { flex: 1; background: #f0f7ff; padding: 10px; border-radius: 12px; border: 2px dashed var(--border-color); cursor: pointer; transition: 0.2s; }
.ai-img-box.selected { border-color: var(--ai-color); background: #e6f0fa; box-shadow: 0 4px 10px rgba(66, 133, 244, 0.2); }
.ai-img-box img { width: 100%; height: 100px; object-fit: cover; border-radius: 8px; margin-bottom: 5px; }
.ai-img-box p { margin: 0; font-size: 0.7rem; font-weight: bold; color: var(--brand-dark); }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.sub-nav-container { display: flex; background: #E8DDE1; border-radius: 12px; margin-bottom: 20px; padding: 4px; overflow-x: auto; gap: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none;}
.sub-nav-container::-webkit-scrollbar { display: none; }
.sub-nav-btn { flex: 0 0 auto; border: none; background: transparent; font-weight: 800; color: #7a4a5e; padding: 10px 16px; font-size: 0.8rem; transition: 0.2s; opacity: 0.7; font-family: 'Montserrat', sans-serif; white-space: nowrap; cursor: pointer; border-radius: 10px;}
.sub-nav-btn.active { background: #fff; color: var(--primary-dark); box-shadow: 0 2px 8px rgba(0,0,0,0.1); opacity: 1; }

.badge-status { font-size: 0.65rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; letter-spacing: 0.5px;}
.b-atrasado { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.b-hoje { background: #fef08a; color: #b45309; border: 1px solid #fde047; }
.b-futuro { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.b-ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.status-presente { background: #f3e8ff; color: #7c3aed; border: 1px solid #ddd6fe; }
