:root{
  --bg:#f6f8f5;
  --ruled-line: rgba(22,33,28,0.05);
  --surface:#ffffff;
  --surface-2:#eef2ec;
  --border:#dde3d8;
  --text-primary:#16211c;
  --text-secondary:#4d5a53;
  --text-muted:#8a968f;
  --accent:#1f6f5c;
  --accent-strong:#155447;
  --accent-soft:#e3f0ec;
  --positive:#0ca30c;
  --negative:#d03b3b;
  --warn:#c17f0a;
  --series-entrada:#2a78d6;
  --series-saida:#eb6834;
  --shadow:0 1px 2px rgba(22,33,28,0.07), 0 6px 16px rgba(22,33,28,0.06);
  --radius-sm:8px;
  --radius-md:14px;
  --font-display:'Sora', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:'IBM Plex Mono', ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0d1310;
    --ruled-line: rgba(243,246,242,0.05);
    --surface:#141b18;
    --surface-2:#1a2320;
    --border:#263029;
    --text-primary:#f3f6f2;
    --text-secondary:#b7c2ba;
    --text-muted:#7c8b82;
    --accent:#35a68c;
    --accent-strong:#4fc2a6;
    --accent-soft:rgba(53,166,140,0.18);
    --warn:#dba33a;
    --series-entrada:#3987e5;
    --series-saida:#d95926;
    --shadow:0 1px 2px rgba(0,0,0,0.45), 0 6px 20px rgba(0,0,0,0.35);
    color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0d1310; --ruled-line: rgba(243,246,242,0.05); --surface:#141b18; --surface-2:#1a2320;
  --border:#263029; --text-primary:#f3f6f2; --text-secondary:#b7c2ba; --text-muted:#7c8b82;
  --accent:#35a68c; --accent-strong:#4fc2a6; --accent-soft:rgba(53,166,140,0.18); --warn:#dba33a;
  --series-entrada:#3987e5; --series-saida:#d95926;
  --shadow:0 1px 2px rgba(0,0,0,0.45), 0 6px 20px rgba(0,0,0,0.35);
  color-scheme:dark;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0; background:var(--bg);
  background-image: repeating-linear-gradient(to bottom, transparent, transparent 27px, var(--ruled-line) 28px);
  color:var(--text-primary); font-family:var(--font-display);
  padding-inline:16px; padding-block:20px 48px; min-height:100vh;
}
h1,h2,h3{ font-family:var(--font-display); margin:0; text-wrap:balance; }
button{ font-family:inherit; }
input{ font-family:var(--font-mono); }
a{ color:var(--accent); }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* ---- auth pages (login/registro/reset) ---- */
.auth-wrap{ max-width:380px; margin:8vh auto 0; display:flex; flex-direction:column; gap:20px; }
.auth-brand{ display:flex; align-items:center; gap:12px; }
.auth-brand .mark{
  width:44px; height:44px; border-radius:var(--radius-sm); background:var(--accent-soft);
  display:flex; align-items:center; justify-content:center; font-size:22px; flex:none;
}
.auth-brand h1{ font-size:1.3rem; font-weight:700; }
.auth-brand p{ margin:2px 0 0; font-size:0.82rem; color:var(--text-secondary); }
.auth-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  box-shadow:var(--shadow); padding:24px; display:flex; flex-direction:column; gap:14px;
}
.field{ display:flex; flex-direction:column; gap:6px; }
.field label{ font-size:0.8rem; color:var(--text-secondary); font-weight:600; }
.field input{
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px 12px;
  background:var(--bg); color:var(--text-primary); font-size:0.95rem;
}
.field input:focus{ border-color:var(--accent); outline:none; }
.btn-primary{
  background:var(--accent); border:1px solid var(--accent); color:#fff; font-weight:600;
  padding:11px 16px; border-radius:999px; cursor:pointer; font-size:0.95rem;
}
.btn-primary:hover{ background:var(--accent-strong); }
.auth-error{
  background:rgba(208,59,59,0.1); border:1px solid var(--negative); color:var(--negative);
  padding:10px 12px; border-radius:var(--radius-sm); font-size:0.85rem;
}
.auth-success{
  background:rgba(12,163,12,0.1); border:1px solid var(--positive); color:var(--positive);
  padding:10px 12px; border-radius:var(--radius-sm); font-size:0.85rem;
}
.auth-links{ display:flex; justify-content:space-between; font-size:0.82rem; }
.hint{ font-size:0.75rem; color:var(--text-muted); }

