:root{
  --bg:#161616;
  --surface:#1e1e1e;
  --surface2:#262626;
  --border:#2a2a2a;
  --text:#e6e6e6;
  --text2:#9aa0a6;
  --accent:#0078d7;
  --accent2:#00b7ff;
  --green:#22c55e;
  --red:#ef4444;
  --radius:16px;
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font-family:Calibri,-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Inter,Ubuntu,sans-serif;overscroll-behavior:none}
.app{max-width:520px;margin:0 auto;min-height:100vh;display:flex;flex-direction:column;position:relative;background:var(--bg)}
header{position:sticky;top:0;z-index:20;background:rgba(22,22,22,.95);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);padding:14px 18px 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border)}

.logo{display:flex;align-items:center;gap:10px;font-weight:800;font-size:20px;letter-spacing:.3px}
.header__logo {
    width: 36px;
    height: 36px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: inline-block;
    border-radius: 8px;
}

.header-actions{display:flex;flex-direction:column;gap:2px;color:var(--text2);font-size:12px;text-align:right;}
main{flex:1;padding:0 0 70px}
.view{display:none;padding:14px 14px 0;animation:fade .22s ease}
.view.active{display:block}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
h2{margin:4px 0 12px;font-size:20px;font-weight:700}
h3{margin:0}

.sticky-top {
    position: sticky;
    top: 61px;
    background: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 10;
    margin: -14px -14px 12px -14px;
    padding: 14px 14px 10px 14px;
    border-bottom: 1px solid var(--border);
}

.list-subtitle { font-size:11px; color:#888; margin:6px 0 6px; text-transform:uppercase; letter-spacing:.6px; font-weight:700; }

.cards{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px;position:relative;overflow:hidden}
.card-label{font-size:11px;color:var(--text2);margin-bottom:4px;text-transform:uppercase;letter-spacing:.6px;font-weight:600}
.card-value{font-size:24px;font-weight:800;letter-spacing:-.5px}
.card-value.green{color:var(--green)}
.card-value.red{color:var(--red)}
.card-value.accent{color:var(--accent2)}

.charts-container { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.chart-section { display: flex; flex-direction: column; gap: 10px; background: var(--surface2); padding: 12px; border-radius: 16px; border: 1px solid var(--border); }
.chart-section-title { font-size: 14px; font-weight: 800; color: var(--accent2); text-transform: uppercase; margin-bottom: 4px; text-align: center; }
.insight-title { margin-bottom: 8px; }
.chart-title { font-size:12px; font-weight:700; text-align:center; margin-bottom:8px; color:var(--text); }
.chart-title span { font-size:10px; color:#888; font-weight:normal; }

.chart-wrap {
    height: 250px; 
    display: flex;
    flex-direction: column;
    padding: 12px 12px 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
}

.canvas-scroll-area {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    padding-right: 18px;
}
.canvas-scroll-area::-webkit-scrollbar { width: 4px; display: block; }
.canvas-scroll-area::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 4px; }

.canvas-inner {
    position: relative;
    width: 100%;
}
.elegant-chart { filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.5)); }

.list{display:flex;flex-direction:column;gap:4px}
.item{border-radius:10px;padding:4px 10px;margin: 0 4px; display:flex;align-items:center;gap:8px;cursor:pointer;transition:transform .08s,background .15s,border-color .15s; background:var(--surface); border:1px solid var(--border); -webkit-user-select: none; user-select: none;}
.item:active{transform:scale(.985);}

