/* ============================================================
   LIMIARE FINANCE — FASE A: FUNDAÇÃO PREMIUM
   Identidade: Azul Noite #1A1A2E | Areia #F5F0E8 | Dourado #C8A96E
   Tipografia: Inter (Google Fonts) + Georgia (valores/títulos)
   ============================================================ */

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #F5F0E8;
  color: #1A1A2E;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== HEADER ===== */
header {
  background: #1A1A2E;
  color: #FFFFFF;
  padding: 22px 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
header .btn-menu {
  background: none;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  color: #fff;
  font-size: 18px;
  padding: 8px 12px;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}
header .btn-menu:active {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
}
header .saldo-wrap { flex: 1; cursor: pointer; user-select: none; }
header .saldo-label {
  font-size: 11px;
  text-transform: uppercase;
  color: #C8A96E;
  letter-spacing: 0.1em;
  font-weight: 500;
}
header .saldo-valor {
  font-size: 32px;
  font-weight: 700;
  font-family: Georgia, serif;
  margin-top: 6px;
  letter-spacing: -0.02em;
}
.saldo-icone-calendario { font-size: 11px; opacity: 0.6; margin-left: 4px; }
.saldo-projetado-tag {
  display: inline-block; font-size: 10px; background: #C8A96E; color: #1A1A2E;
  padding: 2px 9px; border-radius: 10px; margin-left: 6px; font-weight: 700; vertical-align: middle;
}
.saldo-popover {
  display: none;
  position: absolute; top: calc(100% + 8px); left: 16px; right: 16px;
  background: #fff; border-radius: 14px; padding: 16px;
  box-shadow: 0 12px 40px rgba(26,26,46,0.2); z-index: 250;
}
.saldo-popover.show { display: block; }
.saldo-popover label { color: #7A7267; margin-top: 0; }

/* ===== NOVA BARRA DE NAVEGAÇÃO (BOTTOM NAV) ===== */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-around;
  background: rgba(26,26,46,0.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255,255,255,0.06);
}
.bottom-nav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; color: #9B9585; padding: 6px 4px;
  font-size: 10px; font-family: 'Inter', sans-serif;
  transition: color 0.2s; cursor: pointer;
}
.bottom-nav .nav-item .icone-tab { font-size: 22px; margin-bottom: 2px; }
.bottom-nav .nav-item.active { color: #C8A96E; font-weight: 700; }
.bottom-nav .nav-fab-spacer { width: 64px; } /* Espaço central para o FAB */

/* ===== NOVO FAB INTELIGENTE (+) ===== */
.fab-principal {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(30px + env(safe-area-inset-bottom, 0px)); z-index: 110;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #D4B87A 0%, #C8A96E 50%, #B89A5E 100%);
  color: #1A1A2E; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(200,169,110,0.4), 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.15s ease;
}
.fab-principal span {
  font-size: 32px; font-weight: 300; line-height: 1; margin-top: -2px;
}
.fab-principal:active {
  transform: translateX(-50%) scale(0.92);
  box-shadow: 0 4px 12px rgba(200,169,110,0.3);
}

/* ===== BOTTOM SHEETS (BASE) ===== */
.bottom-sheet-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,15,25,0.6);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 300; opacity: 0; transition: opacity 0.3s ease;
}
.bottom-sheet-overlay.show { display: block; opacity: 1; }
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #1A1A2E; color: #fff; z-index: 301;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.2);
}
.bottom-sheet.show { transform: translateY(0); }
.bottom-sheet-handle {
  width: 40px; height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; margin: 0 auto 20px;
}