/* ---- app principal (index.php) ---- */
.app{ max-width:920px; margin:0 auto; display:flex; flex-direction:column; gap:20px; }

.topbar{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.brand{ display:flex; align-items:center; gap:12px; }
.brand-mark{
  width:44px; height:44px; border-radius:var(--radius-sm);
  background:var(--accent-soft); display:flex; align-items:center; justify-content:center;
  font-size:22px; flex:none;
}
.brand h1{ font-size:1.35rem; font-weight:700; color:var(--text-primary); }
.brand-sub{ margin:2px 0 0; font-size:0.82rem; color:var(--text-secondary); }
.topbar-right{ display:flex; flex-direction:column; align-items:flex-end; gap:4px; }
.save-status{ font-size:0.78rem; color:var(--text-muted); min-height:1.2em; text-align:right; }
.save-status.status-saving{ color:var(--text-secondary); }
.save-status.status-saved{ color:var(--positive); }
.save-status.status-error{ color:var(--negative); font-weight:600; }
.save-status.status-offline{ color:var(--negative); font-weight:600; }
.user-row{ display:flex; align-items:center; gap:10px; font-size:0.82rem; color:var(--text-secondary); }
.user-row a{ color:var(--text-muted); text-decoration:none; }
.user-row a:hover{ color:var(--negative); text-decoration:underline; }
.theme-toggle-btn{
  background:none; border:1px solid var(--border); color:var(--text-secondary);
  width:30px; height:30px; border-radius:50%; cursor:pointer; font-size:0.95rem;
  display:flex; align-items:center; justify-content:center; padding:0; flex:none;
}
.theme-toggle-btn:hover{ border-color:var(--accent); color:var(--text-primary); }

.control-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }

.year-switcher{ display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
.year-pill, .month-pill, .toggle-btn{
  border:1px solid var(--border);
  background:var(--surface-2);
  color:var(--text-secondary);
  padding:7px 14px;
  border-radius:999px;
  font-size:0.85rem;
  font-weight:600;
  cursor:pointer;
  white-space:nowrap;
  transition:background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.year-pill:hover, .month-pill:hover, .toggle-btn:hover{ border-color:var(--accent); color:var(--text-primary); }
.year-pill.active, .month-pill.active, .toggle-btn.active{
  background:var(--accent); border-color:var(--accent); color:#ffffff;
}
.year-pill.add-year{ font-weight:700; padding:7px 12px; }

.view-toggle{ display:flex; gap:6px; background:var(--surface-2); padding:4px; border-radius:999px; border:1px solid var(--border); }
.view-toggle .toggle-btn{ background:transparent; border:none; }
.view-toggle .toggle-btn.active{ background:var(--accent); color:#fff; }

.month-pills{ display:flex; gap:6px; overflow-x:auto; padding-bottom:4px; margin-bottom:2px; }

.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(148px, 1fr)); gap:10px; }
.stat-tile{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  padding:12px 14px; box-shadow:var(--shadow); border-top:3px solid var(--border);
  display:flex; flex-direction:column; gap:4px;
}
.stat-tile.tone-positive{ border-top-color:var(--positive); }
.stat-tile.tone-negative{ border-top-color:var(--negative); }
.stat-label{ font-size:0.72rem; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-muted); font-weight:600; }
.stat-value{ font-family:var(--font-mono); font-size:1.15rem; font-weight:600; font-variant-numeric:tabular-nums; }
.stat-tile.tone-positive .stat-value{ color:var(--positive); }
.stat-tile.tone-negative .stat-value{ color:var(--negative); }

