/* ========================== BTN BASE (complementa CAIXINHA) ========================== */
.btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.btn-danger { background: rgba(239,68,68,.14); color: #f29188; border-color: rgba(239,68,68,.38); }
.btn.btn-danger:hover { background: rgba(239,68,68,.26); border-color: var(--danger); color: #ffb3ab; }
.btn.btn-sm { padding: 5px 10px; font-size: 12px; }
.filtros-botoes .btn { height: 35px; padding: 0 14px; display: inline-flex; align-items: center; font-size: 13px; }

.chart-header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.chart-range { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; max-width: 100%; }
.chart-range-label { font-size: 11px; color: var(--text-muted); margin-left: 6px; }
.chart-range-label:first-child { margin-left: 0; }
.chart-range button {
  font-size: 11px; padding: 3px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.chart-range button:hover { border-color: var(--accent); color: var(--accent); }
.chart-range button.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.filtros-mais { width: 100%; }
.filtros-mais-toggle {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.filtros-mais-toggle::-webkit-details-marker { display: none; }
.filtros-mais-toggle::before { content: "▸"; font-size: 11px; transition: transform 0.15s; }
.filtros-mais[open] .filtros-mais-toggle::before { transform: rotate(90deg); }
.filtros-mais-toggle:hover { color: var(--text-primary); }

/* ========================== ALERTS ========================== */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-success { background: rgba(34,197,94,.12); color: var(--success); border-color: rgba(34,197,94,.3); }
.alert-error { background: rgba(239,68,68,.12); color: var(--danger); border-color: rgba(239,68,68,.3); }
.alert-warning { background: rgba(245,158,11,.12); color: var(--color-amber); border-color: rgba(245,158,11,.3); }
.alert-info    { background: rgba(59,130,246,.12); color: var(--color-info); border-color: rgba(59,130,246,.3); }

/* Alertas com cores legíveis no tema claro (fundo branco) */
body.light-theme .alert-success { background: rgba(22,163,74,.10);  color: #15803d; border-color: rgba(22,163,74,.3); }
body.light-theme .alert-error   { background: rgba(220,38,38,.10);  color: var(--color-negative); border-color: rgba(220,38,38,.3); }
body.light-theme .alert-warning { background: rgba(202,138,4,.10);  color: #b45309; border-color: rgba(202,138,4,.3); }
body.light-theme .alert-info    { background: rgba(37,99,235,.10);  color: #1d4ed8; border-color: rgba(37,99,235,.3); }

/* ========================== FORMULÁRIOS ========================== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 28px;
  max-width: 680px;
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.form-group {
  margin-bottom: 16px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

@media (max-width: 480px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring-color);
}

.form-control-color {
  height: 38px;
  padding: 2px 4px;
  cursor: pointer;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-check-label {
  font-size: 13px;
  color: var(--text-primary);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.form-errors {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--danger);
}

.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* ========================== CARDS ESTATÍSTICAS ========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
  white-space: normal;
  line-height: 1.3;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  white-space: nowrap;
}

.stat-value.green { color: var(--success); }
.stat-value.red   { color: var(--danger); }
.stat-value.accent { color: var(--accent); }

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Ícone e layout interno dos stat-cards — mais compactos */
.stat-card > div { gap: 10px !important; }
.stat-card .icon-badge-lg {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.stat-card .icon-badge-lg i,
.stat-card .icon-badge-lg img {
  width: 18px !important;
  height: 18px !important;
}

/* Content div inside stat-card must shrink in flex layout and not overflow */
.stat-card > div > div {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

/* ========================== CHARTS ========================== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid  { grid-template-columns: 1fr 1fr; }
}

.chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 18px;
}

.chart-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
}

/* ========================== FILTROS MÊS ========================== */
.mes-filtro {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 12px 16px;
}

.mes-filtro label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.mes-filtro select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
}

/* ========================== ICON BADGE ========================== */
.icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.icon-badge-xs { width: 18px; height: 18px; border-radius: var(--radius-xs); }
.icon-badge-sm { width: 20px; height: 20px; border-radius: var(--radius-xs); }
.icon-badge-md { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.icon-badge-lg { width: 44px; height: 44px; border-radius: var(--radius-md); }

/* ========================== BADGES ========================== */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-avista       { background: rgba(96,165,250,.15);   color: #60a5fa; }
.badge-parcelado    { background: rgba(251,146,60,.15);   color: #fb923c; }
.badge-pix          { background: rgba(6,182,212,.15);    color: var(--color-cyan); }
.badge-debito       { background: rgba(139,92,246,.15);   color: #8b5cf6; }

.badge-recorrente   { background: rgba(168,85,247,.15);   color: var(--color-purple); }
.badge-ajuste       { background: rgba(20,184,166,.15);   color: #14b8a6; }
.badge-salario      { background: rgba(34,197,94,.15);    color: var(--color-positive); }
.badge-bonus        { background: rgba(96,165,250,.15);   color: #60a5fa; }
.badge-outro        { background: rgba(139,92,246,.15);   color: var(--color-violet-soft); }
.badge-success      { background: rgba(34,197,94,.15);    color: var(--success); }
.badge-danger       { background: rgba(239,68,68,.15);    color: var(--danger); }

/* Selo de fatura já paga no mês (card da lista de Cartões) */
.cc-badge-paga {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(34,197,94,.25);
  border: 1px solid rgba(74,222,128,.55);
  color: #dcfce7;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  margin-bottom: 4px;
}
.cc-badge-paga i { width: 10px; height: 10px; }

/* Badge de cartão: dark = texto branco, light = usa cor do cartão (inline) */


/* ========================== SORTING DE COLUNAS ========================== */
.tabela-dados th { cursor: pointer; user-select: none; }
.tabela-dados th:last-child { cursor: default; }
.tabela-dados th.sort-asc::after  { content: " ↑"; font-size: 11px; opacity: .7; }
.tabela-dados th.sort-desc::after { content: " ↓"; font-size: 11px; opacity: .7; }
.tabela-dados th:hover { color: var(--accent); }
.tabela-dados th:last-child:hover { color: inherit; }

/* ========================== GRIDS RESPONSIVOS DO DASHBOARD ========================== */
.dash-duo-grid   { display: grid; grid-template-columns: 1fr 1fr; }
.dash-penta-grid { display: grid; grid-template-columns: repeat(4, 1fr); }

/* impede que filhos de grid bloqueiem o overflow-x das tabelas/gráficos internos.
   min-width:0 anula o min-width:auto padrão de itens de grid — sem ele, o <canvas>
   (300px intrínsecos) impede o card de encolher e estoura o layout no mobile. */
.dash-duo-grid > *,
.dash-penta-grid > *,
.charts-grid > * { min-width: 0; }

/* Canvas de gráfico nunca ultrapassa o card (Chart.js redesenha ao encolher) */
.chart-box canvas { max-width: 100%; }

/* Notebook (≤1500px): ícone compacto + topo-alinhado; cards ficam ~290px → label pode quebrar */
@media (max-width: 1500px) {
  .stat-value      { font-size: 16px; }
  .stat-card       { padding: 12px 14px; }
  .stat-card > div { align-items: flex-start !important; gap: 8px !important; }
  .stat-card .icon-badge-lg { margin-top: 1px; width: 32px; height: 32px; }
  .stat-card .icon-badge-lg i,
  .stat-card .icon-badge-lg img { width: 16px !important; height: 16px !important; }
  .stat-label      { min-height: 2.6em; }
}

/* Tablet largo (≤1024px): 3 cols; labels podem quebrar → reserva altura */
@media (max-width: 1200px) {
  .dash-penta-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
  .stats-grid      { grid-template-columns: repeat(3, 1fr); }
  .stat-value      { font-size: 16px; }
  .stat-card       { padding: 12px 14px; }
  .stat-card > div { gap: 8px !important; }
  .stat-label      { min-height: 2.6em; }
}

/* Tablet (≤900px): grids de 2 cols empilham; charts empilha */
@media (max-width: 900px) {
  .dash-duo-grid   { grid-template-columns: 1fr; }
  .charts-grid     { grid-template-columns: 1fr !important; }
  .dash-penta-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid      { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile (≤768px): 2 cards por linha, sidebar 54px → mais espaço */
@media (max-width: 768px) {
  .stats-grid       { grid-template-columns: repeat(2, 1fr); }
  .dash-penta-grid  { grid-template-columns: repeat(2, 1fr); }
  .page-header      { flex-wrap: wrap; gap: 8px; }
  .page-header h1   { font-size: 16px; }
  .topbar-btn-text  { display: none; }

  /* Sidebar recolhida → cards bem mais largos → reseta ajustes de alinhamento */
  .stat-label      { min-height: 0; }
  .stat-card > div { align-items: center !important; gap: 10px !important; }
  .stat-card .icon-badge-lg { margin-top: 0; width: 36px; height: 36px; }
  .stat-card .icon-badge-lg i,
  .stat-card .icon-badge-lg img { width: 18px !important; height: 18px !important; }
  .stat-card       { padding: 14px 16px; }
  .stat-value      { font-size: 18px; }

  /* Filtro do dashboard empilha em coluna */
  .mes-filtro {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }
  .mes-filtro > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
  }
  .mes-filtro select { width: 100% !important; min-width: 0 !important; }
  .mes-filtro > div > div { display: flex; gap: 6px; }
  .mes-filtro > div > div select { flex: 1; min-width: 0 !important; }

  /* Filtros-form (gastos/entradas): 2 por linha */
  .filtro-group { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filtro-group select,
  .filtro-group input { width: 100%; min-width: 0; }

  /* Chart header empilha */
  .chart-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .chart-legend { gap: 10px; }
}

/* Gráficos menores no mobile para não ocupar toda a tela */
@media (max-width: 480px) {
  .chart-canvas-h280 { height: 200px !important; }
  .chart-canvas-h220 { height: 180px !important; }
}

/* Mobile pequeno (≤480px): 1 coluna em tudo */
@media (max-width: 480px) {
  .stats-grid      { grid-template-columns: 1fr; }
  .dash-penta-grid { grid-template-columns: 1fr; }

  .filtro-group    { flex: 1 1 100%; }
  .page-header     { flex-direction: column; align-items: flex-start; }
  .topbar-title    { font-size: 12px; }

  .stat-label      { font-size: 11px; }
  .stat-value      { font-size: 17px; }
}

/* ========================== PAGE HEADER ========================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
  max-width: 60ch;
}

/* ========================== SELETOR CATEGORIA (mini-form no modal) ========================== */
.mg-cat-icone-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 2px 5px;
  border-radius: 7px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  gap: 3px;
  transition: border-color .15s, background .15s;
}
.mg-cat-icone-btn svg { width: 16px; height: 16px; stroke: var(--text-muted); transition: stroke .15s; }
.mg-cat-icone-btn:hover { border-color: var(--accent); }
.mg-cat-icone-btn:hover svg { stroke: var(--accent); }
.mg-cat-icone-btn.mg-selecionado { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 15%, transparent); }
.mg-cat-icone-btn.mg-selecionado svg { stroke: var(--accent); }
.mg-cat-icone-btn .mg-icone-label { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.2; pointer-events: none; }

.mg-cat-cor-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 3px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .15s, transform .1s;
}
.mg-cat-cor-swatch:hover { transform: scale(1.15); }
.mg-cat-cor-swatch.mg-selecionada { border-color: var(--text-primary); transform: scale(1.15); }

/* ── Privacidade: esconder valores ─────────────────────────────────────────── */
.btn-privacidade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.btn-privacidade:hover { color: var(--text-primary); border-color: var(--text-muted); }
.btn-privacidade:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-privacidade svg { width: 17px; height: 17px; }
body.valores-ocultos .btn-privacidade { color: var(--accent); border-color: var(--accent); }

.valor-sensivel {
  position: relative;
  transition: -webkit-text-fill-color .15s ease;
}
body.valores-ocultos .valor-sensivel {
  -webkit-text-fill-color: transparent;
  user-select: none;
  pointer-events: none;
}
body.valores-ocultos .valor-sensivel::after {
  content: "R$ ••••••";
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  letter-spacing: .08em;
  -webkit-text-fill-color: currentColor;
  animation: valor-mascara-entra .15s ease;
}
body.valores-ocultos td .valor-sensivel::after { left: auto; right: 0; }

@keyframes valor-mascara-entra {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .valor-sensivel { transition: none; }
  body.valores-ocultos .valor-sensivel::after { animation: none; }
}

/* Telas muito pequenas: mantém só o olho na topbar */
@media (max-width: 360px) {
  .topbar > div:last-child { display: flex; }
  .topbar > div:last-child .btn { display: none; }
}

/* ========================== ANÁLISE (comprometimento, a pagar, anual, recorrências) ========================== */
.analise-grid { align-items: stretch; margin-bottom: 16px; }
.analise-vazio {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; min-height: 120px; padding: 16px; text-align: center;
  font-size: 13px; color: var(--text-muted);
}

.comp-resumo { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--text-secondary, var(--text-muted)); }
.comp-resumo strong { color: var(--text-primary); }
.comp-bar {
  display: flex; gap: 2px; height: 16px; border-radius: 8px; overflow: hidden;
  background: var(--bg-secondary);
}
.comp-seg { display: block; height: 100%; min-width: 0; }
.comp-legenda {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  margin: 14px 0 0; padding: 0;
}
.comp-legenda dt {
  display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px; font-weight: 600;
}
.comp-legenda dd { margin: 4px 0 0; font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }

.pagar-total { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.pagar-total em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--color-negative); margin-left: 6px; }
.pagar-lista { list-style: none; margin: 0; padding: 0; max-height: 268px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pagar-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 10px; min-width: 0;
}
.pagar-item.atrasado { border-color: #ef444466; background: #ef44440d; }
.pagar-icone {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 8px; background: var(--bg-secondary); color: var(--text-muted);
}
.pagar-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pagar-titulo { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pagar-detalhe { font-size: 11px; color: var(--text-muted); }
.pagar-item.atrasado .pagar-detalhe { color: var(--color-negative); }
.pagar-valor { font-size: 13px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.pagar-acao { flex-shrink: 0; min-height: 30px; }

.cat-destaque {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 0 0 10px; font-size: 12px; color: var(--text-muted);
}
.cat-destaque strong { color: var(--text-primary); }
.cat-destaque svg { stroke: #ef4444; }

.anual-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.anual-tabela td.num, .anual-tabela th.num { text-align: right; font-variant-numeric: tabular-nums; }
.anual-melhor { color: var(--color-positive); font-weight: 700; }
.anual-pior { color: var(--color-negative); font-weight: 700; }
.cat-ano-linha { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.cat-ano-barra { height: 8px; border-radius: 4px; background: var(--bg-secondary); overflow: hidden; }
.cat-ano-barra span { display: block; height: 100%; border-radius: 4px; }

@media (max-width: 768px) {
  .comp-legenda { grid-template-columns: 1fr 1fr; }
  .anual-grid { grid-template-columns: 1fr 1fr; }
  .pagar-item { flex-wrap: wrap; }
  .pagar-acao { margin-left: auto; }
}
@media (max-width: 480px) {
  .anual-grid { grid-template-columns: 1fr; }
}


/* ========================== RESPONSIVIDADE (celular, tablet, notebook) ========================== */
/* Tablet (481–900px): filtros do mês em grade de 2 colunas, em vez de uma coluna de selects largos */
@media (min-width: 481px) and (max-width: 900px) {
  .mes-filtro { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
  .mes-filtro > div[style*="margin-left:auto"] { justify-self: end; }
}

/* Cartões de resumo em linha (Atribuídos) têm grid inline: precisa de !important para empilhar */
@media (max-width: 480px) {
  .anual-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 768px) {
  /* "O que falta pagar": título e detalhe ganham largura; valor e Liquidar descem para a linha de baixo */
  .pagar-info { flex: 1 1 150px; }
  .pagar-detalhe { font-size: 12px; }
}

/* Telas de toque (celular e tablet): alvos de 44px sem inflar as tabelas densas */
@media (max-width: 768px), (pointer: coarse) {
  .mes-filtro select, .filtro-group select, .filtro-group input, .chart-header select,
  #modal-pagar-fatura select, #modal-liquidar-pix select { min-height: 44px; font-size: 14px; }
  .btn-sm, .chart-header button { min-height: 40px; }
  td .btn-sm, th .btn-sm { min-height: 0; }
  .pagar-acao { min-height: 44px; }
  .chart-range button { min-height: 36px; min-width: 44px; }
  .anual-tabela th a, .tabela-dados td a:not(.btn) { display: inline-block; padding: 12px 6px; margin: -12px -6px; }
}

/* Celular: texto legível e tabelas enxutas */
@media (max-width: 640px) {
  .stat-label { font-size: 11px; }
  body .badge, body .cc-bandeira-badge { font-size: 11px; }

  /* Tabelas largas: some o que é secundário para a coluna importante (valor, descrição) aparecer sem rolar */
  .tbl-m-contas th:nth-child(2), .tbl-m-contas td:nth-child(2),
  .tbl-m-contas th:nth-child(3), .tbl-m-contas td:nth-child(3),
  .tbl-m-gastos th:nth-child(1), .tbl-m-gastos td:nth-child(1),
  .tbl-m-gastos th:nth-child(5), .tbl-m-gastos td:nth-child(5),
  .tbl-m-gastos th:nth-child(8), .tbl-m-gastos td:nth-child(8),
  .tbl-m-gastos th:nth-child(9), .tbl-m-gastos td:nth-child(9),
  .tbl-m-gastos th:nth-child(10), .tbl-m-gastos td:nth-child(10),
  .tbl-m-gastos th:nth-child(11), .tbl-m-gastos td:nth-child(11),
  .tbl-m-entradas th:nth-child(1), .tbl-m-entradas td:nth-child(1),
  .tbl-m-entradas th:nth-child(3), .tbl-m-entradas td:nth-child(3) { display: none; }
  .tbl-m-contas th, .tbl-m-contas td,
  .tbl-m-gastos th, .tbl-m-gastos td, .tbl-m-entradas th, .tbl-m-entradas td { padding-left: 8px; padding-right: 8px; }
  .tbl-m-gastos th, .tbl-m-gastos td, .tbl-m-entradas th, .tbl-m-entradas td { padding-left: 6px; padding-right: 6px; }
  .tbl-m-gastos td, .tbl-m-entradas td { font-size: 12px; }
  .tbl-m-contas th, .tbl-m-gastos th, .tbl-m-entradas th { white-space: normal; line-height: 1.2; }
  .tbl-m-gastos td[colspan], .tbl-m-entradas td[colspan] { display: table-cell; }
  .tbl-m-gastos tfoot, .tbl-m-entradas tfoot { display: none; }
  .tbl-m-gastos td:nth-child(3), .tbl-m-entradas td:nth-child(4) { white-space: normal; min-width: 96px; }
}

body.light-theme .pagar-item.atrasado .pagar-detalhe,
body.light-theme .pagar-total em { color: #b91c1c; }

/* Tabela com cabeçalho fixo que mostra ~10 linhas e rola */
.tabela-rolavel { max-height: 402px; overflow-y: auto; overscroll-behavior: contain; }
.tabela-rolavel thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-card); }
.tabela-rolavel:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.comp-nota { margin: 12px 0 0; font-size: 11px; color: var(--text-muted); }

/* ========================== INDICADOR DE CARREGAMENTO ========================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.page-loader {
  position: fixed; z-index: 900; top: 0; bottom: 0; left: var(--sidebar-w); right: 0;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  opacity: 0; transition: opacity .18s ease;
}
body.sidebar-collapsed .page-loader { left: var(--sidebar-w-collapsed); }
.page-loader.ativo { opacity: 1; }
.page-loader[hidden] { display: none; }
.loader-dots { position: relative; width: 56px; height: 56px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.45)); }
.loader-dots i {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 8px var(--accent), 0 0 2px rgba(0,0,0,.35);
  transform: rotate(calc(var(--i) * 30deg)) translateY(-22px);
  animation: loader-fade 1.2s linear infinite; animation-delay: calc(var(--i) * -0.1s);
}
@keyframes loader-fade { 0% { opacity: 1; } 100% { opacity: .12; } }
@media (prefers-reduced-motion: reduce) {
  .loader-dots i { animation: none; opacity: calc(0.15 + var(--i) * 0.07); }
}

/* ========================== FOTO DE PERFIL ========================== */
.avatar { display: block; flex-shrink: 0; border-radius: 50%; object-fit: cover; background: var(--bg-secondary); box-shadow: 0 0 0 1px var(--border); }
.avatar-sm { width: 34px; height: 34px; }
.sidebar-icon:has(.avatar-sm) { width: 34px; }
.avatar-md { width: 36px; height: 36px; }
.avatar-xl { width: 96px; height: 96px; }
.avatar-vazio { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.avatar-editor { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.avatar-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.avatar-dica { flex-basis: 100%; font-size: 11px; line-height: 1.4; color: var(--text-muted); }
.avatar-erro { flex-basis: 100%; font-size: 12px; line-height: 1.4; color: var(--danger); }
.avatar-erro[hidden] { display: none; }
.avatar-acoes #pf_avatar {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; opacity: 0;
}
.avatar-acoes label:has(~ #pf_avatar:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 420px) {
  .avatar-editor { flex-direction: column; text-align: center; }
  .avatar-acoes { justify-content: center; }
}

@media (max-width: 768px) { .sidebar-icon:has(.avatar-sm) { width: var(--sidebar-w-collapsed); } }

/* Editor de recorte e avatares prontos */
body.cropper-aberto { overflow: hidden; }
.av-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .65); }
.av-overlay[hidden] { display: none; }
.av-caixa { width: 100%; max-width: 380px; max-height: 94vh; overflow-y: auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: 0 24px 48px rgba(0, 0, 0, .45); }
.av-cab { margin-bottom: 4px; }
.av-titulo { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.av-dica { font-size: 12px; line-height: 1.4; color: var(--text-muted); margin: 4px 0 14px; }
.av-acoes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.av-espaco { flex: 1; }
.cr-palco { position: relative; margin: 0 auto; overflow: hidden; background: #0b0d12; border-radius: 12px; touch-action: none; cursor: grab; user-select: none; }
.cr-palco.arrastando { cursor: grabbing; }
.cr-palco:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cr-palco img { position: absolute; left: 50%; top: 50%; max-width: none; transform-origin: center; pointer-events: none; }
.cr-circulo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .58); border: 2px solid rgba(255, 255, 255, .9); pointer-events: none; }
.cr-zoom { display: flex; align-items: center; gap: 10px; margin: 16px auto 0; max-width: 300px; color: var(--text-muted); }
.cr-zoom input[type=range] { flex: 1; accent-color: var(--accent); min-height: 24px; }
.ap-rolagem { max-height: min(52vh, 420px); overflow-y: auto; padding: 4px 6px 4px 4px; margin: 0 -6px 0 -4px; overscroll-behavior: contain; }
.ap-grade { display: block; }
.ap-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--text-muted); margin: 14px 0 8px; }
.ap-grupo:first-child { margin-top: 2px; }
.ap-subgrade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ap-item { padding: 0; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; aspect-ratio: 1; overflow: hidden; line-height: 0; transition: transform .12s, border-color .12s; }
.ap-item img { width: 100%; height: 100%; border-radius: 50%; display: block; }
.ap-item:hover { transform: scale(1.05); }
.ap-item.ativo { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.ap-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .ap-item { transition: none; } .ap-item:hover { transform: none; } }

@media (max-width: 480px), (pointer: coarse) {
  .av-acoes { gap: 10px; }
  .av-acoes .btn { min-height: 44px; padding-left: 16px; padding-right: 16px; justify-content: center; }
  .av-acoes .av-espaco { flex-basis: 100%; height: 0; }
  #cr-cancelar, #cr-usar, #ap-cancelar, #ap-usar { flex: 1; }
  .cr-zoom input[type=range] { min-height: 36px; }
}

/* Modal de download (Excel / CSV) */
.exp-opcoes { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.exp-opcao { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: var(--text-primary); background: var(--bg-card); transition: border-color .15s, background-color .15s; }
.exp-opcao:hover, .exp-opcao:focus-visible { border-color: var(--accent); background: var(--bg-secondary); outline: none; }
.exp-icone { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; }
.exp-texto { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.exp-texto strong { font-size: 14px; font-weight: 600; }
.exp-texto small { font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.exp-periodo-bloco { margin-top: 16px; }
.exp-rotulo { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.exp-selects { display: flex; gap: 8px; }
.exp-selects select { flex: 1; min-width: 0; }
.exp-filtros { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-secondary, var(--text-muted)); cursor: pointer; }
.exp-filtros input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 640px) { .exp-selects select { min-height: 44px; } .exp-filtros { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .exp-opcao { transition: none; } }

/* ========================== ACESSIBILIDADE E LEITURA ==========================
   Contraste mínimo 4,5:1 nos dois temas, alvos de toque de 44px no celular e
   movimento reduzido respeitado. Cores de estado vêm de tokens.css. */

.skip-link {
  position: fixed; top: -48px; left: 12px; z-index: 1000;
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
  transition: top .15s;
}
.skip-link:focus { top: 12px; }

/* Selos: texto escuro sobre tinta clara (tema claro) e tons mais claros no escuro */
body.light-theme .badge-avista     { color: #1e40af; background: rgba(30,64,175,.09); }
body.light-theme .badge-parcelado  { color: #9a3412; background: rgba(154,52,18,.09); }
body.light-theme .badge-pix        { color: #155e75; background: rgba(21,94,117,.09); }
body.light-theme .badge-debito     { color: #5b21b6; background: rgba(91,33,182,.09); }
body.light-theme .badge-recorrente { color: #6b21a8; background: rgba(107,33,168,.09); }
body.light-theme .badge-ajuste     { color: #115e59; background: rgba(17,94,89,.09); }
body.light-theme .badge-salario,
body.light-theme .badge-success    { color: #166534; background: rgba(22,101,52,.09); }
body.light-theme .badge-bonus      { color: #1e40af; background: rgba(30,64,175,.09); }
body.light-theme .badge-outro      { color: #5b21b6; background: rgba(91,33,182,.09); }
body.light-theme .badge-danger     { color: #991b1b; background: rgba(153,27,27,.09); }
.badge { font-size: 11px; letter-spacing: .3px; }

/* Tema claro: bordas de campo com 3:1 e cartões separados do fundo */
body.light-theme input:not([type=checkbox]):not([type=radio]):not([type=range]),
body.light-theme select,
body.light-theme textarea { border-color: #8f8a80; }
body.light-theme .card,
body.light-theme .tabela-wrapper,
body.light-theme .filtros-form,
body.light-theme .chart-box { border-color: var(--border-strong); }

/* Celular e telas de toque: alvos de 44px */
@media (max-width: 768px), (pointer: coarse) {
  .sidebar-item, .sidebar a, .sidebar button { min-height: 44px; }
  .btn, button.btn, a.btn { min-height: 44px; }
  .btn.btn-sm { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .btn-privacidade { min-width: 44px; min-height: 44px; }
  .chart-range button { min-height: 44px; min-width: 44px; }
  .filtro-group input, .filtro-group select, .form-control, select, input:not([type=checkbox]):not([type=radio]) { min-height: 44px; }
  .pag-btn { min-width: 44px; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

body.light-theme .btn.btn-danger,
body.light-theme .btn-danger { background: rgba(185,28,28,.08); color: var(--color-negative); border-color: rgba(185,28,28,.45); }
body.light-theme .btn.btn-danger:hover,
body.light-theme .btn-danger:hover { background: rgba(185,28,28,.16); border-color: var(--color-negative); color: var(--color-negative-hover); }
.badge[style*="font-size:10px"], .valor-sensivel[style*="font-size:10px"] { font-size: 11px !important; }

/* Selos com cor de estado inline: no tema claro o texto vai para o tom bem escuro da mesma família */
body.light-theme .badge[style*="--color-positive"] { color: #14532d !important; }
body.light-theme .badge[style*="--color-negative"] { color: #7f1d1d !important; }
body.light-theme .badge[style*="--color-amber"]    { color: #78350f !important; }
body.light-theme .badge[style*="--color-purple"]   { color: #581c87 !important; }
body.light-theme .badge[style*="--color-indigo"]   { color: #3730a3 !important; }
body.light-theme .badge[style*="--color-info"]     { color: #1e3a8a !important; }
body.light-theme .badge[style*="--color-cyan"],
body.light-theme .badge[style*="--color-sky"]      { color: #164e63 !important; }

/* Cartão de crédito ilustrado: texto branco sobre a cor escolhida pelo usuário, com sombra leve para qualquer cor */
.cc-nome, .cc-fatura-label, .cc-fatura-valor, .cc-meta, .cc-bandeira-badge { text-shadow: 0 1px 2px rgba(0,0,0,.28); }
.cc-fatura-label { opacity: .92; }

/* Filtros secundários: recolhidos no celular (abre sozinho se algum filtro estiver ativo); inalterados no desktop */
.filtros-mais-corpo { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
@media (min-width: 769px) {
  .filtros-mais, .filtros-mais-corpo { display: contents; }
  .filtros-mais-toggle { display: none; }
}
@media (max-width: 768px) {
  .filtros-mais { flex: 1 1 100%; width: 100%; }
  .filtros-mais-toggle { min-height: 44px; display: flex; align-items: center; }
  .filtros-mais[open] .filtros-mais-corpo { margin-top: 8px; }
}
@media (min-width: 769px) {
  .filtros-mais::details-content { display: contents; }
}
@media (max-width: 768px) {
  .mes-filtro .filtros-mais-corpo { flex-direction: column; align-items: stretch; gap: 8px; }
  .mes-filtro .filtros-mais-corpo > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
}
@media (min-width: 481px) and (max-width: 900px) {
  .mes-filtro .filtros-mais { grid-column: 1 / -1; }
  .mes-filtro .filtros-mais-corpo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: end; }
}

.sidebar-item[hidden], [data-instalar-app][hidden] { display: none; }

/* Barra lateral com a altura da tela: a lista de menu rola por dentro e o rodapé (perfil, tema, instalar, sair) nunca sai da tela */
.sidebar { height: 100vh; height: 100dvh; min-height: 0; }
.sidebar > div[style*="border-top"] { flex-shrink: 0; }

/* Barra lateral que se ajusta à altura da tela: o menu se comprime em degraus (sem barra de rolagem visível).
   A rolagem interna só existe como último recurso em telas muito baixas, e fica invisível. */
.sidebar > div[style*="overflow-y"] { min-height: 0; overflow-y: auto; scrollbar-width: none; }
.sidebar > div[style*="overflow-y"]::-webkit-scrollbar { display: none; }
@media (max-height: 880px) {
  .sidebar-item { padding: 7px 10px; }
  .sidebar-section { padding: 13px 14px 4px; }
}
@media (max-height: 800px) {
  .sidebar-item { padding: 6px 10px; margin: 0 8px; }
  .sidebar-section { padding: 11px 14px 3px; }
  .sidebar-version { display: none; }
}
@media (max-height: 720px) {
  .sidebar-item { padding: 5px 10px; }
  .sidebar-section { padding: 9px 14px 3px; }
}
@media (max-height: 640px) {
  .sidebar-item { padding: 3px 10px; font-size: 11.5px; }
  .sidebar-section { padding: 6px 14px 2px; font-size: 10px; }
  .sidebar > div[style*="border-top"] { padding: 4px 8px !important; }
}
@media (max-height: 560px) {
  .sidebar-section { display: none; }
  .sidebar-item { padding: 2px 10px; }
}

.pwa-dica {
  position: fixed; left: 70px; right: 16px; bottom: 16px; z-index: 400;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-card); color: var(--text-primary); font-size: 14px; line-height: 1.4;
  box-shadow: var(--shadow-xs); cursor: pointer;
}
.pwa-dica[hidden] { display: none; }

/* Aviso de lista vazia e título de seção (usados na importação de fatura) */
.aviso-vazio { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; padding: 18px 20px; border: 1px dashed var(--border); border-radius: var(--radius-md); color: var(--text-muted); }
.aviso-vazio svg { flex: none; width: 28px; height: 28px; margin-top: 2px; }
.aviso-vazio strong { color: var(--text-primary); }
.aviso-vazio p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }
.secao-titulo { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }

/* Importar fatura */
.imp-form { display: grid; gap: 16px; max-width: 560px; padding: 20px; margin-bottom: 24px; }
.imp-campo { display: grid; gap: 6px; }
.imp-campo label { font-size: 13px; font-weight: 600; }
.imp-ajuda { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.imp-formatos { max-width: 720px; }
.imp-formatos ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
.imp-formatos strong { color: var(--text-primary); }
.imp-fatura { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; padding: 8px 14px; }
.imp-opcoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 16px 20px; margin-bottom: 16px; }
.imp-tabela .imp-check { width: 44px; text-align: center; }
.imp-check-label { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -8px 0; cursor: pointer; }
.imp-check-label input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.imp-repetida td { color: var(--text-muted); }
.imp-sem-cat { color: var(--text-muted); }
.imp-acoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.imp-acoes .btn:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 768px), (pointer: coarse) {
  .imp-form .form-control, .imp-opcoes .form-control, .imp-acoes .btn, .imp-form .btn { min-height: 44px; }
  .imp-acoes .btn { flex: 1 1 auto; justify-content: center; }
}


/* Casca padrão dos modais (a visibilidade continua inline: display:none -> flex via JS) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0, 0, 0, 0.55);
  align-items: center; justify-content: center; padding: 24px;
}
.modal-overlay--scroll { align-items: flex-start; padding: 24px 16px; overflow-y: auto; }
.modal-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

/* ========================== NAVEGAÇÃO MOBILE (PWA = layout do app) ==========================
   Só aparece em ≤768px: barra de abas, botão Novo e folhas (Novo / Mais). No desktop a sidebar segue igual. */
.bnav, .bfab, .msheet, .msheet-scrim { display: none; }

@media (max-width: 768px) {
  .sidebar, #sidebar-tooltip { display: none !important; }
  .topbar {
    left: 0; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 16px 0;
  }
  .topbar-title { font-size: 17px; font-weight: 700; max-width: none; }
  .topbar .btn { display: none; }
  .topbar > div:last-child { display: flex !important; gap: 4px !important; }
  .main-content {
    margin-left: 0; padding-left: 16px; padding-right: 16px;
    padding-top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 16px);
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .bnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 190;
    background: var(--bg-secondary); border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .bnav-item {
    position: relative; flex: 1; min-height: 52px; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; border: 0; background: none;
    color: var(--text-muted); font: inherit; font-size: 11px; font-weight: 600; text-decoration: none;
    cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
    transition: opacity .15s ease, color .15s ease;
  }
  .bnav-item svg { width: 24px; height: 24px; stroke-width: 1.9; }
  .bnav-item:active { opacity: .7; }
  .bnav-item.ativa { color: var(--accent); font-weight: 700; }
  .bnav-item.ativa::before {
    content: ""; position: absolute; top: -9px; width: 36px; height: 4px;
    border-radius: 0 0 4px 4px; background: var(--accent);
  }

  .bfab {
    display: flex; align-items: center; justify-content: center; position: fixed; z-index: 195;
    right: 16px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); width: 56px; height: 56px;
    border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent);
    box-shadow: 0 3px 10px rgba(0,0,0,.3); cursor: pointer; touch-action: manipulation;
    transition: transform .15s ease, opacity .15s ease;
  }
  .bfab svg { width: 28px; height: 28px; stroke-width: 2.2; }
  .bfab:active { transform: scale(.94); }

  .msheet-scrim {
    position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.5); opacity: 0; transition: opacity .2s ease; cursor: pointer;
  }
  .msheet-scrim:not([hidden]) { display: block; }
  .msheet-scrim.aberta { opacity: 1; }
  .msheet {
    position: fixed; left: 0; right: 0; bottom: var(--bnav-h, 72px); z-index: 9100;
    max-height: calc(100dvh - var(--bnav-h, 72px) - env(safe-area-inset-top, 0px) - 64px); overflow-y: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch; background: var(--bg-primary);
    border: 1px solid var(--border); border-bottom: 0; border-radius: 16px 16px 0 0;
    padding: 12px 16px 16px;
    transform: translateY(100%); transition: transform .24s cubic-bezier(.16,1,.3,1);
  }
  .msheet:not([hidden]) { display: flex; flex-direction: column; gap: 12px; }
  .msheet.aberta { transform: translateY(0); }
  .msheet > * { flex: none; }
  .msheet-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .msheet-fechar { flex: none; width: 44px; height: 44px; margin-right: -8px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: none; color: var(--text-muted); cursor: pointer; touch-action: manipulation; }
  .msheet-fechar:active { background: var(--bg-elevated); }
  .msheet-fechar svg { width: 22px; height: 22px; }
  body.msheet-aberta .bnav { z-index: 9200; }
  .bnav-item[aria-expanded="true"] { color: var(--accent); font-weight: 700; }
  .msheet-handle { align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); flex: none; }
  .msheet-titulo { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary); }
  .msheet-grupo { margin: 8px 0 -4px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
  .msheet-lista { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
  .msheet-lista > * + * { border-top: 1px solid var(--border); }
  .msheet > .msheet-linha { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; }
  .msheet-linha {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; padding: 10px 12px;
    background: none; border: 0; color: var(--text-primary); font: inherit; text-align: left; text-decoration: none;
    cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: opacity .15s ease;
  }
  .msheet-linha:active { opacity: .75; }
  .msheet-linha[hidden] { display: none; }
  .msheet-icone {
    flex: none; width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-elevated); color: var(--accent);
  }
  .msheet-icone.negativo { color: var(--danger); }
  .msheet-icone svg { width: 22px; height: 22px; }
  .msheet-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  .msheet-texto strong { font-size: 16px; font-weight: 600; }
  .msheet-texto small { font-size: 13px; color: var(--text-muted); }
  .msheet-seta { flex: none; width: 18px; height: 18px; color: var(--text-muted); }
  .msheet-linha.perigo .msheet-icone, .msheet-linha.perigo strong { color: var(--danger); }
  body.msheet-aberta { overflow: hidden; }

  .page-header { flex-wrap: wrap; gap: 12px; }
  .page-header > div { min-width: 0; }
  .page-header > div:last-child { flex-wrap: wrap; }
  .main-content .btn:not(.btn-sm) { min-height: 44px; }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .msheet, .msheet-scrim { transition: none; }
}

/* Feed por dia (lista de gastos no mobile) */
.feed-mobile { display: none; }
@media (max-width: 768px) {
  .tabela-so-desktop { display: none; }
  .feed-mobile { display: flex; flex-direction: column; gap: 16px; }
  .feed-dia { display: flex; flex-direction: column; gap: 8px; }
  .feed-dia-topo { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; color: var(--text-muted); font-size: 13px; font-weight: 600; }
  .feed-dia-topo h2 { margin: 0; font-size: 13px; font-weight: 600; }
  .feed-dia-topo span { font-variant-numeric: tabular-nums; }
  .feed-lista { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
  .feed-item {
    display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px;
    color: var(--text-primary); text-decoration: none; transition: opacity .15s ease; -webkit-tap-highlight-color: transparent;
  }
  .feed-item + .feed-item { border-top: 1px solid var(--border); }
  a.feed-item:active { opacity: .7; }
  .feed-icone { flex: none; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); }
  .feed-icone svg { width: 20px; height: 20px; stroke: var(--text-muted); }
  .feed-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .feed-texto strong { font-size: 16px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .feed-texto small { font-size: 13px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .feed-valor { flex: none; font-size: 16px; font-weight: 600; color: var(--danger); font-variant-numeric: tabular-nums; }
  .feed-valor.positivo { color: var(--accent); }
}

/* Tabelas como cards no mobile (rótulos vêm de mobile-nav.js) */
@media (max-width: 768px) {
  .tabela-wrapper:has(.tabela-cards) { border: 0; box-shadow: none; max-height: none; overflow: visible; background: none; }
  .tabela-wrapper:has(.tabela-cards) > .tabela-header { padding: 0 4px 10px !important; }
  table.tabela-cards, table.tabela-cards tbody { display: block; width: 100%; }
  table.tabela-cards thead, table.tabela-cards tfoot { display: none; }
  table.tabela-cards tbody { display: flex; flex-direction: column; gap: 12px; }
  table.tabela-cards tr { display: flex; flex-direction: column; background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
  table.tabela-cards td {
    display: flex !important; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px;
    padding: 10px 16px; border: 0; border-top: 1px solid var(--border); white-space: normal; text-align: right; font-size: 14px;
  }
  table.tabela-cards td[data-rotulo]::before { content: attr(data-rotulo); flex: none; color: var(--text-muted); font-size: 13px; text-align: left; }
  table.tabela-cards td.td-titulo { order: -1; justify-content: flex-start; border-top: 0; text-align: left; font-size: 16px; font-weight: 600; }
  table.tabela-cards td.td-titulo::before { display: none; }
  table.tabela-cards td.td-acoes { order: 1; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
  table.tabela-cards td.td-vazio { display: none !important; }
  table.tabela-cards td[colspan] { display: block !important; text-align: center; border-top: 0; }
  table.tabela-cards td[colspan]::before { display: none; }
  table.tabela-cards td .btn-sm { min-height: 40px; min-width: 40px; justify-content: center; }
}

/* Dashboard no mobile: cards de resumo em 2 colunas, sem ícone, e o último (saldo previsto) em destaque */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .stat-card { padding: 12px; }
  .stat-card .icon-badge-lg { display: none; }
  .stat-label { min-height: 0; }
  .stat-value { font-size: 17px; }
  .stats-grid > .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .stats-grid > .stat-card:last-child:nth-child(odd) .stat-value { font-size: 22px; }
}


/* ========================== AVISO DE SALDO NEGATIVO ========================== */
.aviso-saldo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 12px; font-size: 12px; }
.aviso-saldo-texto { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); margin-right: 2px; }
.aviso-saldo-texto i { stroke: var(--color-negative); }
.aviso-mes {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 10px;
  font: inherit; color: var(--text-muted); cursor: pointer;
  background: transparent; border: 1px solid var(--border); border-radius: 999px;
  transition: border-color .15s, background .15s;
}
.aviso-mes[hidden] { display: none; }
.aviso-mais { color: var(--text-muted); }
.aviso-mes strong { color: var(--color-negative); font-weight: 600; font-variant-numeric: tabular-nums; }
.aviso-mes:hover { border-color: var(--color-negative); background: color-mix(in srgb, var(--color-negative) 8%, transparent); }
.aviso-mes:focus-visible { outline: 2px solid var(--color-negative); outline-offset: 2px; }

.resumo-mes-panel { padding: 24px 22px; max-width: 520px; max-height: 85vh; display: flex; flex-direction: column; }
.resumo-mes-corpo { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.rs-titulo { margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.rs-bloco { border: 1px solid var(--border); border-radius: 10px; padding: 4px 12px; }
.rs-linha { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 13px; color: var(--text-muted); }
.rs-linha + .rs-linha { border-top: 1px solid var(--border); }
.rs-linha strong { font-variant-numeric: tabular-nums; }
.rs-formas { display: flex; flex-direction: column; gap: 10px; }
.rs-forma-topo { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-primary); }
.rs-forma-nome { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.rs-forma-nome i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rs-barra { height: 6px; margin-top: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.rs-barra span { display: block; height: 100%; border-radius: 3px; }
.rs-gastos { display: flex; flex-direction: column; gap: 6px; }
.rs-gasto { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; }
.rs-gasto-desc { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-gasto-info { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rs-gasto-valor { font-size: 13px; color: var(--text-primary); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rs-tag { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: rgba(139,92,246,.15); color: var(--color-violet, #8b5cf6); }
.rs-vazio { padding: 16px 0; text-align: center; font-size: 13px; color: var(--text-muted); }
.rs-ver-todos { align-self: flex-start; margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .aviso-mes { transition: none; } }

/* ========================== BARRA DE FILTROS (web + PWA) ========================== */
form.fbar-form {
  display: block; padding: 10px 12px; margin-bottom: 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
}
form.fbar-form.filtros-form { gap: 0; }
.fbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fbar-legenda { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.fbar-periodo { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fbar-seta, .fbar-periodo-rotulo, .fbar-btn, .fbar-mes-op, .fbar-chip-x {
  font: inherit; color: var(--text-primary); cursor: pointer; touch-action: manipulation;
}
.fbar-seta { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: var(--radius-xs); background: transparent; }
.fbar-seta:hover:not(:disabled) { background: var(--bg-elevated); }
.fbar-seta:disabled { opacity: .35; cursor: default; }
.fbar-periodo-rotulo { min-width: 132px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-xs); background: transparent; font-size: 13px; font-weight: 600; text-align: center; }
.fbar-periodo-rotulo:hover { background: var(--bg-elevated); }
.fbar-busca { position: relative; flex: 1 1 160px; min-width: 140px; max-width: 360px; }
.fbar-busca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.fbar-busca .fbar-input { width: 100%; height: 36px; padding: 0 10px 0 32px; font: inherit; font-size: 13px; color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.fbar-filtros-area { position: relative; }
.fbar-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; font-size: 13px; font-weight: 500; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); white-space: nowrap; }
.fbar-btn:hover { border-color: var(--accent); }
.fbar-btn-primario { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.fbar-contador { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.fbar-contador[hidden] { display: none; }
.fbar-extra { margin-left: auto; }
.fbar-link { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 4px; }
.fbar-link:hover { text-decoration: underline; }
.fbar-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.fbar-chips[hidden] { display: none; }
.fbar-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 4px 0 10px; font-size: 12px; color: var(--text-muted); background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: var(--radius-full); }
.fbar-chip b { color: var(--text-primary); font-weight: 600; }
.fbar-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; font-size: 16px; line-height: 1; color: var(--text-muted); }
.fbar-chip-x:hover { background: var(--bg-elevated); color: var(--text-primary); }
.fbar-seta:focus-visible, .fbar-periodo-rotulo:focus-visible, .fbar-btn:focus-visible, .fbar-mes-op:focus-visible,
.fbar-chip-x:focus-visible, .fbar-link:focus-visible, .fbar-input:focus-visible, .fbar-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.fbar-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: 0 12px 32px rgba(0,0,0,.34); padding: 14px; }
.fbar-pop[hidden] { display: none; }
.fbar-pop-filtros { width: min(460px, calc(100vw - 32px)); }
.fbar-pop-meses { width: 264px; }
.fbar-pop-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fbar-pop-ano { font-size: 14px; }
.fbar-mes-grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fbar-mes-op { height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-secondary); font-size: 13px; }
.fbar-mes-op:hover { border-color: var(--accent); }
.fbar-mes-op.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.fbar-pop-extras { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.fbar-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fbar-campo { display: grid; gap: 4px; min-width: 0; }
.fbar-campo label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.fbar-select { width: 100%; min-width: 0; height: 36px; font: inherit; font-size: 13px; color: var(--text-primary); background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 8px; }
body.light-theme .fbar-select, body.light-theme .fbar-busca .fbar-input { background: #faf9f7; }
.fbar-rodape { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.fbar-sheet-topo, .fbar-fundo { display: none; }

@media (max-width: 768px) {
  html.fbar-trava { overflow: hidden; }
  .fbar-periodo { flex: 1 1 auto; justify-content: space-between; }
  .fbar-periodo-rotulo { flex: 1; min-width: 0; height: 40px; }
  .fbar-seta { width: 40px; height: 40px; }
  .fbar-busca { order: 5; flex: 1 1 100%; max-width: none; }
  .fbar-busca .fbar-input, .fbar-btn, .fbar-select { height: 44px; font-size: 16px; }
  .fbar-btn { font-size: 14px; }
  .fbar-mes-op { height: 44px; }
  .fbar-chip { min-height: 32px; }
  .fbar-chip-x { width: 28px; height: 28px; }
  .fbar-extra { margin-left: 0; }
  .fbar-filtros-area { position: static; }
  .fbar-pop { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto !important; max-height: 85dvh; overflow-y: auto; z-index: 1001; border-radius: 20px 20px 0 0; border-width: 1px 0 0; padding: 8px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 32px rgba(0,0,0,.4); }
  .fbar-sheet-topo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
  .fbar-pop-meses .fbar-sheet-topo { display: none; }
  .fbar-alca { width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); }
  .fbar-grade { grid-template-columns: 1fr; }
  .fbar-rodape { position: sticky; bottom: 0; background: var(--bg-card); padding-top: 10px; }
  .fbar-rodape .fbar-btn { flex: 1; height: 46px; }
  .fbar-aberto .fbar-fundo { display: block; position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.5); }
}
@media (prefers-reduced-motion: no-preference) {
  .fbar-pop:not([hidden]) { animation: fbar-entra .16s ease-out; }
  @keyframes fbar-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* A barra convive com regras antigas de .mes-filtro (coluna no celular): garante a disposição própria */
form.fbar-form > .fbar { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
form.fbar-form > .fbar-fonte { display: none !important; }
form.fbar-form > .fbar-chips { flex-direction: row; }
form.fbar-form > .fbar > div { flex-direction: row; min-width: 0; }
form.fbar-form .fbar-periodo { gap: 2px; }
form.fbar-form .fbar-busca { display: block; }
form.fbar-form .fbar-select { width: 100% !important; }
form.fbar-form .fbar-grade { display: grid; }
form.fbar-form .fbar-campo { display: grid; flex-direction: row; }
form.fbar-form .fbar-pop-topo, form.fbar-form .fbar-rodape, form.fbar-form .fbar-pop-extras { display: flex; }
@media (max-width: 768px) {
  form.fbar-form { padding: 10px; }
  form.fbar-form > .fbar { flex-wrap: wrap; }
}


/* Lista de gastos: cabeçalho de cada fatura */
.tabela-dados tr.grupo-fatura td { background: var(--bg-elevated); border-top: 2px solid var(--border); padding-top: 9px; padding-bottom: 9px; }
.grupo-fatura-nome { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; font-weight: 600; }
.grupo-fatura-nome small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.grupo-fatura-paga { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; background: rgba(34,197,94,.15); color: var(--color-positive); }
.grupo-fatura-total { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