.month-divider { display:flex; justify-content:space-between; align-items: center; padding: 6px 10px; border-radius: 8px; background: #000000; border: 1px solid var(--border); margin: 2px 4px 6px 4px; }
.month-divider .neutral { color: #fff; }

.st-A { background-color: #c2c2c2; }
.st-A .item-title, .st-A .item-sub, .st-A .item-value { color: #353535 !important; }
.st-A .item-value.negative { color: #b91c1c !important; } 
.st-A .item-value.positive { color: #15803d !important; } 
.st-A .date-bottom { color: #353535 !important; font-weight:600; }
.st-A .item-title span { color: #353535 !important; }

.st-C { background-color: rgba(250, 233, 0, 0.781); border: 2px solid rgb(255, 174, 0); } 
.st-C .item-title, .st-C .item-sub, .st-C .item-value { color: #111 !important; }
.st-C .item-value.negative { color: #b41414 !important; } 
.st-C .item-value.positive { color: #15803d !important; } 
.st-C .date-bottom { color: #000 !important; font-weight:600; }
.st-C .item-title span { color: #505050 !important; }

.st-F { background-color: rgba(34, 197, 94, 0.25); }
.st-F .item-title, .st-F .item-sub, .st-F .item-value { color: #8b8b8b !important; }
.st-F .item-value.negative { color: #b91c1c !important; }
.st-F .item-value.positive { color: #15803d !important; }
.st-F .date-bottom { color: #8b8b8b !important; font-weight:600; }
.st-F .item-title span { color: #8b8b8b !important; }

.st-overdue { background-color: rgb(255, 21, 21); border: 1px solid rgba(239, 68, 68, 0.7); }
.st-overdue .item-title, .st-overdue .item-sub, .st-overdue .item-value { color: #fff !important; }
.st-overdue .item-value.negative { color: #fff000 !important; } 
.st-overdue .item-value.positive { color: #00ff00 !important; } 
.st-overdue .date-bottom { color: #fff !important; font-weight:600; }
.st-overdue .item-title span { color: #000000 !important; }

.st-P { background-color: rgba(0, 183, 255, 0.08); border: 1px dashed var(--accent2); }

.item:hover{filter:brightness(1.1);}

.legenda-status { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--text2); align-items: center; }
.bolinha { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 2px; }
.st-A-color { background-color: #e4e4e7; border: 1px solid #111; }
.st-C-color { background-color: #eab308; } 
.st-F-color { background-color: #22c55e; }
.st-overdue-color { background-color: var(--red); }

.sum-checkbox-container { display: none; margin-right:4px; }
.sum-checkbox-container input { width: 18px; height: 18px; pointer-events: none; accent-color: var(--accent2); }
.sum-mode-active .sum-checkbox-container { display: block; }
.sum-mode-active .item-icon { display: none; }

.item-icon{width:32px;height:32px;border-radius:8px;background:#252525;display:grid;place-items:center;flex-shrink:0;}
.item-main{flex:1;min-width:0}
.item-title{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13.5px}
.item-sub{font-size:11px;color:var(--text2);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item-value{font-weight:700;font-size:13.5px;white-space:nowrap}
.item-value.positive{color:var(--green)}
.item-value.negative{color:var(--red)}
.item-value.transfer{color:var(--accent2)}
.date-bottom { font-size: 10px; color: var(--text2); margin-top: 2px; }

.edit-btn {background: rgba(255,255,255,0.08); border-radius: 10px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: 0.2s;}
.edit-btn:hover { background: rgba(255,255,255,0.18); }

.section-header{display:flex;align-items:center;justify-content:space-between;margin:4px 0 10px}
.btn{background:#252525;border:1px solid #2f2f2f;color:var(--text);padding:8px 12px;border-radius:10px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;transition:all .15s;font-size:13px}
.btn:hover{filter:brightness(1.1);border-color:#3a3a3a}
.btn:active{transform:scale(.97)}
.btn-primary{background:var(--accent);border-color:var(--accent);color:#fff;}
.btn-danger{background:#2a1515;border-color:#3a1a1a;color:#ff8a8a}

.btn-close-x {
    background: #e81123;
    color: white;
    border: 1px solid #e81123;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
    padding: 0;
}
.btn-close-x:hover { background: #ff4a58; border-color: #ff4a58; }

.bottom-nav{position:fixed;bottom:0;left:0;right:0;max-width:520px;margin:0 auto;background:rgba(16,16,16,.95);backdrop-filter:blur(18px);border-top:1px solid var(--border);display:flex;justify-content:space-around;padding:6px 2px calc(6px + env(safe-area-inset-bottom));z-index:30}
.nav-btn{text-transform:uppercase;background:none;border:none;color:var(--text2);display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;border-radius:10px;font-size:9px;font-weight:600;cursor:pointer;flex:1;transition:color .18s;min-width:0}
.nav-btn svg{width:20px;height:20px;stroke-width:2.5;opacity:.85;}
.nav-btn.active{color:var(--accent2)}
.nav-btn.active svg{opacity:1;transform:translateY(-1px);stroke:var(--accent2)}

#filtro-backdrop { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.7); z-index:90; backdrop-filter: blur(2px); }

.floating-panel { 
    position:fixed; top:10%; left:50%; transform:translateX(-50%); 
    width:92%; max-width:480px; max-height:80vh; overflow-y:auto; 
    z-index:100; background:#18181b; border:1px solid rgba(255,255,255,0.32);
    border-radius:16px; box-shadow: 0 20px 50px rgba(0,0,0,0.9); 
    padding: 24px; box-sizing: border-box;
}

.modal{position:fixed;inset:0;background:rgba(0,0,0,.65);display:none;align-items:flex-end;justify-content:center;z-index:110;padding:0}
.modal.open{display:flex}
.modal-content{background:var(--bg);width:100%;max-width:520px;border-radius:24px 24px 0 0;border-top:1px solid #2d2d2d;padding:24px 18px 0px;max-height:var(--modal-max-h,92vh);display:flex;flex-direction:column;overflow:hidden;animation:slide .25s ease-out; position: relative;}
@keyframes slide{from{transform:translateY(100%)}to{transform:none}}
@keyframes slide-out{from{transform:none}to{transform:translateY(100%)}}
.modal-content.slide-out{animation:slide-out .2s ease-in forwards}
@keyframes spin{to{transform:rotate(360deg)}}
.modal-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;flex-shrink:0;}
.modal-title{font-size:16px;font-weight:800}

form{display:flex;flex-direction:column;gap:10px;flex:1;overflow-y:auto;overflow-x:hidden;padding-bottom:0;padding-right:6px;box-sizing:border-box;scrollbar-gutter:stable;}
label{font-size:12px;color:var(--text2);display:flex;flex-direction:column;gap:4px;font-weight:500}
input,select,textarea{background:var(--surface);border:1px solid rgba(255,255,255,0.32);color:var(--text);padding:10px;border-radius:10px;font-size:13.5px;width:100%;outline:none;transition:border .15s;font-family:inherit; box-sizing: border-box;}
input:focus,select:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 2px rgba(0,120,215,.2)}
input:disabled,select:disabled,textarea:disabled{opacity:0.45;cursor:not-allowed}
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.8; cursor: pointer; }

.checkbox-list { display: flex; flex-direction: column; gap: 4px; max-height: 110px; overflow-y: auto; background: var(--surface); border: 1px solid rgba(255,255,255,0.32); border-radius: 10px; padding: 6px 8px; }
.checkbox-list label { flex-direction: row; align-items: center; font-size: 13px; color: var(--text); font-weight: normal; gap: 8px; cursor: pointer; padding: 2px 0;}
.checkbox-list input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; margin: 0; accent-color: var(--accent); }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: start; }

.tipo-selector { display: flex; gap: 6px; }
.tipo-btn { flex: 1; font-size: 10px; padding: 10px 0; border: 1px solid #2c2c2c; background: #1c1c1c; border-radius: 10px; }
.tipo-btn.receita-btn.active { background: #064e3b; border-color: #10b981; color: white; }
.tipo-btn.despesa-btn.active { background: #7f1d1d; border-color: #ef4444; color: white; }
.tipo-btn.transf-btn.active { background: #004d80; border-color: #00b7ff; color: white; }

.label-transf-origem { color: var(--red); font-weight: 800; }
.label-transf-destino { color: var(--green); font-weight: 800; }

.status-selector { display: flex; gap: 6px; }
.status-btn { flex: 1; font-size: 13px; font-weight: 800; padding: 8px 0; border: 1px solid #333; background: #1c1c1c; color: var(--text2); border-radius: 10px; }
.status-btn.st-btn-A.active { background: #fff; color: #000; border-color: #fff; }
.status-btn.st-btn-C.active { background: #eab308; color: #fff; border-color: #ca8a04; } 
.status-btn.st-btn-F.active { background: #166534; color: #fff; border-color: #15803d; }

.valor-highlight { font-size: 1.4em !important; font-weight: 800; padding: 10px 12px !important; text-align: center; }
.valor-highlight.input-receita { color: var(--green) !important; border-color: var(--green); }
.valor-highlight.input-despesa { color: var(--red) !important; border-color: var(--red); }
.valor-highlight.input-transferencia { color: var(--accent2) !important; border-color: var(--accent2); }

.date-wrapper { position: relative; width: 100%; height: 41px; background: var(--surface); border: 1px solid rgba(255,255,255,0.32); border-radius: 10px; overflow: hidden; }
.date-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0,120,215,.2); }
#real-data, #filtro-data-ini, #filtro-data-fim { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; z-index: 10; cursor: pointer; }
#fake-data-container { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; z-index: 1; pointer-events: none; }
#fake-data-text, #fake-filtro-ini-text, #fake-filtro-fim-text { font-weight: 700; color: #fff; font-size: 13.5px; }
.st-A #fake-data-text { color: #fff; }

.date-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 15px; pointer-events: none; color: white; z-index: 1; filter: invert(1); opacity: 0.9; }

/* CAIXA DE ANEXOS E BOTÃO REMOVER */
.file-upload-wrapper { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid rgba(255,255,255,0.32); padding: 4px; border-radius: 10px; position: relative; }
.btn-file-custom { background: #333; font-size: 11px; padding: 6px 10px; border-radius: 10px; pointer-events: none; z-index: 2; }
#file-name-display { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; z-index: 2; }
#input-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; z-index: 1; }

#btn-remove-anexo {
    position: relative;
    z-index: 10;
    background: #2a1515;
    color: #ff8a8a;
    border: 1px solid #3a1a1a;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
}
#btn-remove-anexo:hover { background: #ff4a58; color: #fff; border-color: #ff4a58; }

.check-label { flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; padding: 8px; background: var(--surface2); border-radius: 10px; }
.check-label input { width: 16px; height: 16px; flex-shrink: 0; }
.repetir-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); }

.tags-container { display: flex; flex-wrap: wrap; gap: 6px; min-height: 0; width: 100%; box-sizing: border-box; align-content: flex-start; }
/* Título do item de lançamento parcelado: Beneficiário | 01/10 | R$... */
.item-ben-titulo { font-weight: 700; color: #fff; }
.item-parcelas-info { font-weight: 400; color: #bbb; font-size: 0.95em; }
.tag-pill { background: #333; color: #fff; padding: 4px 10px; border-radius: 20px; font-size: 10.5px; display: inline-flex; align-items: center; gap: 6px; }
.tag-remove { cursor: pointer; font-weight: bold; color: var(--red); font-size: 12px; padding: 0 2px; }

.actions{
    display:flex; gap:8px; margin-top:4px;
    flex-shrink: 0;
    background: var(--bg);
    padding: 12px 14px 20px;
    border-top: 1px solid var(--border);
    z-index: 20;
}
.actions .btn{flex:1;justify-content:center;padding:12px;font-size:14px}

.empty{padding:24px 16px;text-align:center;color:var(--text2);font-size:12px}

.checkbox-list::-webkit-scrollbar { width: 4px; display: block; }
.checkbox-list::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 4px; }

/* ===== COMPACT MODE — MODAL LANÇAMENTO ===== */
/* Escopado a #form-lancamento / #modal-lancamento — não afeta outros modais */

#modal-lancamento .modal-header { margin-bottom: 8px; }

#form-lancamento {
  gap: 6px;
  padding-right: 12px; /* espaço suficiente para scrollbar em qualquer plataforma */
}
/* Scrollbar fino para não sobrepor conteúdo (webkit — mobile/desktop) */
#form-lancamento::-webkit-scrollbar { width: 3px; }
#form-lancamento::-webkit-scrollbar-track { background: transparent; }
#form-lancamento::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 2px; }
/* Tags: bloco independente no flex column — empurra "Local de Origem" para baixo */
#form-lancamento #tags-display {
  width: 100%;
  min-height: 4px; /* pequeno reservado evita colapso total no Safari/WebKit */
  flex-shrink: 0;
  overflow: visible; /* pills não são cortados */
  padding-bottom: 2px;
}
#form-lancamento label {
  gap: 3px;
}
#form-lancamento input,
#form-lancamento select,
#form-lancamento textarea {
  padding: 8px 10px;
}
#form-lancamento .valor-highlight {
  font-size: 1.3em !important;
  padding: 8px 12px !important;
}
#form-lancamento .tipo-btn {
  padding: 0;
  font-size: 10px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#form-lancamento .status-btn {
  padding: 0;
  font-size: 13px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#form-lancamento .check-label {
  padding: 6px 8px;
}
#form-lancamento .repetir-box {
  padding: 8px;
}
#form-lancamento #textarea-descricao {
  min-height: 36px;
}
#modal-lancamento .actions {
  padding: 10px 12px 16px;
  align-items: center;
}
#modal-lancamento .actions .btn {
  padding: 10px 12px;
}

/* ── Botões de ação padronizados do modal Lançamento ── */
/* Botões secundários: tamanho fixo uniforme */
#modal-lancamento .lnc-icon-btn {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0 !important;
  font-size: 17px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* Salvar: ocupa espaço restante */
#modal-lancamento .lnc-btn-save {
  flex: 1 !important;
  font-size: 18px;
  padding: 10px 12px !important;
}
/* Duplicar: neutro/discreto */
#modal-lancamento .lnc-btn-dup {
  background: #242424;
  border-color: #363636;
  color: #888;
  font-size: 19px;
}
#modal-lancamento .lnc-btn-dup:hover { background: #2c2c2c; color: #bbb; }
/* Voz: roxo, quadrado (não circular) */
#modal-lancamento .lnc-btn-voz {
  background: #7c3aed;
  border: 1px solid #7c3aed;
  color: #fff;
  border-radius: 10px;
}

/* ===== EXTRA COMPACT — telas muito pequenas (ex.: iPhone SE) ===== */
@media (max-height: 720px) {
  #form-lancamento {
    gap: 6px;
  }
  #form-lancamento label {
    gap: 2px;
  }
  #form-lancamento input,
  #form-lancamento select,
  #form-lancamento textarea {
    padding: 7px 10px;
    font-size: 13px;
  }
  #form-lancamento .valor-highlight {
    font-size: 1.2em !important;
    padding: 7px 12px !important;
  }
  #form-lancamento .tipo-btn {
    padding: 6px 0;
  }
  #form-lancamento .status-btn {
    padding: 5px 0;
  }
  #form-lancamento .check-label {
    padding: 5px 8px;
  }
  #form-lancamento #textarea-descricao {
    min-height: 32px;
  }
  #modal-lancamento .modal-header {
    margin-bottom: 5px;
  }
  #modal-lancamento .actions {
    padding: 8px 12px 12px;
  }
  #modal-lancamento .actions .btn {
    padding: 9px 12px;
  }
  #modal-lancamento .lnc-icon-btn {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    font-size: 15px;
  }
  #modal-lancamento .lnc-btn-dup { font-size: 17px; }
}
/* ===== MODAL LANÇAMENTO — VISUAL PREMIUM ===== */
/* Fundo preto total para máximo contraste */
#modal-lancamento .modal-content {
  background: #000000;
  border-top-color: rgba(255,255,255,0.12);
}

/* Todos os campos: cinza escuro + borda branca visível */
#form-lancamento input,
#form-lancamento select,
#form-lancamento textarea {
  background: #2f2f2f !important;
  border: 1px solid rgba(255,255,255,0.75) !important;
  color: var(--text);
}
#form-lancamento input:focus,
#form-lancamento select:focus,
#form-lancamento textarea:focus {
  border-color: var(--accent2) !important;
  box-shadow: 0 0 0 2px rgba(0,183,255,0.18);
}

/* Wrappers de campo: mesmo tratamento */
#form-lancamento .date-wrapper,
#form-lancamento .file-upload-wrapper,
#form-lancamento .checkbox-list,
#form-lancamento .repetir-box {
  background: #2f2f2f;
  border-color: rgba(255,255,255,0.75);
}

/* Valor highlight: mantém borda colorida mas fundo cinza */
#form-lancamento .valor-highlight.input-despesa   { border-color: var(--red)    !important; }
#form-lancamento .valor-highlight.input-receita   { border-color: var(--green)  !important; }
#form-lancamento .valor-highlight.input-transferencia { border-color: var(--accent2) !important; }

/* Botões escuros: borda branca suave */
#form-lancamento .tipo-btn,
#form-lancamento .status-btn {
  border-color: rgba(255,255,255,0.22) !important;
}
#form-lancamento .tipo-btn.active  { border-color: inherit !important; }
#form-lancamento .status-btn.active { border-color: inherit !important; }

/* Botões de ação da área inferior */
#modal-lancamento .lnc-btn-dup {
  background: #1a1a1a;
  border-color: rgba(255,255,255,0.25) !important;
}

/* ── Border-radius compacto (~35% menor) — visual financeiro profissional ── */
/* Campos */
#form-lancamento input,
#form-lancamento select,
#form-lancamento textarea         { border-radius: 6px !important; }
/* Wrappers de campo */
#form-lancamento .date-wrapper,
#form-lancamento .file-upload-wrapper,
#form-lancamento .checkbox-list,
#form-lancamento .repetir-box     { border-radius: 6px !important; }
/* TODOS os botões dentro do form (inclui inline border-radius:8px via !important) */
#form-lancamento button           { border-radius: 6px !important; }

/* ── Campos preenchidos: fundo claro + texto escuro ── */
#form-lancamento input:not([type="hidden"]):not(:placeholder-shown),
#form-lancamento textarea:not(:placeholder-shown) {
  background: #e3e3e3 !important;
  color: #111111 !important;
}
#form-lancamento select.has-value {
  background: #e3e3e3 !important;
  color: #111111 !important;
}
/* Data: sempre preenchida — fundo claro + texto escuro + altura alinhada */
#form-lancamento .date-wrapper {
  background: #e3e3e3 !important;
  height: 36px;
}
#form-lancamento .date-wrapper #fake-data-text {
  color: #111111 !important;
}
/* Valor: borda 2px (destaque reforçado) */
#form-lancamento .valor-highlight { border-width: 2px !important; }
/* Valor preenchido: texto escuro por tipo + fundo levemente tingido */
#form-lancamento .valor-highlight:not(:placeholder-shown).input-despesa {
  color: #7f1d1d !important;
  background: #fff5f5 !important;
}
#form-lancamento .valor-highlight:not(:placeholder-shown).input-receita {
  color: #14532d !important;
  background: #f0fff4 !important;
}
#form-lancamento .valor-highlight:not(:placeholder-shown).input-transferencia {
  color: #0c4a6e !important;
  background: #e8f7ff !important;
}
/* Tags e Links: visual preenchido quando há itens (mesmo que input esteja vazio) */
#form-lancamento #input-tag-lanc.has-items,
#form-lancamento #input-link-ref-new.has-items {
  background: #e3e3e3 !important;
  color: #111111 !important;
}
/* Anexo: visual preenchido quando há arquivo ou url salva */
#form-lancamento .file-upload-wrapper.has-file {
  background: #e3e3e3 !important;
}
#form-lancamento .file-upload-wrapper.has-file #file-name-display {
  color: #111111 !important;
}
/* Botão Limpar: alinhamento preciso com conteúdo do form (mesmo eixo direito do Status F) */
#btn-limpar-lancamento {
  display: flex !important;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px !important;
  margin-right: 12px;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ===== TOAST UNDO (UX1) ===== */