.table-wrap{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  box-shadow:var(--shadow); overflow-x:auto;
}
table{ border-collapse:collapse; width:100%; min-width:520px; }
thead th{
  position:sticky; top:0; background:var(--surface-2); color:var(--text-muted);
  font-size:0.72rem; text-transform:uppercase; letter-spacing:0.04em; font-weight:600;
  text-align:right; padding:10px 12px; border-bottom:1px solid var(--border);
}
thead th:first-child{ text-align:left; }
tbody td, tfoot td{
  padding:6px 12px; border-bottom:1px solid var(--border); text-align:right;
  font-family:var(--font-mono); font-size:0.88rem; font-variant-numeric:tabular-nums;
}
tbody tr:last-child td{ border-bottom:none; }
tbody td.col-day{ text-align:left; color:var(--text-muted); font-weight:600; width:44px; }
td.col-saldo{ font-weight:600; }
td.col-saldo.neg{ color:var(--negative); }
td.num.neg{ color:var(--negative); }
tfoot td{ font-weight:700; background:var(--surface-2); border-bottom:none; border-top:1px solid var(--border); }
.cell-input{
  width:100%; min-width:80px; text-align:right; border:none; border-bottom:1px solid transparent;
  background:transparent; color:var(--text-primary); padding:4px 2px; font-size:0.88rem;
  font-variant-numeric:tabular-nums;
}
.cell-input:hover{ border-bottom-color:var(--border); }
.cell-input:focus{ border-bottom-color:var(--accent); outline:none; }
.cell-input::placeholder{ color:var(--text-muted); }
.cell-input-auto{ color:var(--text-secondary); font-style:italic; }
td:first-child.econ-month{ text-align:left; font-weight:600; }

.cell-wrap{ position:relative; width:100%; min-width:80px; }
.cell-wrap .cell-input{ padding-right:18px; }
.cell-clear{
  position:absolute; right:0; top:50%; transform:translateY(-50%);
  background:none; border:none; color:var(--text-muted); cursor:pointer;
  font-size:0.8rem; line-height:1; padding:2px 4px; border-radius:4px; opacity:0.4;
}
.cell-clear:hover{ opacity:1; color:var(--negative); background:rgba(208,59,59,0.1); }

.chart-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  padding:16px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:10px;
}
.chart-legend{ display:flex; gap:16px; flex-wrap:wrap; font-size:0.8rem; color:var(--text-secondary); }
.legend-item{ display:flex; align-items:center; gap:6px; }
.legend-swatch{ width:10px; height:10px; border-radius:2px; display:inline-block; }
.chart-container svg{ width:100%; height:auto; display:block; }
.bar{ cursor:pointer; }
.bar-entrada{ fill:var(--series-entrada); }
.bar-saida{ fill:var(--series-saida); }
.grid-line{ stroke:var(--border); stroke-width:1; }
.axis-baseline{ stroke:var(--text-muted); stroke-width:1; }
.axis-label{ fill:var(--text-muted); font-size:10px; font-family:var(--font-mono); }

.settings-bar{ display:flex; flex-direction:column; align-items:flex-start; gap:10px; }
.ghost-btn{
  background:none; border:1px solid var(--border); color:var(--text-secondary);
  padding:7px 14px; border-radius:999px; font-size:0.82rem; font-weight:600; cursor:pointer;
}
.ghost-btn:hover{ border-color:var(--accent); color:var(--text-primary); }
.primary-btn{
  background:var(--accent); border:1px solid var(--accent); color:#fff;
  padding:7px 14px; border-radius:999px; font-size:0.82rem; font-weight:600; cursor:pointer;
}
.primary-btn:hover{ background:var(--accent-strong); }
#settingsPanel{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  padding:12px 16px; box-shadow:var(--shadow); font-size:0.85rem; color:var(--text-secondary);
}
#settingsPanel:not([hidden]){ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
#settingsPanel label{ display:flex; align-items:center; gap:8px; }
#saldoInicialInput{
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 10px;
  background:var(--bg); color:var(--text-primary); width:140px; text-align:right;
}