/* ===== LAYOUT PRINCIPAL ===== */
main { padding: 18px; padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

/* ===== TELAS (com animação de entrada) ===== */
.screen { display: none; }
.screen.active {
  display: block;
  animation: fadeInUp 0.3s ease-out;
}

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

/* ===== TIPO TOGGLE (Entrada/Saída) ===== */
.tipo-toggle { display: flex; gap: 8px; margin-bottom: 18px; }
.tipo-toggle button {
  flex: 1; padding: 14px; border-radius: 12px;
  border: 1.5px solid #E8DFD0; background: #fff;
  font-weight: 600; font-size: 14px; color: #7A7267;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}
.tipo-toggle button.sel-entrada { background: #E4EEE7; border-color: #2F6F4E; color: #2F6F4E; }
.tipo-toggle button.sel-saida { background: #F1E5E0; border-color: #8B4B3B; color: #8B4B3B; }

/* ===== LABELS, INPUTS, SELECTS ===== */
label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: #7A7267; margin: 16px 0 6px;
  font-weight: 500;
}
select, input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid #E8DFD0; font-size: 15px; background: #fff;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select:focus, input:focus {
  outline: none;
  border-color: #C8A96E;
  box-shadow: 0 0 0 3px rgba(200,169,110,0.15);
}
.hint { font-size: 12px; color: #7A7267; margin-top: 5px; line-height: 1.5; }

/* ===== BOTÕES ===== */
.btn-novo-nome {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  background: #fff; border: 1.5px solid #C8A96E; color: #8B6E1F;
  padding: 10px 18px; border-radius: 22px; font-size: 12.5px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s, transform 0.15s;
}
.btn-novo-nome:active { background: #FBF1DC; transform: scale(0.97); }

.row-check {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 13px 14px; background: #fff; border-radius: 12px;
  border: 1.5px dashed #E8DFD0;
  transition: border-color 0.2s;
}
.row-check:has(input:checked) { border-color: #C8A96E; }

.recorrencia-box {
  margin-top: 10px; padding: 14px; background: #fff;
  border-radius: 12px; display: none; gap: 12px;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #E8DFD0;
}
.recorrencia-box.show { display: grid; }
.recorrencia-box .full { grid-column: 1/-1; }

.btn-primary {
  width: 100%; margin-top: 22px; padding: 16px; border: none;
  border-radius: 12px; background: #1A1A2E; color: #FFFFFF;
  font-weight: 600; font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 4px 12px rgba(26,26,46,0.2);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }

.btn-secundario {
  flex: 1; padding: 15px; border-radius: 12px;
  border: 1.5px solid #E8DFD0; background: #fff;
  color: #7A7267; font-weight: 600; font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s, border-color 0.2s;
}
.btn-secundario:active { background: #F5F0E8; border-color: #D8D2C4; }

/* ===== KPI CARDS ===== */
.cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.cards-grid.tres { grid-template-columns: 1fr 1fr 1fr; }
.kpi {
  background: #fff; border-radius: 14px; padding: 14px 16px;
  border: none;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi .rotulo { font-size: 10.5px; text-transform: uppercase; color: #7A7267; margin-bottom: 5px; font-weight: 500; letter-spacing: 0.04em; }
.kpi .valor { font-family: Georgia, serif; font-size: 18px; font-weight: 600; }

/* ===== SECTION TITLES ===== */
.section-title { font-size: 15px; font-weight: 700; margin: 22px 0 12px; font-family: Georgia, serif; }
.section-title.divisor { padding-top: 12px; border-top: 1.5px solid #E8DFD0; }

/* ===== RANKING ROWS ===== */
.rank-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid rgba(232,223,208,0.6); font-size: 13.5px;
}
.rank-row .barra-mini { flex: 1; height: 5px; background: #E8DFD0; margin: 0 10px; border-radius: 3px; overflow: hidden; }
.rank-row .barra-mini > div { height: 100%; background: #8B4B3B; border-radius: 3px; }
.rank-row .val { font-family: Georgia, serif; white-space: nowrap; }

/* ===== FILTROS ===== */
.filtros { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filtros.periodo { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filtros select, .filtros input { font-size: 12.5px; padding: 10px; }
.filtros label.mini { font-size: 10px; margin: 0 0 3px; }

/* ===== TABLE TOOLBAR ===== */
.table-toolbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  background: #fff; border: none;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
  border-radius: 12px; margin-bottom: 10px; padding: 10px 12px;
}
.table-toolbar-label { font-size: 11px; color: #7A7267; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.table-toolbar select {
  width: auto; padding: 6px 8px; font-size: 12px;
  border: none; background: transparent; color: #1A1A2E; font-weight: 600;
}

/* ===== GRADE MENSAL ===== */
.grade-mensal-wrap {
  overflow-x: auto; margin-bottom: 20px; background: #fff;
  border: none; border-radius: 14px; padding: 12px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.grade-mensal-wrap table { border-collapse: collapse; font-size: 11.5px; width: 100%; min-width: 700px; }
.grade-mensal-wrap th, .grade-mensal-wrap td { padding: 6px 8px; text-align: right; white-space: nowrap; }
.grade-mensal-wrap td:first-child, .grade-mensal-wrap th:first-child { text-align: left; position: sticky; left: 0; background: #fff; }
.grade-mensal-wrap .total-col { border-left: 1.5px solid #E8DFD0; font-weight: 700; }
.grade-mensal-wrap tfoot td { border-top: 1.5px solid #1A1A2E; font-weight: 700; }
.grade-mensal-wrap .canto-final { background: #1A1A2E; color: #fff; }

/* ===== TAGS / BADGES ===== */
.tag-rec { font-size: 9px; background: #C8A96E; color: #fff; padding: 2px 7px; border-radius: 6px; margin-left: 5px; font-weight: 600; }
.tag-proj { font-size: 9px; background: #7A7267; color: #fff; padding: 2px 7px; border-radius: 6px; margin-left: 5px; font-weight: 600; }
.tag-cartao { font-size: 9px; background: #6B4A9A; color: #fff; padding: 2px 7px; border-radius: 6px; margin-left: 5px; font-weight: 600; }
.tag-hashtag { font-size: 9px; background: #E8DFD0; color: #7A7267; padding: 2px 8px; border-radius: 10px; margin-left: 5px; font-weight: 500; }
.tag-hoje { font-size: 9px; background: #C8A96E; color: #fff; padding: 2px 7px; border-radius: 6px; margin-left: 5px; font-weight: 600; }
.tag-atrasado { font-size: 9px; background: #8B4B3B; color: #fff; padding: 2px 7px; border-radius: 6px; margin-left: 5px; font-weight: 600; }

.loading { text-align: center; padding: 24px; color: #7A7267; font-size: 13px; }

/* ===== RESUMO FILTRO ===== */
.resumo-filtro { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.resumo-filtro .kpi .valor { font-size: 15px; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 16px; right: 16px;
  background: #2F6F4E; color: #fff; padding: 14px 18px; border-radius: 14px;
  text-align: center; font-size: 14px; font-weight: 600;
  display: none; z-index: 400;
  box-shadow: 0 8px 24px rgba(47,111,78,0.3);
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(26,26,46,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  z-index: 200; align-items: flex-end;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: #fff; width: 100%;
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  max-height: 85vh; overflow-y: auto;
  box-shadow: 0 -8px 40px rgba(26,26,46,0.15);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== CARTÃO DE CRÉDITO ===== */
.barra-limite { height: 10px; border-radius: 6px; background: #EFE6D8; overflow: hidden; margin-top: 8px; }
.barra-limite > div { height: 100%; background: #C8A96E; border-radius: 6px; }
.fatura-card {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.fatura-card .fatura-head { display: flex; justify-content: space-between; align-items: center; }
.fatura-card .fatura-mes { font-weight: 700; font-size: 14px; font-family: Georgia, serif; }
.fatura-card .fatura-venc { font-size: 11px; color: #7A7267; }
.fatura-card .fatura-valor { font-family: Georgia, serif; font-size: 17px; font-weight: 600; color: #8B4B3B; margin-top: 6px; }
.fatura-card .fatura-saldo { font-size: 11.5px; color: #7A7267; margin-top: 2px; }
.fatura-card .fatura-itens { margin-top: 10px; border-top: 1px dashed rgba(232,223,208,0.7); padding-top: 8px; }
.fatura-card .fatura-item { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; color: #7A7267; }
.btn-fatura {
  width: 100%; margin-top: 10px; padding: 11px; border: none;
  border-radius: 10px; background: #1A1A2E; color: #FFFFFF;
  font-weight: 600; font-size: 12.5px; font-family: 'Inter', sans-serif;
  transition: transform 0.15s;
}
.btn-fatura:active { transform: scale(0.98); }
.compra-card {
  background: #fff; border: none; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; font-size: 12.5px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.config-cartao-box {
  background: #fff; border: none; border-radius: 14px;
  padding: 14px 16px; margin-top: 20px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.config-cartao-box summary { font-weight: 600; font-size: 13px; cursor: pointer; }

/* ===== MULTI-SELECT ===== */
.multi-select-wrap { position: relative; }
.multi-select-btn {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1.5px solid #E8DFD0; background: #fff; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; color: #1A1A2E;
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
}
.multi-select-btn:focus { border-color: #C8A96E; }
.multi-select-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1.5px solid #E8DFD0; border-radius: 14px;
  max-height: 260px; overflow-y: auto; z-index: 20; padding: 6px 0;
  box-shadow: 0 8px 24px rgba(26,26,46,0.12);
}
.multi-select-panel.show { display: block; }
.multi-select-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-size: 13px; }
.multi-select-item input { width: auto; }

/* ===== CHIPS (Mês / Tags) ===== */
.chips-meses { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip-mes {
  flex-shrink: 0; padding: 9px 16px; border-radius: 22px;
  border: 1.5px solid #E8DFD0; background: #fff; color: #7A7267;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.chip-mes:active { transform: scale(0.96); }
.chip-mes.ativo { background: #1A1A2E; border-color: #1A1A2E; color: #FFFFFF; }
.chips-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-tag {
  padding: 7px 14px; border-radius: 22px; border: 1.5px solid #E8DFD0;
  background: #fff; color: #7A7267; font-size: 11.5px; font-weight: 600;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.chip-tag:active { transform: scale(0.96); }
.chip-tag.ativo { background: #C8A96E; border-color: #C8A96E; color: #1A1A2E; }

/* ===== ALERTAS ===== */
.alerta-saldo, .alerta-fatura {
  display: none; border-radius: 14px;
  padding: 14px 16px; margin-bottom: 14px; font-size: 13px; font-weight: 600;
}
.alerta-saldo { background: #F1E5E0; border: 1.5px solid #8B4B3B; color: #8B4B3B; }
.alerta-fatura { background: #FBF1DC; border: 1.5px solid #C8A96E; color: #8B6E1F; }
.alerta-recorrencia-item {
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  font-size: 13px; font-weight: 600;
  background: #FBF1DC; border: 1.5px solid #C8A96E; color: #8B6E1F;
}

/* ===== GRÁFICO DE SALDO ===== */
.grafico-saldo-wrap {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-bottom: 20px; height: 200px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}

/* ===== PREVISÃO AUTOMÁTICA ===== */
.previsao-card {
  background: #1A1A2E; color: #fff; border-radius: 16px; padding: 18px; margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(26,26,46,0.15);
}
.previsao-card .rotulo { font-size: 10.5px; text-transform: uppercase; color: #C8A96E; letter-spacing: 0.08em; font-weight: 500; }
.previsao-card .valor { font-family: Georgia, serif; font-size: 24px; font-weight: 700; margin: 6px 0; }
.previsao-card .detalhe { font-size: 12px; color: #D8D2C4; line-height: 1.5; }

/* ===== PRÓXIMOS DESTAQUES ===== */
.destaques-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.destaque-card {
  background: #fff; border: none; border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.destaque-card .rotulo { font-size: 10.5px; text-transform: uppercase; color: #7A7267; margin-bottom: 5px; font-weight: 500; }
.destaque-card .nome { font-size: 12.5px; color: #1A1A2E; margin-bottom: 2px; }
.destaque-card .valor { font-family: Georgia, serif; font-size: 15px; font-weight: 600; }
.destaque-card .data { font-size: 11px; color: #7A7267; }

/* ===== LINHA DO TEMPO ===== */
.timeline-grupo { margin-bottom: 18px; }
.timeline-grupo .titulo-grupo {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: #C8A96E; letter-spacing: 0.08em; margin-bottom: 8px;
}
.lista-compromissos {
  background: #fff; border: none; border-radius: 14px; padding: 4px 16px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.compromisso-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid rgba(232,223,208,0.5); font-size: 12.5px;
}
.compromisso-row:last-child { border-bottom: none; }
.compromisso-row .data { color: #7A7267; margin-right: 8px; }

/* ===== SALÁRIO COMPROMETIDO ===== */
.salario-card {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.salario-card .rotulo { font-size: 10.5px; text-transform: uppercase; color: #7A7267; font-weight: 500; }
.salario-card .percentual { font-family: Georgia, serif; font-size: 22px; font-weight: 700; margin: 4px 0 6px; }
.salario-card .linha-valores { display: flex; justify-content: space-between; font-size: 12px; color: #7A7267; margin-top: 8px; }
.config-salario-box {
  background: #fff; border: none; border-radius: 14px;
  padding: 14px 16px; margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.config-salario-box summary { font-weight: 600; font-size: 13px; cursor: pointer; }
.salario-toolbar { display: flex; gap: 6px; margin-top: 10px; margin-bottom: 8px; }
.salario-toolbar input { flex: 1; padding: 10px; font-size: 12.5px; }
.salario-toolbar button { flex: 0 0 auto; padding: 10px 12px; font-size: 11px; white-space: nowrap; }
.salario-chips-grid {
  max-height: 240px; overflow-y: auto;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 2px; border-top: 1px dashed rgba(232,223,208,0.6); margin-top: 8px;
}
.chip-salario {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 22px;
  border: 1.5px solid #E8DFD0; background: #F5F0E8;
  font-size: 12px; color: #7A7267; cursor: pointer; user-select: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.chip-salario.ativo { background: #C8A96E; border-color: #C8A96E; color: #1A1A2E; font-weight: 700; }
.chip-salario input { display: none; }
.salario-contador { font-size: 11px; color: #7A7267; margin-top: 6px; }

/* ===== SELEÇÃO EM LOTE ===== */
.barra-lote {
  display: none; align-items: center; justify-content: space-between;
  background: #1A1A2E; color: #FFFFFF; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 10px; font-size: 13px;
}
.barra-lote button {
  background: #C8A96E; color: #1A1A2E; border: none; padding: 9px 14px;
  border-radius: 10px; font-weight: 600; font-size: 12.5px;
  font-family: 'Inter', sans-serif;
}

/* ===== RANKING POR CATEGORIA ===== */
.categoria-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 0;
  border-bottom: 1px solid rgba(232,223,208,0.6); font-size: 13px;
}
.categoria-row .barra-mini { flex: 1; height: 5px; background: #E8DFD0; border-radius: 3px; overflow: hidden; }
.categoria-row .barra-mini > div { height: 100%; background: #C8A96E; border-radius: 3px; }
.barra-parcela { height: 6px; border-radius: 4px; background: #EFE6D8; overflow: hidden; margin-top: 6px; width: 100%; }
.barra-parcela > div { height: 100%; background: #2F6F4E; border-radius: 4px; }

/* ===== CARDS DE LANÇAMENTO ===== */
.lancamentos-lista { display: flex; flex-direction: column; gap: 8px; }
.lancamento-card {
  background: #fff; border: none; border-radius: 14px;
  padding: 14px 16px; display: grid;
  grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  border-left: 4px solid #C8A96E; width: 100%;
  box-shadow: 0 2px 8px rgba(26,26,46,0.05);
  transition: transform 0.15s, box-shadow 0.2s;
}
.lancamento-card.clicavel { cursor: pointer; }
.lancamento-card.clicavel:active {
  transform: scale(0.99);
  box-shadow: 0 1px 4px rgba(26,26,46,0.08);
}
.card-edit-icon {
  grid-column: 4; font-size: 15px; color: #C8A96E; opacity: 0.9;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: rgba(200,169,110,0.12); flex-shrink: 0;
  transition: background 0.2s;
}
.lancamento-card .card-check { grid-column: 1; }
.lancamento-card .card-info { grid-column: 2; min-width: 0; overflow: hidden; }
.lancamento-card .card-nome {
  font-family: Georgia, serif; font-size: 14px; color: #1A1A2E;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 4px;
  overflow-wrap: break-word; word-break: break-word; max-width: 100%;
}
.lancamento-card .card-data { font-size: 11px; color: #7A7267; }
.lancamento-card .card-valor { grid-column: 3; font-family: Georgia, serif; font-size: 15.5px; font-weight: 600; white-space: nowrap; }
.lancamento-card .card-valor.pos { color: #2F6F4E; }
.lancamento-card .card-valor.neg { color: #8B4B3B; }

/* ===== CALENDÁRIO ===== */
.calendario-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendario-header button {
  background: #fff; border: 1.5px solid #E8DFD0; border-radius: 10px;
  padding: 9px 14px; font-size: 15px;
  transition: background 0.2s;
}
.calendario-header button:active { background: #F5F0E8; }
.calendario-header .mes-label { font-family: Georgia, serif; font-size: 16px; font-weight: 700; }
.calendario-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendario-grid .dia-semana { text-align: center; font-size: 10px; color: #7A7267; text-transform: uppercase; padding-bottom: 4px; font-weight: 600; }
.calendario-dia {
  aspect-ratio: 1; background: #fff; border: 1px solid #E8DFD0; border-radius: 10px;
  padding: 4px; font-size: 11px; display: flex; flex-direction: column; cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.calendario-dia:active { background: #F5F0E8; }
.calendario-dia.vazio { background: transparent; border: none; cursor: default; }
.calendario-dia.hoje { border: 2px solid #1A1A2E; }
.calendario-dia.selecionado { background: #1A1A2E; color: #fff; border-color: #1A1A2E; }
.calendario-dia .num-dia { font-weight: 700; }
.calendario-dia .pontos { display: flex; gap: 2px; margin-top: auto; flex-wrap: wrap; }
.calendario-dia .ponto { width: 6px; height: 6px; border-radius: 50%; }
.calendario-dia .ponto.entrada { background: #2F6F4E; }
.calendario-dia .ponto.saida { background: #8B4B3B; }
.calendario-dia.selecionado .ponto.entrada { background: #7FD9A8; }
.calendario-dia.selecionado .ponto.saida { background: #E8A08D; }
.calendario-resumo-dia {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-top: 16px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.calendario-item-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid rgba(232,223,208,0.5); font-size: 13px;
}
.calendario-item-row:last-child { border-bottom: none; }

/* ===== METAS ===== */
.meta-card {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}
.meta-card .meta-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.meta-card .meta-nome { font-family: Georgia, serif; font-weight: 700; font-size: 15px; }
.meta-card .meta-pct { font-size: 13px; color: #C8A96E; font-weight: 700; }
.meta-card .meta-valores { display: flex; justify-content: space-between; font-size: 12px; color: #7A7267; margin-top: 6px; }
.meta-card .meta-acoes { display: flex; gap: 8px; margin-top: 12px; }
.meta-card .meta-acoes button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1.5px solid #E8DFD0;
  background: #fff; font-size: 12px; font-weight: 600; color: #7A7267;
  font-family: 'Inter', sans-serif;
  transition: background 0.2s;
}
.meta-card .meta-acoes button:active { background: #F5F0E8; }
.form-box {
  background: #fff; border: none; border-radius: 14px;
  padding: 16px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
}

/* ===== INVESTIMENTOS ===== */
.patrimonio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.patrimonio-total {
  background: #1A1A2E; color: #fff; border-radius: 16px; padding: 18px;
  margin-bottom: 16px; text-align: center;
  box-shadow: 0 4px 16px rgba(26,26,46,0.15);
}
.patrimonio-total .rotulo { font-size: 10.5px; text-transform: uppercase; color: #C8A96E; font-weight: 500; }
.patrimonio-total .valor { font-family: Georgia, serif; font-size: 26px; font-weight: 700; margin-top: 6px; }
.investimento-card {
  background: #fff; border: none; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 2px 8px rgba(26,26,46,0.06);
  transition: transform 0.15s;
}
.investimento-card:active { transform: scale(0.99); }
.investimento-card .inv-nome { font-size: 13.5px; }
.investimento-card .inv-tipo { font-size: 10.5px; color: #7A7267; }
.investimento-card .inv-valor { font-family: Georgia, serif; font-weight: 600; font-size: 14px; }
.investimento-card .inv-acoes { display: flex; gap: 6px; }
.investimento-card .inv-acoes button { background: none; border: none; font-size: 14px; color: #7A7267; }

/* ===== SIMULAÇÃO DE CENÁRIO ===== */
.simulacao-box {
  background: #fff; border: 1.5px dashed #C8A96E; border-radius: 14px;
  padding: 16px; margin-bottom: 20px;
}
.simulacao-box summary { font-weight: 700; font-size: 13.5px; cursor: pointer; font-family: Georgia, serif; }
.ajuste-row { display: flex; gap: 6px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.ajuste-row select, .ajuste-row input { flex: 1; min-width: 90px; padding: 10px; font-size: 12.5px; }
.ajuste-row button.remover {
  flex: 0 0 auto; background: #F1E5E0; color: #8B4B3B; border: none;
  border-radius: 10px; padding: 10px 12px;
  transition: background 0.2s;
}
.ajuste-row button.remover:active { background: #E8D5CE; }
.lista-ajustes-ativos { margin-top: 8px; }
.ajuste-ativo-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #F5F0E8;
  border-radius: 22px; padding: 6px 12px; font-size: 11.5px; margin: 3px 4px 0 0;
}
.resultado-simulacao {
  display: none; background: #E4EEE7; border-radius: 12px;
  padding: 14px; margin-top: 12px; font-size: 13px;
}
.resultado-simulacao.show { display: block; }
.resultado-simulacao .valor-grande { font-family: Georgia, serif; font-size: 19px; font-weight: 700; color: #2F6F4E; }

/* ================================================================
   DARK MODE
   ================================================================ */
@media (prefers-color-scheme: dark) {
  body { background: #14141F; color: #E8DFD0; }
  header { background: #0D0D16; }
  .sidebar { background: #0D0D16; }

  /* Cards/boxes */
  .kpi, .fatura-card, .compra-card, .investimento-card, .meta-card, .destaque-card,
  .lista-compromissos, .salario-card, .config-cartao-box, .config-salario-box,
  .calendario-dia, .calendario-resumo-dia, .form-box, .modal-box,
  .lancamento-card, .table-toolbar, .multi-select-panel, .multi-select-btn,
  .grafico-saldo-wrap, .grade-mensal-wrap,
  select, input {
    background: #1E1E2E;
    border-color: #33334A;
    color: #E8DFD0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }

  .lancamento-card .card-nome,
  .destaque-card .nome {
    color: #F0ECE0 !important;
  }
  .lancamento-card .card-data,
  .destaque-card .rotulo,
  .kpi .rotulo,
  .investimento-card .inv-tipo,
  .investimento-card .inv-acoes button,
  .meta-card .meta-valores,
  .meta-card .meta-acoes button,
  .salario-card .rotulo,
  .salario-card .linha-valores,
  .fatura-card .fatura-venc,
  .fatura-card .fatura-saldo,
  .fatura-card .fatura-item,
  .compromisso-row .data,
  .table-toolbar-label {
    color: #B5AC9A !important;
  }

  .lancamento-card .card-valor.pos { color: #7FD9A8 !important; }
  .lancamento-card .card-valor.neg { color: #E8A08D !important; }
  .fatura-card .fatura-valor { color: #E8A08D !important; }

  .tipo-toggle button { background: #1E1E2E; border-color: #33334A; color: #B5AC9A; }
  .tipo-toggle button.sel-entrada { background: #1B3B2C; border-color: #2F6F4E; color: #7FD9A8; }
  .tipo-toggle button.sel-saida { background: #3B231D; border-color: #8B4B3B; color: #E8A08D; }

  .chip-mes, .chip-tag, .chip-salario, .btn-secundario, .top-tabs button {
    background: #1E1E2E; border-color: #33334A; color: #C7C2B4;
  }
  .top-tabs { background: rgba(13,13,22,0.92); }
  .chip-mes.ativo, .chip-tag.ativo, .chip-salario.ativo, .btn-primary {
    background: #C8A96E; border-color: #C8A96E; color: #14141F;
  }

  .previsao-card, .patrimonio-total { background: #0D0D16; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

  .rank-row, .categoria-row, .compromisso-row, .calendario-item-row,
  .fatura-item, .compromisso-row, .meta-card .meta-valores {
    border-color: #33334A;
  }

  .barra-limite, .rank-row .barra-mini, .categoria-row .barra-mini, .barra-parcela {
    background: #33334A;
  }

  .hint, label { color: #9B9585; }

  .calendario-dia.hoje { border-color: #C8A96E; }
  .calendario-dia.vazio { background: transparent; }
  .calendario-dia:active { background: #2A2A3D; }
  .lancamento-card.clicavel:active { background: #252536; }

  .recorrencia-box { background: #1E1E2E; border-color: #33334A; }
  .row-check { background: #1E1E2E; border-color: #33334A; }
  .modal-overlay { background: rgba(0,0,0,0.6); }
  .saldo-popover { background: #1E1E2E; box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
  .grade-mensal-wrap td:first-child, .grade-mensal-wrap th:first-child { background: #1E1E2E; }

  .toast { background: #2F6F4E; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }

  select:focus, input:focus { box-shadow: 0 0 0 3px rgba(200,169,110,0.2); }

  .meta-card .meta-acoes button { background: #1E1E2E; border-color: #33334A; }
  .meta-card .meta-acoes button:active { background: #2A2A3D; }
}

/* ===== PRINT ===== */
@media print {
  header, .sidebar, .sidebar-overlay, .no-print { display: none !important; }
  main { padding: 0; }
  .screen { display: none !important; }
  .screen.active { display: block !important; }
  body { background: #fff; }
}

/* ===== ETAPA 11: ZONAS DO NOVO DASHBOARD ===== */
.visao-mes-card {
  background: #1A1A2E;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(26,26,46,0.1);
}
.visao-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 12px;
}
.titulo-mes {
  font-family: Georgia, serif;
  font-size: 18px;
  color: #D8D2C4;
}
/* Garantir que a div de meses dentro do header role na horizontal sem quebrar */
.visao-header .chips-meses {
  margin: 0 !important;
  flex-wrap: nowrap;
  overflow-x: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.visao-header .chips-meses::-webkit-scrollbar { display: none; }
.visao-valores {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.visao-entradas {
  color: #2F6F4E;
  font-size: 16px;
  font-weight: 600;
}
.visao-saidas {
  color: #E8A08D;
  font-size: 16px;
  font-weight: 600;
}
.carteiras-snapshot {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -ms-overflow-style: none; /* IE/Edge */
  scrollbar-width: none; /* Firefox */
}
.carteiras-snapshot::-webkit-scrollbar { display: none; }
.carteiras-snapshot > * {
  scroll-snap-align: center;
  flex: 0 0 85%;
}

/* ===== SIDEBAR ===== */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 22, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: -280px;
  width: 280px;
  background: #1A1A2E;
  z-index: 1001;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(200, 169, 110, 0.1);
  box-shadow: 4px 0 15px rgba(0,0,0,0.5);
}
.sidebar.show {
  left: 0;
}
.sidebar-header {
  padding: 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(200, 169, 110, 0.1);
}
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #D8D2C4;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}
.sidebar-item:hover, .sidebar-item:active {
  background: rgba(200, 169, 110, 0.1);
}
.sidebar-icon {
  font-size: 18px;
}