.toast-undo {
  position: fixed;
  bottom: calc(62px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  padding: 11px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7);
  z-index: 9999;
  max-width: 420px;
  width: 92%;
  animation: fade 0.22s;
  box-sizing: border-box;
}
.toast-undo-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter 0.15s;
}
.toast-undo-btn:hover { filter: brightness(1.15); }

/* ── FILTRO RÁPIDO "ABERTO" ── */
#btn-filtro-aberto {
  background: #2a2a2a;
  color: var(--text2);
  border-color: #3a3a3a;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#btn-filtro-aberto.ativo {
  background: #7f1d1d;
  color: #fff;
  border-color: var(--red);
}

/* ── CARD "EM ABERTO" (home) ── */
.card-em-aberto {
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius);
  padding: 8px 12px;
  width: 100%;
  margin: 12px 0 0;
  box-sizing: border-box;
}
.card-em-aberto-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.card-em-aberto-body {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}
#valor-em-aberto {
  font-size: 20px;
  line-height: 1.2;
  white-space: nowrap;
  font-weight: 800;
  flex-shrink: 0;
}
.card-em-aberto-label {
  font-size: 10px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card-em-aberto select {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  color: var(--text2);
  border-radius: 8px;
  font-size: 10px;
  padding: 3px 6px;
  font-family: inherit;
  cursor: pointer;
  max-width: 120px;
}

/* ── MODAL PARCELAMENTO — z-index acima do modal-lancamento ── */
#modal-parcelamento { z-index: 200; }

/* ── MODAL CONFIRMAÇÃO CENTRAL — z-index acima de tudo ── */
#modal-cp-confirm { z-index: 300; }

/* ── MODAL CENTRAL DE PARCELAMENTOS — altura compacta ── */
/* height definitivo (não só max-height) permite que flex:1 funcione no body */
#cp-modal-content {
  height: 65vh;
  max-height: 65vh;
  padding: 10px 14px 0;
}
#cp-modal-content .modal-header {
  margin-bottom: 5px;
}
#central-parc-body {
  flex: 1;
  min-height: 0;        /* essencial: permite que flex:1 comprima corretamente */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 4px 0;
}