.popover{
  position:fixed; z-index:50; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-md); box-shadow:var(--shadow); padding:14px; width:220px;
  max-height:calc(100vh - 24px); overflow-y:auto;
}
.popover:not([hidden]){ display:flex; flex-direction:column; gap:10px; }
.popover-label{ display:flex; flex-direction:column; gap:4px; font-size:0.78rem; color:var(--text-secondary); }
.popover-label input{
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-mono);
}
.popover-actions{ display:flex; justify-content:flex-end; gap:8px; }

.tooltip{
  position:fixed; z-index:60; background:var(--text-primary); color:var(--bg);
  padding:5px 9px; border-radius:6px; font-size:0.75rem; font-family:var(--font-mono);
  pointer-events:none; white-space:nowrap; box-shadow:var(--shadow);
}

.loading-note{ text-align:center; color:var(--text-muted); font-size:0.85rem; padding:24px; }

/* ---- investimentos (caixinhas) ---- */
.invest-toolbar{ display:flex; justify-content:flex-end; margin-bottom:14px; }
#addCaixinhaPopover{ width:260px; }
.caixinhas-grid{ display:flex; flex-direction:column; gap:18px; }
.banco-group{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  box-shadow:var(--shadow); padding:14px 16px;
}
.banco-header{
  display:flex; align-items:center; gap:8px; font-weight:700; font-size:0.92rem;
  color:var(--text-primary); margin-bottom:12px;
}
.banco-dot{ width:10px; height:10px; border-radius:50%; flex:none; }
.banco-cards{ display:grid; grid-template-columns:repeat(auto-fill, minmax(180px, 1fr)); gap:10px; }
.caixinha-card{
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:10px 12px; display:flex; flex-direction:column; gap:6px;
}
.caixinha-top{ display:flex; align-items:center; justify-content:space-between; gap:6px; }
.caixinha-nome{ font-size:0.82rem; font-weight:600; color:var(--text-secondary); }
.caixinha-del{
  background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:0.85rem;
  line-height:1; padding:2px 4px; border-radius:4px; flex:none;
}
.caixinha-del:hover{ color:var(--negative); background:rgba(208,59,59,0.1); }
.caixinha-saldo{
  font-family:var(--font-mono); font-size:1.05rem; font-weight:700; color:var(--text-primary);
  border:none; border-bottom:1px solid transparent; background:transparent; padding:2px 0;
  text-align:left; width:100%;
}
.caixinha-saldo:hover{ border-bottom-color:var(--border); }
.caixinha-saldo:focus{ border-bottom-color:var(--accent); outline:none; }
.caixinha-import-btn{ align-self:flex-start; padding:4px 10px; font-size:0.72rem; }

@media (max-width:520px){
  .banco-cards{ grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width:520px){
  .brand h1{ font-size:1.15rem; }
  .stat-value{ font-size:1rem; }
  table{ min-width:460px; }
}

/* ---- conciliação de extrato ---- */
.extrato-panel{
  margin-top:18px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-md); box-shadow:var(--shadow); padding:14px 16px;
}
.extrato-header{
  display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
  margin-bottom:8px;
}
.extrato-title{ font-weight:700; font-size:0.92rem; color:var(--text-primary); }
.extrato-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.extrato-del:hover{ color:var(--negative); }
.extrato-meta{ font-size:0.78rem; color:var(--text-muted); margin:0 0 10px; }
.extrato-warning{
  font-size:0.78rem; color:#9a6b00; background:rgba(245,166,35,0.12);
  border-radius:var(--radius-sm); padding:6px 10px; margin:0 0 10px;
}
.extrato-table th, .extrato-table td{ text-align:right; }
.extrato-table th:first-child, .extrato-table td:first-child{ text-align:left; }
.extrato-table th:nth-child(6), .extrato-table td:nth-child(6){ text-align:left; }
.extrato-table th.col-desc, .extrato-table td.col-desc{ text-align:left; }
tr.extrato-row-mismatch{ background:rgba(208,59,59,0.08); }
.extrato-ok-tag{ color:var(--positive); font-size:0.78rem; }
.extrato-diff-tag{ color:var(--negative); font-size:0.78rem; }

