:root { --bg-body: #000000; --bg-surface: #121212; --bg-card: #1C1C1E; --color-income: #34C759; --color-expense: #AF52DE; --color-alert: #FF9F0A; --color-danger: #FF453A; --color-blue: #0A84FF; --color-transfer: #FFD60A; --text-white: #FFFFFF; --text-gray: #8E8E93; --radius: 16px; }
body.light-mode { --bg-body: #F4F5F7; --bg-surface: #FFFFFF; --bg-card: #FFFFFF; --text-white: #111111; --text-gray: #555555; --color-income: #28A745; --color-expense: #6F42C1; --color-danger: #DC3545; }
* { margin: 0; padding: 0; box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background-color: var(--bg-body); color: var(--text-white); display: flex; height: 100vh; overflow: hidden; color-scheme: dark; transition: background-color 0.3s, color 0.3s; }

body.light-mode .sidebar { border-right: 1px solid #E5E5E5; }
body.light-mode .chart-panel, body.light-mode .kpi-card { border: 1px solid #E5E5E5; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
body.light-mode .data-table th { border-bottom: 1px solid #E5E5E5; }
body.light-mode .data-table td { border-bottom: 1px solid #F0F0F0; }
body.light-mode .form-group input, body.light-mode .form-group select { background: #F8F9FA; border: 1px solid #CCC; color: #111; }
body.light-mode .radio-group { background: #F8F9FA; border: 1px solid #CCC; }
body.light-mode .radio-group label { color: #111; }
body.light-mode .type-toggle { border: 1px solid #CCC; }
body.light-mode .type-toggle button { color: #666; }
body.light-mode .cc-ui { background: linear-gradient(135deg, #f0f0f5 0%, #e0e0e5 100%); border: 1px solid #CCC; }
body.light-mode .cc-name { color: #111; }

#tela-login { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%); z-index: 99999; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.login-card { background: rgba(28, 28, 30, 0.4); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); padding: 40px; border-radius: 24px; border: 1px solid rgba(255, 255, 255, 0.08); text-align: center; width: 90%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
#logo-premium { max-width: 250px; margin-bottom: 5px; filter: drop-shadow(0 0 15px rgba(255, 69, 58, 0.3)); }
.login-subtitle { color: var(--text-gray); font-size: 0.85rem; margin-bottom: 30px; letter-spacing: 0.5px; }
.login-card input { width: 100%; padding: 15px; margin-bottom: 15px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.05); color: white; border-radius: 12px; font-size: 1rem; text-align: center; box-sizing: border-box; transition: border 0.3s; }
.login-card input:focus { border-color: var(--color-income); outline: none; }
.btn-destravar { width: 100%; padding: 15px; background: var(--color-income); color: black; border: none; border-radius: 12px; font-weight: 800; cursor: pointer; font-size: 1rem; transition: 0.3s; margin-bottom: 10px; }
.btn-destravar:hover { transform: scale(1.02); opacity: 0.9; }
.btn-solicitar { width: 100%; background: transparent; border: none; color: var(--text-gray); cursor: pointer; font-size: 0.85rem; padding: 10px; transition: 0.3s; }
.btn-solicitar:hover { color: var(--text-white); }
.login-error { color: var(--color-alert); margin-top: 15px; font-size: 0.85rem; display: none; }

.sidebar { width: 260px; background-color: var(--bg-surface); border-right: 1px solid #2C2C2E; padding: 24px; display: flex; flex-direction: column; gap: 30px; z-index: 10; transition: background-color 0.3s; }
.brand { font-size: 1.4rem; font-weight: 800; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; }
.brand-icon { background: linear-gradient(135deg, var(--color-income), var(--color-expense)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.nav-menu { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; -ms-overflow-style: none; scrollbar-width: none; }
.nav-menu::-webkit-scrollbar { display: none; }
.nav-link { padding: 12px 16px; border-radius: 12px; color: var(--text-gray); text-decoration: none; font-weight: 500; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: 0.2s; }
.nav-link:hover { background-color: #2C2C2E; color: var(--text-white); }
.nav-link.active { background-color: rgba(52, 199, 89, 0.1); color: var(--color-income); border-left: 3px solid var(--color-income); }

.main-content { flex: 1; padding: 30px 40px; overflow-y: auto; position: relative; }
.view-section { display: none; flex-direction: column; gap: 25px; animation: fadeIn 0.3s ease; }
.view-section.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.top-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.user-greeting h1 { font-size: 1.8rem; font-weight: 700; }
.user-greeting p { color: var(--text-gray); font-size: 0.9rem; margin-top: 4px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.notification-bell { font-size: 1.4rem; cursor: pointer; position: relative; transition: 0.2s; padding: 5px; }
.notification-bell:hover { transform: scale(1.1); }
.badge { position: absolute; top: -2px; right: -5px; background: var(--color-danger); color: white; font-size: 0.6rem; font-weight: bold; padding: 2px 6px; border-radius: 10px; display: none; }

.btn-primary { background-color: var(--color-income); color: #000; border: none; padding: 12px 24px; border-radius: 8px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; }
.btn-primary:hover { opacity: 0.9; transform: scale(0.98); }
.btn-excel { background-color: #1D6F42; color: white; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; font-size: 0.85rem; }
.btn-excel:hover { background-color: #155431; }
.btn-action { background: none; border: none; font-size: 1.1rem; cursor: pointer; opacity: 0.6; transition: 0.2s; margin-left: 10px; }
.btn-action:hover { opacity: 1; transform: scale(1.2); }
.btn-check { opacity: 1; filter: grayscale(0.8); }
.btn-check:hover { filter: grayscale(0); }
.btn-extrato { font-size: 0.8rem; background: #2C2C2E; color: var(--text-white); border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: bold; transition: 0.2s; }
.btn-extrato:hover { background: var(--color-blue); }

.tag { padding: 4px 10px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; border: 1px solid currentColor; }
.type-badge { font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; border: 1px solid #444; color: #AAA; font-weight: 500; }
.type-card-tag { border-color: var(--color-expense); color: var(--color-expense); }
.type-fixa-tag { border-color: var(--color-blue); color: var(--color-blue); }
.type-transf-tag { border-color: var(--color-transfer); color: var(--color-transfer); }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; }
.kpi-card { background-color: var(--bg-card); border-radius: var(--radius); padding: 20px; border: 1px solid #2C2C2E; position: relative; transition: 0.3s; }
.kpi-card.highlight { background: linear-gradient(145deg, #1C1C1E 0%, #152618 100%); border: 1px solid rgba(52, 199, 89, 0.3); box-shadow: 0 4px 20px rgba(52, 199, 89, 0.05); }
.kpi-title { color: var(--text-gray); font-size: 0.8rem; margin-bottom: 8px; font-weight: 600; display: flex; justify-content: space-between; text-transform: uppercase; }

.kpi-value { font-size: 1.5rem; font-weight: 700; white-space: nowrap; }

.var-badge { font-size: 0.7rem; font-weight: bold; padding: 2px 6px; border-radius: 4px; margin-top: 5px; display: inline-block; }

.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.chart-panel { background-color: var(--bg-card); border-radius: var(--radius); padding: 24px; border: 1px solid #2C2C2E; transition: 0.3s; }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-title { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th { color: var(--text-gray); font-size: 0.8rem; text-transform: uppercase; padding-bottom: 12px; border-bottom: 1px solid #2C2C2E; cursor: pointer; user-select: none; }
.data-table td { padding: 12px 0; border-bottom: 1px solid #2C2C2E; font-size: 0.95rem; }

.form-group { margin-bottom: 15px; display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 0.85rem; color: var(--text-gray); }
.form-group input, .form-group select { background-color: var(--bg-surface); border: 1px solid #333; color: white; padding: 12px; border-radius: 8px; font-size: 1rem; transition: 0.3s; max-width: 100%; box-sizing: border-box; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; min-width: 0; }

.dropdown-check-list { display: inline-block; position: relative; width: 100%; cursor: pointer; }
.dropdown-check-list .anchor { width: 100%; background: var(--bg-surface); border: 1px solid #333; padding: 12px; border-radius: 8px; color: white; display: flex; justify-content: space-between; align-items: center; font-size: 1rem; }
.dropdown-check-list .items { display: none; position: absolute; background: #1a1a1a; border: 1px solid var(--color-income); width: 100%; max-height: 250px; overflow-y: auto; z-index: 9999; border-radius: 8px; margin-top: 5px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.dropdown-check-list.visible .items { display: block; }
.dropdown-check-list .items label { display: flex; align-items: center; gap: 10px; padding: 8px; font-size: 0.95rem; cursor: pointer; transition: 0.2s; border-radius: 6px; }
.dropdown-check-list .items label:hover { background: #2c2c2e; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background-color: var(--bg-card); border: 1px solid #2C2C2E; width: 500px; border-radius: var(--radius); padding: 30px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); max-height: 90vh; overflow-y: auto; transition: 0.3s; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 20px; align-items: center; }
.close-btn { background: none; border: none; color: var(--text-gray); font-size: 1.5rem; cursor: pointer; }
.btn-save { width: 100%; background-color: var(--color-income); color: black; border: none; padding: 14px; border-radius: 8px; font-weight: bold; font-size: 1rem; margin-top: 10px; cursor: pointer; transition: 0.2s; }
.btn-save:hover { opacity: 0.9; }

.modal-confirm-content { background-color: var(--bg-card); border: 1px solid #2C2C2E; width: 400px; border-radius: var(--radius); padding: 30px; text-align: center; }
.btn-cancel { background-color: var(--bg-surface); color: var(--text-white); border: 1px solid #333; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: bold; flex: 1; transition: 0.2s; }
.btn-danger { background-color: rgba(255, 69, 58, 0.1); color: var(--color-danger); border: 1px solid var(--color-danger); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: bold; flex: 1; transition: 0.2s; }
.btn-cancel:hover, .btn-danger:hover { opacity: 0.8; }

.alert-group-title { font-size: 0.8rem; color: var(--text-gray); margin: 20px 0 10px 0; text-transform: uppercase; font-weight: bold; border-bottom: 1px solid #333; padding-bottom: 5px; }
.alert-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--bg-surface); border-radius: 8px; margin-bottom: 8px; border: 1px solid #2C2C2E; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; margin-top: 20px; }
.data-card { background: var(--bg-surface); border: 1px solid #2C2C2E; padding: 18px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.data-color-dot { width: 12px; height: 12px; border-radius: 50%; }
.data-form { display: flex; gap: 15px; background: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid #2C2C2E; align-items: flex-end; }

.conta-valor { font-weight: 700; color: var(--text-white); font-size: 1.2rem; margin-top: 4px; }
.conta-nome { color: var(--text-gray); font-size: 0.85rem; font-weight: bold; text-transform: uppercase; }
.extrato-header { background: linear-gradient(145deg, #1C1C1E 0%, #121212 100%); padding: 25px; border-radius: 12px; border: 1px solid #2C2C2E; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
.month-selector { display: flex; align-items: center; gap: 15px; background: var(--bg-card); padding: 10px 20px; border-radius: 12px; border: 1px solid #2C2C2E; }
.box-resumo-mes { background: var(--bg-card); padding: 12px 20px; border-radius: 12px; border: 1px solid #2C2C2E; text-align: center; flex: 1; }

.cc-ui { background: linear-gradient(135deg, #1f1f24 0%, #101014 100%); border-radius: 16px; padding: 25px; position: relative; border: 1px solid #333; overflow: hidden; min-height: 180px; display: flex; flex-direction: column; justify-content: space-between; }
.cc-chip { width: 35px; height: 25px; background: linear-gradient(135deg, #e6c27a 0%, #d4af37 100%); border-radius: 5px; margin-bottom: 15px; }
.cc-name { font-size: 1.2rem; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; }
.cc-limit-bar { height: 6px; background: #333; border-radius: 3px; margin-top: 15px; overflow: hidden; }
.cc-limit-fill { height: 100%; background: var(--color-expense); border-radius: 3px; width: 0%; transition: width 0.5s ease; }

.dash-fatura-item { display: flex; justify-content: space-between; padding: 12px; background: var(--bg-surface); border-radius: 8px; border-left: 3px solid var(--color-expense); margin-bottom: 10px; }
.top-despesa-item { display: flex; justify-content: space-between; padding: 10px; background: var(--bg-surface); border-radius: 8px; font-size: 0.85rem; margin-bottom: 8px; border-left: 3px solid var(--color-expense); }
.painel-totais-quarentena { display: flex; gap: 15px; margin-top: 15px; padding-top: 15px; border-top: 1px solid #333; }
.painel-totais-quarentena > div { flex: 1; background: #121212; padding: 12px; border-radius: 8px; text-align: center; border: 1px solid #2C2C2E; }
.progress-bar-bg { background: #333; height: 8px; border-radius: 4px; width: 100%; overflow: hidden; margin-top: 5px; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.backup-alert { background: var(--color-danger); color: white; padding: 12px; text-align: center; cursor: pointer; font-weight: bold; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 4px 15px rgba(255, 69, 58, 0.3); animation: pulse 2s infinite; display: none; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.01); } 100% { transform: scale(1); } }

.type-toggle { display: flex; background: var(--bg-surface); border-radius: 8px; overflow: hidden; border: 1px solid #333; margin-bottom: 15px; }
.type-toggle button { flex: 1; padding: 12px; background: transparent; border: none; color: var(--text-gray); font-weight: bold; cursor: pointer; transition: 0.3s; }
.type-toggle button.active-receita { background: var(--color-income); color: black; }
.type-toggle button.active-despesa { background: var(--color-danger); color: white; }
.type-toggle button.active-transferencia { background: var(--color-transfer); color: black; }
.radio-group { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; background: var(--bg-surface); padding: 15px; border-radius: 8px; border: 1px solid #333; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text-white); cursor: pointer; }
.radio-group input[type="radio"] { transform: scale(1.2); accent-color: var(--color-income); }

@media (max-width: 800px) {
    body { flex-direction: column; height: 100vh; overflow-x: hidden; }
    .sidebar { position: fixed; bottom: 0; left: 0; width: 100% !important; height: 75px !important; display: flex; flex-direction: row; padding: 0 !important; z-index: 999; background-color: var(--bg-surface); border-top: 1px solid #333; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sidebar .brand, .sidebar > div:last-child { display: none !important; }
    .nav-menu { flex-direction: row !important; width: 100% !important; justify-content: space-between !important; display: flex; }
    .nav-link { flex: 1; flex-direction: column !important; align-items: center !important; justify-content: center !important; padding: 4px 2px !important; font-size: 0.6rem !important; white-space: nowrap; margin: 0 !important; border: none !important; }
    .nav-link span { font-size: 1.1rem !important; margin-bottom: 2px; }
    .top-header { flex-direction: column !important; align-items: center !important; text-align: center; gap: 5px; }
    .month-selector { width: 100% !important; justify-content: center !important; display: flex !important; margin-top: 10px; }
    .main-content { padding: 10px 5px !important; padding-bottom: 90px !important; width: 100%; box-sizing: border-box; overflow-y: auto !important; -webkit-overflow-scrolling: touch; flex: 1; }
    .charts-grid, .content-grid, .grid-cards { grid-template-columns: 1fr !important; gap: 15px !important; display: grid !important; }
    .chart-panel { overflow-x: auto !important; width: 100%; box-sizing: border-box; }
    .data-table { min-width: 500px; }
    .modal-content { width: 95% !important; max-width: 400px !important; padding: 15px !important; box-sizing: border-box; }
    .form-row { flex-direction: column !important; gap: 5px !important; }
    .form-group { width: 100% !important; }
    .radio-group { grid-template-columns: 1fr 1fr; }
}