/* ── CONTADOR DE DIAS ENTRE PARCELAS (inline no cp-parc-acum via <span>) ── */

/* ── VALIDAÇÃO DE CAMPO — shake + borda de erro ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.input-error {
  border-color: var(--red) !important;
  animation: shake 0.35s ease;
}

/* ── BADGE DE PARCELAMENTO (pill abaixo do campo Valor) ── */
.badge-parcelamento {
  font-size: 10px;
  color: #4ade80;
  margin-top: 4px;
  padding: 3px 10px 3px 8px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.25);
  border-radius: 20px;
  width: fit-content;
  font-weight: 600;
  letter-spacing: 0.2px;
  display: none; /* controlado por JS */
}

/* ── CAMPOS COM SETA FIXA (datalist / autocomplete) ── */
.field-autocomplete {
  position: relative;
  display: block;
}
.field-autocomplete::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  pointer-events: none;
  font-size: 13px;
  line-height: 1;
}
.field-autocomplete input {
  padding-right: 26px !important;
  width: 100%;
  box-sizing: border-box;
}

/* ── BOTÕES TIPO-CONFIG (modal Configurações do APP) ── */
.tipo-config-btn {
  flex: 1;
  font-size: 10px;
  padding: 8px 0;
  border: 1px solid #2c2c2c;
  background: #1c1c1c;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tipo-config-btn.active[data-tipo-config="receita"]       { background: #064e3b; border-color: #10b981; color: #fff; }
.tipo-config-btn.active[data-tipo-config="despesa"]       { background: #7f1d1d; border-color: #ef4444; color: #fff; }
.tipo-config-btn.active[data-tipo-config="transferencia"] { background: #004d80; border-color: #00b7ff; color: #fff; }

/* ══════════════════════════════════════════════════════════════
   CENTRAL DE PARCELAMENTOS
   ══════════════════════════════════════════════════════════════ */

/* Cabeçalho do grupo */
.cp-header {
  background: rgba(0,183,255,0.06);
  border: 1px solid rgba(0,183,255,0.18);
  border-radius: 10px;
  padding: 5px 8px;
  margin-bottom: 5px;
}
.cp-header-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent2);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.cp-meta-blocks {
  display: flex;
  gap: 0;
}
.cp-meta-block {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 6px;
}
.cp-meta-block:first-child { padding-left: 0; }
.cp-meta-block:last-child  { padding-right: 0; }
.cp-meta-block:not(:last-child) {
  border-right: 1px solid rgba(255,255,255,0.07);
}
.cp-meta-item {
  font-size: 10px;
  color: var(--text2);
  line-height: 1.3;
}
.cp-meta-item strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  font-size: 10px;
}

/* Stats rápidos */
.cp-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-bottom: 5px;
}
.cp-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 3px 4px;
  text-align: center;
}
.cp-stat-label {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: 0.3px;
  margin-bottom: 0;
}
.cp-stat-value {
  font-size: 11px;
  font-weight: 800;
}
.cp-stat-value.green { color: var(--green); }
.cp-stat-value.red   { color: var(--red); }
.cp-stat-value.blue  { color: var(--accent2); }
.cp-stat-value.yellow { color: #facc15; }

/* Seções internas */
.cp-section {
  margin-bottom: 6px;
}
.cp-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent2);
  letter-spacing: 0.5px;
  margin-bottom: 3px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}