#importExtratoPopover{ width:340px; }
.popover-tabs{ display:flex; gap:6px; }
.popover-tab{
  flex:1; border:1px solid var(--border); background:var(--bg); color:var(--text-secondary);
  border-radius:var(--radius-sm); padding:6px 8px; font-size:0.78rem; cursor:pointer;
}
.popover-tab.active{ background:var(--accent); border-color:var(--accent); color:#fff; }
.popover-hint{ font-size:0.76rem; color:var(--text-muted); margin:0; }
.popover-error{ font-size:0.78rem; color:var(--negative); margin:0; }
#extratoTabTexto textarea{
  width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-mono); font-size:0.8rem;
  resize:vertical;
}
#extratoFileInput{ font-size:0.8rem; color:var(--text-secondary); }

@media (max-width:520px){
  #importExtratoPopover{ width:min(92vw, 340px); }
}

#importCaixinhaPopover{ width:340px; }
@media (max-width:520px){
  #importCaixinhaPopover{ width:min(92vw, 340px); }
}

/* ---- objetivos (metas financeiras) ---- */
.objetivos-grid{ display:flex; flex-direction:column; gap:14px; }
.objetivo-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  box-shadow:var(--shadow); padding:16px 18px; display:flex; flex-direction:column; gap:8px;
}
.objetivo-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.objetivo-titulo{ font-weight:700; font-size:1rem; color:var(--text-primary); }
.objetivo-actions{ display:flex; align-items:center; gap:6px; flex:none; }
.objetivo-del{
  background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:0.85rem;
  line-height:1; padding:4px 6px; border-radius:4px; flex:none;
}
.objetivo-del:hover{ color:var(--negative); background:rgba(208,59,59,0.1); }
.objetivo-descricao{ font-size:0.85rem; color:var(--text-secondary); line-height:1.5; }
.objetivo-descricao p{ margin:0 0 8px; }
.objetivo-descricao p:last-child{ margin-bottom:0; }
.objetivo-progresso{ display:flex; flex-direction:column; gap:4px; margin-top:4px; }
.objetivo-progresso-bar{
  height:10px; border-radius:999px; background:var(--surface-2); border:1px solid var(--border);
  overflow:hidden;
}
.objetivo-progresso-fill{ height:100%; background:var(--accent); border-radius:999px; transition:width 0.2s ease; }
.objetivo-progresso-label{ font-size:0.78rem; color:var(--text-secondary); font-family:var(--font-mono); }
.objetivo-caixinhas-ligadas{ font-size:0.76rem; color:var(--text-muted); margin:2px 0 0; }

#objetivoPopover{ width:380px; }
#objetivoPopover textarea{
  width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-display); font-size:0.85rem;
  resize:vertical;
}
.objetivo-caixinhas-list{
  display:flex; flex-direction:column; gap:6px; max-height:150px; overflow-y:auto;
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px; background:var(--bg);
}
.objetivo-caixinha-check{
  display:flex; align-items:center; gap:8px; font-size:0.8rem; color:var(--text-secondary);
  font-weight:400;
}
@media (max-width:520px){
  #objetivoPopover{ width:min(92vw, 380px); }
}