/* Lista de parcelas — sem scroll próprio; body do modal é a área de scroll */
.cp-parcelas-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cp-parcela-row {
  display: block;
  padding: 4px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
  transition: filter 0.1s;
  user-select: none;
  margin-bottom: 2px;
}
.cp-parcela-row:hover { filter: brightness(1.12); }
.cp-parcela-row.st-F  { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.25); }
.cp-parcela-row.st-C  { background: rgba(250,233,0,0.12); border-color: rgba(250,233,0,0.3); }
.cp-parcela-row.st-A  { background: rgba(194,194,194,0.08); }
.cp-parcela-row.st-P  { background: rgba(0,183,255,0.05); border: 1px dashed rgba(0,183,255,0.25); }
.cp-parcela-row.overdue { border-color: rgba(239,68,68,0.4); }
.cp-parc-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-align: center;
  line-height: 1;
}
/* linha única: data · acum | +Nd ⏱️ */
.cp-parc-info {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  min-width: 0;
  line-height: 1;
}
.cp-parc-data {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}
.cp-parc-acum {
  font-size: 9px;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.cp-parc-diff {
  font-size: 8px;
  color: var(--text2);
  opacity: 0.55;
  white-space: nowrap;
  flex-shrink: 0;
}
.cp-parc-valor {
  font-size: 11px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  line-height: 1;
}
.cp-parc-valor.red   { color: var(--red); }
.cp-parc-valor.green { color: var(--green); }
.cp-parc-valor.blue  { color: var(--accent2); }
.cp-parc-status {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--text2);
  line-height: 1;
}
.cp-parc-flags {
  font-size: 10px;
  text-align: center;
  line-height: 1;
}

/* Resumo financeiro */
.cp-resumo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.cp-resumo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
}
.cp-resumo-label { color: var(--text2); }
.cp-resumo-value { font-weight: 700; }

/* Auditoria */
.cp-audit-ok {
  font-size: 11px;
  color: var(--green);
  padding: 4px 8px;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 7px;
  text-align: center;
}
.cp-audit-item {
  font-size: 11px;
  color: #ff9966;
  padding: 4px 8px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 7px;
  margin-bottom: 3px;
}

/* Ações */
.cp-acoes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}
.cp-acoes .btn {
  width: 100%;
  text-align: left;
  font-size: 12px;
  padding: 7px 10px;
  justify-content: flex-start;
}
.cp-btn-danger {
  background: #2a1515 !important;
  color: #ff8a8a !important;
  border-color: rgba(239,68,68,0.3) !important;
}
.cp-btn-danger:hover { filter: brightness(1.2); }

/* Histórico placeholder */
.cp-historico-placeholder {
  font-size: 10px;
  color: var(--text2);
  padding: 5px 8px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 7px;
  background: rgba(255,255,255,0.02);
}

/* Divergência financeira */
.cp-divergencia {
  font-size: 11px;
  color: #facc15;
  padding: 4px 8px;
  background: rgba(250,204,21,0.08);
  border: 1px solid rgba(250,204,21,0.25);
  border-radius: 7px;
  margin-bottom: 5px;
  text-align: center;
}