/* ---- financiamentos ---- */
.financiamento-card .financiamento-stats{ margin:4px 0 8px; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); }
.financiamento-card .stat-tile{ padding:8px 10px; box-shadow:none; }
.financiamento-card .stat-value{ font-size:0.95rem; }
.financiamento-simular{
  margin-top:10px; padding-top:10px; border-top:1px dashed var(--border);
  display:flex; flex-direction:column; gap:6px;
}
.financiamento-simular-row{ display:flex; gap:8px; align-items:center; }
.financiamento-valor-sim{
  flex:1; border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-mono); font-size:0.85rem;
}
.financiamento-simular-resultado{
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:10px 12px; font-size:0.82rem; color:var(--text-secondary); line-height:1.5;
}
.financiamento-simular-resultado p{ margin:0 0 8px; }
.financiamento-simular-resultado p:last-child{ margin-bottom:0; }
.financiamento-historico{ margin-top:10px; padding-top:8px; border-top:1px dashed var(--border); }
.financiamento-hist-item{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  font-size:0.78rem; color:var(--text-secondary); padding:4px 0;
}
.amortizacao-del{
  background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:0.78rem;
  line-height:1; padding:2px 4px; border-radius:4px; flex:none;
}
.amortizacao-del:hover{ color:var(--negative); background:rgba(208,59,59,0.1); }

#financiamentoPopover{ width:340px; }
#financiamentoPopover textarea{
  width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-display); font-size:0.85rem;
  resize:vertical;
}
#financiamentoPopover input[type="number"], #financiamentoPopover select,
#amortizacaoPopover input[type="number"], #amortizacaoPopover select, #amortizacaoPopover input[type="date"]{
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-mono);
}
#importFinanciamentoPopover{ width:340px; }
#amortizacaoPopover{ width:300px; }
@media (max-width:520px){
  #financiamentoPopover, #importFinanciamentoPopover{ width:min(92vw, 340px); }
  #amortizacaoPopover{ width:min(92vw, 300px); }
}

/* ---- dívidas e empréstimos ---- */
.dividas-resumo{ display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.dividas-resumo .stat-tile{ min-width:150px; }
.dividas-resumo .divida-stat-alert .stat-value{ color:var(--negative); }
.dividas-resumo .divida-stat-warn .stat-value{ color:var(--warn); }

.divida-card .objetivo-top{ flex-wrap:wrap; row-gap:6px; }
.divida-badge{
  font-size:0.7rem; font-weight:700; letter-spacing:0.03em; text-transform:uppercase;
  padding:3px 9px; border-radius:999px; line-height:1.4; flex:none;
}
.divida-badge-em_dia{ background:var(--accent-soft); color:var(--accent-strong); }
.divida-badge-vencendo{ background:rgba(193,127,10,0.15); color:var(--warn); }
.divida-badge-atrasada{ background:rgba(208,59,59,0.14); color:var(--negative); }
.divida-badge-quitada{ background:var(--surface-2); color:var(--text-muted); }
.divida-card.divida-status-quitada{ opacity:0.72; }
.divida-tipo{ margin:0 0 8px; font-size:0.78rem; color:var(--text-secondary); }
.divida-card .financiamento-stats{ margin:4px 0 8px; grid-template-columns:repeat(auto-fit, minmax(120px, 1fr)); }
.divida-card .stat-tile{ padding:8px 10px; box-shadow:none; }
.divida-card .stat-value{ font-size:0.95rem; }
.divida-pag-del{
  background:none; border:none; color:var(--text-muted); cursor:pointer; font-size:0.78rem;
  line-height:1; padding:2px 4px; border-radius:4px; flex:none;
}
.divida-pag-del:hover{ color:var(--negative); background:rgba(208,59,59,0.1); }

#dividaPopover{ width:340px; }
#dividaPopover textarea{
  width:100%; border:1px solid var(--border); border-radius:var(--radius-sm); padding:8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-display); font-size:0.85rem;
  resize:vertical;
}
#dividaPopover select, #dividaPopover input[type="date"],
#pagamentoDividaPopover select, #pagamentoDividaPopover input[type="date"]{
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:6px 8px;
  background:var(--bg); color:var(--text-primary); font-family:var(--font-mono);
}
#pagamentoDividaPopover{ width:300px; }
@media (max-width:520px){
  #dividaPopover{ width:min(92vw, 340px); }
  #pagamentoDividaPopover{ width:min(92vw, 300px); }
}