/* ── AUTH SCREEN ─────────────────────────────────────── */
.auth-screen{display:flex;align-items:center;justify-content:center;min-height:100vh;background:var(--bg);padding:20px;}
.auth-box{width:100%;max-width:360px;padding:32px 24px;background:var(--surface);border-radius:var(--radius);border:1px solid var(--border);}
.auth-logo{text-align:center;margin-bottom:8px;}
.auth-label{display:block;font-size:12px;color:var(--text2);margin-bottom:12px;font-weight:600;}
.auth-label input{display:block;width:100%;margin-top:4px;padding:10px 12px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:8px;font-size:14px;box-sizing:border-box;}
.auth-label input:focus{outline:none;border-color:var(--accent2);}
.auth-btn-primary{display:block;width:100%;padding:12px;margin-top:16px;background:var(--accent);color:#fff;border:none;border-radius:8px;font-size:14px;font-weight:700;cursor:pointer;}
.auth-btn-primary:hover{opacity:.9;}
.auth-btn-primary:disabled{opacity:.5;cursor:not-allowed;}
.auth-btn-link{display:block;width:100%;background:none;border:none;color:var(--accent2);font-size:12px;cursor:pointer;padding:6px 0;text-align:center;}
.auth-msg{padding:10px;border-radius:8px;font-size:12px;text-align:center;margin-bottom:12px;}
.auth-msg-error{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.3);color:#ff6b6b;}
.auth-msg-success{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.3);color:#22c55e;}

/* ── ADMIN ─────────────────────────────────────────────────────────────────── */
.adm-list{display:flex;flex-direction:column;gap:10px;}
.adm-card{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:12px 14px;display:flex;flex-direction:column;gap:8px;}
.adm-card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;}
.adm-card-info{flex:1;min-width:0;}
.adm-card-name{font-size:14px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.adm-card-email{font-size:12px;color:var(--text2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.adm-card-meta{display:flex;gap:16px;font-size:11px;color:var(--text2);}
.adm-card-actions{display:flex;gap:6px;flex-wrap:wrap;}
.adm-role-badge{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.5px;padding:3px 8px;border-radius:6px;background:rgba(255,255,255,.06);color:var(--text2);white-space:nowrap;}
.adm-role-admin{background:rgba(245,158,11,.15);color:#f59e0b;}
.adm-card-pending{border-color:rgba(239,68,68,.3);background:rgba(239,68,68,.03);}
.adm-btn{background:none;border:1px solid #3f3f46;border-radius:6px;color:var(--text2);padding:4px 8px;font-size:13px;cursor:pointer;margin-right:2px;}
.adm-btn:hover{background:rgba(255,255,255,.08);}
.adm-btn-danger{border-color:rgba(239,68,68,.4);color:#ef4444;}
.adm-btn-danger:hover{background:rgba(239,68,68,.1);}
.adm-btn-export{border-color:rgba(34,197,94,.4);color:#22c55e;}
.adm-btn-export:hover{background:rgba(34,197,94,.1);}
.adm-msg{padding:8px;border-radius:6px;font-size:12px;text-align:center;}
.adm-msg-error{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.3);color:#ff6b6b;}
.adm-msg-success{background:rgba(34,197,94,0.1);border:1px solid rgba(34,197,94,0.3);color:#22c55e;}
