/* ===================================================================
   Nekos Finance — Design System (LIGHT THEME)
   Inspirado no Minhas Financas BR
   Mobile-first, sidebar branca, cards arejados
   =================================================================== */

/* ------------------------------------------------------------------ */
/* 1. RESET & BASE                                                     */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Fundos */
  --bg-dark:        #f5f5f7;     /* legado: usado como "body" — agora cinza claro */
  --bg-body:        #f5f5f7;
  --bg-sidebar:     #ffffff;
  --bg-card:        #ffffff;
  --bg-widget:      #ffffff;
  --bg-input:       #ffffff;
  --bg-hover:       #f3f4f6;
  --bg-sidebar-active: #e3f2fd;

  /* Texto */
  --text-primary:   #1f2937;
  --text-secondary: #4b5563;
  --text-muted:     #6b7280;
  --text-on-primary: #ffffff;

  /* Bordas */
  --border:         #e5e7eb;
  --border-light:   #f1f3f5;
  --border-hover:   #d1d5db;

  /* Primaria — azul Minhas Financas */
  --primary:        #1976d2;
  --primary-hover:  #1565c0;
  --primary-light-bg: #e3f2fd;

  /* Legado teal — apontado para a primaria azul para nao quebrar refs */
  --teal:           #1976d2;
  --teal-light:     #1976d2;

  /* Estados */
  --success:        #16a34a;
  --success-light-bg: #dcfce7;
  --green:          #16a34a;

  --danger:         #dc2626;
  --danger-light-bg: #fee2e2;
  --red:            #dc2626;
  --red-light:      #dc2626;

  --warning:        #f59e0b;
  --warning-light-bg: #fef3c7;
  --yellow:         #d97706;

  --blue:           #1976d2;
  --blue-light:     #60a5fa;
  --purple:         #7c3aed;

  /* Aliases legados para compatibilidade com seletores antigos */
  --card-bg:        #ffffff;
  --surface:        #ffffff;
  --text:           #1f2937;
  --muted:          #4b5563;

  /* Sombras (suaves no light theme) */
  --shadow-card:        0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-card-hover:  0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-sticky:      0 2px 4px rgba(0, 0, 0, 0.04);

  --sidebar-w:    240px;
  --bottom-nav-h: 60px;
  --radius:       10px;
  --radius-sm:    6px;
}

html { font-size: 16px; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ------------------------------------------------------------------ */
/* 2. LAYOUT — SIDEBAR + MAIN                                          */
/* ------------------------------------------------------------------ */

/* Mobile: sidebar hidden, bottom nav visible */
.sidebar { display: none; }

.main-content {
  padding: 16px 16px calc(var(--bottom-nav-h) + 16px) 16px;
  min-height: 100vh;
}

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}

/* Desktop: sidebar visible, bottom nav hidden */
@media (min-width: 768px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 100;
  }

  .main-content {
    margin-left: var(--sidebar-w);
    padding: 24px 28px 24px 28px;
  }

  .bottom-nav { display: none; }
}

/* ------------------------------------------------------------------ */
/* 3. SIDEBAR                                                          */
/* ------------------------------------------------------------------ */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 34px; height: 34px;
  background: var(--teal);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 12px 0 56px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-item:hover {
  background: rgba(0,0,0,0.035);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--primary);
  font-weight: 600;
}

.nav-item svg {
  width: 18px; height: 18px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-item-cta {
  margin-top: 8px;
  color: var(--teal);
}

.sidebar-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 101;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.logout-btn {
  color: var(--text-muted);
  font-size: 12px;
  transition: color 0.15s;
}
.logout-btn:hover { color: var(--red); }

/* ------------------------------------------------------------------ */
/* 4. BOTTOM NAV (mobile)                                              */
/* ------------------------------------------------------------------ */


.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 4px 8px;
  min-width: 44px;
  transition: color 0.15s;
}

.bnav-item svg {
  width: 22px; height: 22px;
  fill: currentColor;
}

.bnav-item.active { color: var(--teal); }

.bnav-center {
  width: 48px; height: 48px;
  background: var(--primary);
  border-radius: 50%;
  color: #fff;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(25,118,210,0.35);
}
.bnav-center:hover { background: var(--primary-hover); }
.bnav-center svg { width: 26px; height: 26px; }

/* ------------------------------------------------------------------ */
/* 5. PAGE HEADER                                                      */
/* ------------------------------------------------------------------ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-btn {
  width: 32px; height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.month-btn:hover { background: var(--bg-hover); color: var(--primary); border-color: var(--border-hover); }

.month-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 130px;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* 6. FLASH MESSAGES                                                   */
/* ------------------------------------------------------------------ */

.flash-container {
  margin-bottom: 16px;
}

.flash {
  background: var(--success-light-bg);
  border: 1px solid rgba(22,163,74,0.3);
  color: var(--success);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 8px;
}

/* ------------------------------------------------------------------ */
/* 7. CARDS                                                            */
/* ------------------------------------------------------------------ */

.cards-grid {
  display: grid;
  /* Mobile: 1 coluna confortavel; tablet/desktop: auto-fit pra esticar
     ate ocupar 100% da largura do main-content, independente do numero
     de cards (3 ou 4). minmax garante quebra suave em telas estreitas. */
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 20px;
  width: 100%;
}

@media (min-width: 480px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .cards-grid {
    /* auto-fit + minmax distribui N cards igualmente em 100% da largura.
       3 cards -> 3 colunas iguais; 4 cards -> 4 colunas iguais. */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.cards-small .card-value { font-size: 18px; }

.card {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  box-shadow: var(--shadow-card);
}

.card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin-bottom: 6px;
}

.card-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.card-value.negative { color: var(--red); }

.card-link { color: inherit; text-decoration: underline; }

.card-blue   { background: var(--primary-light-bg);  border-color: rgba(25,118,210,0.18); color: var(--primary); }
.card-green  { background: var(--success-light-bg);  border-color: rgba(22,163,74,0.18); color: var(--success); }
.card-red    { background: var(--danger-light-bg);   border-color: rgba(220,38,38,0.18); color: var(--danger); }
.card-yellow { background: var(--warning-light-bg);  border-color: rgba(217,119,6,0.18); color: var(--warning); }

/* ------------------------------------------------------------------ */
/* 8. WIDGET                                                           */
/* ------------------------------------------------------------------ */

.widget {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.widget-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.widget-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.widget-link {
  font-size: 12px;
  color: var(--teal);
  transition: opacity 0.15s;
}
.widget-link:hover { opacity: 0.7; }

/* ------------------------------------------------------------------ */
/* 9. DASHBOARD GRID                                                   */
/* ------------------------------------------------------------------ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr 1.4fr;
    gap: 20px;
  }
}

/* ------------------------------------------------------------------ */
/* 10. CATEGORY RANKING                                                */
/* ------------------------------------------------------------------ */

.cat-ranking { display: flex; flex-direction: column; gap: 10px; }

.cat-row {
  display: grid;
  grid-template-columns: 160px 1fr 100px;
  align-items: center;
  gap: 10px;
}

@media (max-width: 500px) {
  .cat-row { grid-template-columns: 120px 1fr 90px; }
}

.cat-info {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}

.cat-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-qtd {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.cat-bar-wrap {
  height: 8px;
  background: rgba(0,0,0,0.045);
  border-radius: 4px;
  overflow: hidden;
}

.cat-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.cat-value {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* 11. ACCOUNTS LIST                                                   */
/* ------------------------------------------------------------------ */

.accounts-list { display: flex; flex-direction: column; gap: 8px; }

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.account-row:last-child { border-bottom: none; }

.account-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-type-badge {
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.account-type-corrente  { background: rgba(25,118,210,0.12); color: var(--blue); }
.account-type-cartao    { background: rgba(220,38,38,0.1);  color: var(--red); }
.account-type-investimento { background: rgba(22,163,74,0.12); color: var(--green); }

.account-name { font-size: 14px; }

.account-balance {
  font-size: 14px;
  font-weight: 600;
}
.account-balance.negative { color: var(--red); }

/* ------------------------------------------------------------------ */
/* 12. CASHFLOW CHART                                                  */
/* ------------------------------------------------------------------ */

.widget-cashflow { }

.cashflow-toggles {
  display: flex;
  gap: 6px;
}

.toggle-btn {
  padding: 4px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.toggle-btn.active, .toggle-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.chart-container {
  height: 220px;
  position: relative;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .chart-container { height: 260px; }
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.legend-line {
  width: 20px; height: 2px;
  flex-shrink: 0;
}

.legend-dash {
  background: repeating-linear-gradient(
    90deg,
    var(--blue-light) 0, var(--blue-light) 4px,
    transparent 4px, transparent 8px
  );
  background-color: transparent !important;
}

/* ------------------------------------------------------------------ */
/* 13. TRANSACTION LIST (dashboard)                                    */
/* ------------------------------------------------------------------ */

.tx-list { display: flex; flex-direction: column; gap: 0; }

.tx-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.tx-row:last-child { border-bottom: none; }

.tx-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tx-info {
  flex: 1;
  min-width: 0;
}

.tx-desc {
  display: block;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-meta {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.tx-value {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.tx-value.tx-despesa { color: var(--danger); }
.tx-value.tx-receita { color: var(--success); }

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

/* ------------------------------------------------------------------ */
/* 14. TRANSACTION TABLE (transacoes.html)                             */
/* ------------------------------------------------------------------ */

.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.filters-form select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
}

.tx-table { width: 100%; overflow-x: auto; }

.tx-table-header {
  display: grid;
  grid-template-columns: 80px 1fr 100px 110px 36px 90px 70px 56px;
  padding: 6px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.tx-table-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px 110px 36px 90px 70px 56px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  align-items: center;
  transition: background 0.1s;
}
.tx-table-row:hover { background: rgba(0,0,0,0.025); }
.tx-table-row.tx-previsto { opacity: 0.65; }

@media (max-width: 900px) {
  .tx-table-header { display: none; }
  .tx-table-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px;
  }
  .tx-date, .tx-cat, .tx-account, .tx-status { display: none; }
  .tx-desc-full { grid-column: 1; }
  .tx-value-col { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .tx-actions { grid-column: 1; }
}

.text-right { text-align: right; }

.tx-date { color: var(--text-secondary); }
.tx-desc-full { display: flex; align-items: center; gap: 7px; overflow: hidden; }
.tx-dot-sm { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tx-cat { color: var(--text-secondary); }
.tx-account { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tx-status { font-size: 10px; }
.status-confirmado { color: var(--green); }
.status-previsto   { color: var(--yellow); }
.status-pendente   { color: var(--red); }

.tx-value-col { font-weight: 600; text-align: right; }
.tx-value-col.tx-despesa { color: var(--danger); }
.tx-value-col.tx-receita { color: var(--success); }

.tx-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

.action-btn {
  width: 28px; height: 28px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.action-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-primary); }
.action-danger:hover { color: var(--red); }
.action-btn svg { width: 14px; height: 14px; fill: currentColor; }

.tx-count {
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
  padding-top: 10px;
}

/* ------------------------------------------------------------------ */
/* 15. FORMS                                                           */
/* ------------------------------------------------------------------ */

.form-widget { max-width: 680px; }

.tx-form { display: flex; flex-direction: column; gap: 16px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.15s;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
}

.form-group textarea { resize: vertical; min-height: 60px; }

/* Type toggle */
.form-type-toggle { }
.toggle-group { display: flex; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); width: fit-content; }
.toggle-group input[type=radio] { display: none; }
.toggle-opt {
  padding: 8px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.toggle-group input:checked + .despesa-opt { background: rgba(220,38,38,0.1); color: var(--red); }
.toggle-group input:checked + .receita-opt { background: rgba(22,163,74,0.12); color: var(--green); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* 16. BUTTONS                                                         */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.85; }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); opacity: 1; }
.btn-ghost    { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); opacity: 1; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ------------------------------------------------------------------ */
/* 17. LOGIN                                                           */
/* ------------------------------------------------------------------ */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow-card);
}

.login-body {
  background: var(--bg-body);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  background: var(--teal);
  border-radius: 14px;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-muted);
}

.login-error {
  background: var(--danger-light-bg);
  border: 1px solid rgba(220,38,38,0.3);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------------------------------------------ */
/* 18. UPLOAD                                                          */
/* ------------------------------------------------------------------ */

.upload-info { margin-bottom: 20px; }
.upload-info h3 { font-size: 14px; color: var(--text-secondary); margin-bottom: 10px; }
.upload-formats { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.upload-formats li { font-size: 13px; }
.upload-formats strong { color: var(--text-primary); display: block; }
.upload-formats span { color: var(--text-muted); }

.upload-form { display: flex; flex-direction: column; gap: 16px; }

.file-drop {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-hover);
}
.file-drop:hover, .file-drop.dragging {
  border-color: var(--primary);
  background: var(--primary-light-bg);
}
.file-drop.has-file { border-color: var(--primary); background: var(--primary-light-bg); }

.file-drop-content { pointer-events: none; }

.upload-icon { width: 36px; height: 36px; fill: var(--text-muted); margin-bottom: 10px; }

.file-drop p { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.file-hint { font-size: 12px; color: var(--text-muted); }

.upload-notes {
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-notes p { font-size: 13px; color: var(--text-secondary); }

/* ------------------------------------------------------------------ */
/* 19. PENDING                                                         */
/* ------------------------------------------------------------------ */

.badge-large {
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.pending-info {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.pending-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pending-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.pending-row.classified { background: rgba(25,118,210,0.05); }
.pending-row:last-child { border-bottom: none; }

@media (min-width: 640px) {
  .pending-row {
    grid-template-columns: 1fr 1.2fr;
    align-items: start;
  }
}

.pending-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}

.pending-date  { font-size: 12px; color: var(--text-muted); }
.pending-desc  { font-size: 14px; font-weight: 500; flex: 1; min-width: 150px; }
.pending-value { font-size: 14px; font-weight: 700; color: var(--red-light); white-space: nowrap; }
.pending-card  { font-size: 11px; color: var(--text-muted); background: rgba(0,0,0,0.045); padding: 2px 6px; border-radius: 4px; }

.pending-classify {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-select, .subcat-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
}

/* Categoria e subcategoria lado a lado */
.cat-main     { flex: 0 0 180px; width: 180px; }
.subcat-select { flex: 0 0 160px; width: 160px; }

.cat-select:focus, .subcat-input:focus { outline: none; border-color: var(--teal); }

/* Botao aprovar bloco A */
.row-check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.row-check-label input { accent-color: var(--teal); cursor: pointer; }
.approve-label { font-size: 12px; }

.rule-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.rule-check input[type=checkbox] { accent-color: var(--teal); cursor: pointer; }

.pending-actions { margin-top: 20px; }

/* ------------------------------------------------------------------ */
/* 20. SCROLLBARS                                                      */
/* ------------------------------------------------------------------ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ------------------------------------------------------------------ */
/* 21. PERIOD PICKER (filtro de data customizado)                       */
/* ------------------------------------------------------------------ */

.dash-period-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.period-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  padding: 4px 10px;
  background: rgba(25,118,210,0.08);
  border-radius: var(--radius-sm);
}

.period-toggle-btn { flex-shrink: 0; }

.period-picker {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.period-picker-form {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-group-inline label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.form-group-inline input[type="date"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.form-group-inline input[type="date"]:focus {
  outline: none;
  border-color: var(--teal);
}

/* ------------------------------------------------------------------ */
/* 22. ORIGEM BADGE (cartao vs conta)                                  */
/* ------------------------------------------------------------------ */

.origin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.origin-badge svg {
  width: 10px;
  height: 10px;
  fill: currentColor;
  flex-shrink: 0;
}

.origin-cartao {
  background: rgba(220,38,38,0.08);
  color: var(--red);
}

.origin-conta {
  background: rgba(25,118,210,0.1);
  color: var(--blue);
}

.tx-origin { display: flex; align-items: center; }

/* Parcela inline */
.tx-installment {
  font-size: 10px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.045);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  white-space: nowrap;
}

.tx-installment-col {
  color: var(--text-muted);
  font-size: 12px;
}

/* breakdown no card de despesas */
.card-breakdown {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.75;
  flex-wrap: wrap;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

.breakdown-icon {
  width: 10px; height: 10px;
  fill: currentColor;
  flex-shrink: 0;
}

.breakdown-sep { color: var(--border); }

/* ------------------------------------------------------------------ */
/* 23. CARTOES — cards de visao geral                                  */
/* ------------------------------------------------------------------ */

.cards-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .cards-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .cards-grid-3 { grid-template-columns: repeat(3, 1fr); }
}

.card-account {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s, transform 0.05s;
}
.card-account:hover {
  box-shadow: var(--shadow-card-hover);
}

.card-account-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-account-id {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-account-name {
  font-size: 16px;
  font-weight: 700;
}

.card-brand-badge {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(0,0,0,0.045);
  padding: 2px 6px;
  border-radius: 4px;
  width: fit-content;
}

.card-last4 {
  font-size: 12px;
  color: var(--text-muted);
  font-family: monospace;
}

.card-account-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.card-stat-value {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.card-stat-red   { color: var(--red-light); }
.card-stat-yellow { color: var(--yellow); }

.card-account-footer { margin-top: auto; }

/* Detalhe cartao */
.card-period-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.card-month-total {
  font-size: 14px;
  font-weight: 700;
  color: var(--red-light);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* Tabela de detalhes do cartao: 8 colunas */
.tx-table-row.card-detail-row,
.tx-table-header.card-detail-header {
  grid-template-columns: 80px 1fr 90px 100px 80px 70px 56px 56px;
}

/* ------------------------------------------------------------------ */
/* 24. INVESTIMENTOS                                                    */
/* ------------------------------------------------------------------ */

/* Cards clicáveis na listagem de contas */
.inv-account-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: background 0.15s;
}
.inv-account-card:hover { background: rgba(0,0,0,0.03); }
.inv-account-link {
  flex: 1; display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
}
.inv-account-link:hover .inv-account-name { color: var(--primary); }
.inv-account-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.inv-account-name { font-size: 15px; font-weight: 600; transition: color 0.15s; }
.inv-account-sub { font-size: 12px; color: var(--text-muted); }
.inv-account-balance { font-size: 15px; font-weight: 700; color: var(--green); white-space: nowrap; }
.inv-account-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Empty state dentro da conta */
.inv-empty-pos {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.inv-balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.inv-balance-row:last-of-type { border-bottom: none; }

.inv-label { font-size: 13px; color: var(--text-secondary); }
.inv-value { font-size: 15px; font-weight: 700; }
.inv-value.negative { color: var(--red); }

.inv-history { margin-top: 14px; }
.inv-history-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: block;
}

.inv-history-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.inv-history-row:last-child { border-bottom: none; }

.inv-history-desc { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ajuste de saldo */
.ajuste-saldo-panel {
  background: rgba(0,0,0,0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
}

.ajuste-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Legenda do grafico de investimentos */
.inv-chart-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.inv-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.inv-legend-pct {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* 25. COLOR PICKER (cartao form)                                       */
/* ------------------------------------------------------------------ */

.color-picker-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}

.color-swatch input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--primary-light-bg); }

/* ------------------------------------------------------------------ */
/* 26. CLASSIFICAR UPLOAD                                              */
/* ------------------------------------------------------------------ */

.upload-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.validation-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.validation-ok {
  background: rgba(22,163,74,0.1);
  color: var(--green);
}

.validation-warn {
  background: rgba(217,119,6,0.12);
  color: var(--yellow);
}

.section-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.badge-red {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Tabela de classificacao com sugestao */
.class-table { display: flex; flex-direction: column; }

.class-header {
  display: grid;
  grid-template-columns: 30px 100px 1fr 100px 200px 80px;
  gap: 8px;
  padding: 6px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .class-header { display: none; }
}

.class-row {
  display: grid;
  grid-template-columns: 30px 100px 1fr 100px 200px 80px;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  transition: background 0.1s;
}

.class-row:hover { background: rgba(0,0,0,0.02); }

@media (max-width: 768px) {
  .class-row {
    grid-template-columns: 30px 1fr auto;
    grid-template-rows: auto auto;
  }
  .class-row .tx-date-sm { display: none; }
  .class-row .cat-inline { grid-column: 1 / 4; }
  .class-row .tx-installment-sm { display: none; }
}

.row-check { display: flex; align-items: center; justify-content: center; }
.row-check input[type=checkbox] { accent-color: var(--teal); width: 16px; height: 16px; cursor: pointer; }

.tx-date-sm { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.tx-desc-sm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-val-sm  { font-size: 13px; font-weight: 600; color: var(--red-light); white-space: nowrap; }
.tx-installment-sm { font-size: 11px; color: var(--text-muted); }

.cat-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-select-inline {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex: 1;
  min-width: 120px;
}

.cat-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.import-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------------ */
/* 27. FLUXO DE CAIXA (pagina dedicada)                                */
/* ------------------------------------------------------------------ */

.widget-cashflow-full {
  width: 100%;
  margin-bottom: 20px;
}

.cashflow-legend-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.chart-container-lg {
  height: 320px;
}

@media (min-width: 768px) {
  .chart-container-lg { height: 380px; }
}

/* Container ainda maior para o dashboard full-width */
.chart-container-xl {
  height: 300px;
}

@media (min-width: 768px) {
  .chart-container-xl { height: 380px; }
}

@media (min-width: 1280px) {
  .chart-container-xl { height: 420px; }
}

.fluxo-table-wrap { overflow-x: auto; }

.fluxo-table-header {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.fluxo-table-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  align-items: center;
  transition: background 0.1s;
}

.fluxo-table-row:hover { background: rgba(0,0,0,0.025); }

.fluxo-future { opacity: 0.65; font-style: italic; }
.fluxo-mes { font-weight: 500; }

.prev-tag {
  font-size: 9px;
  font-style: normal;
  background: rgba(217,119,6,0.15);
  color: var(--yellow);
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
}

.text-green { color: var(--green); }
.text-red   { color: var(--red-light); }
.font-bold  { font-weight: 700; }

/* ------------------------------------------------------------------ */
/* 28. ANALISE DO CARTAO                                               */
/* ------------------------------------------------------------------ */

.analise-header-actions {
  display: flex;
  gap: 8px;
}

.period-filter-widget {
  padding: 12px 16px;
  margin-bottom: 20px;
}

.period-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.period-picker-inline {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------------ */
/* 29. NAV DISABLED (proximas fases)                                   */
/* ------------------------------------------------------------------ */

.nav-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-soon {
  margin-left: auto;
  font-size: 9px;
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Modal nova categoria/subcategoria */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 320px;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15), 0 8px 10px -6px rgba(0,0,0,0.1);
}
.modal-box h3 { font-size: 16px; font-weight: 600; margin: 0; }
.modal-box .form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}
.modal-box .form-control:focus { outline: none; border-color: var(--teal); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Badges de sugestão */
.badge-ai {
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  background: rgba(124,58,237,0.12); color: #7c3aed;
  border: 1px solid rgba(124,58,237,0.2);
  padding: 2px 6px; border-radius: 4px;
}
.badge-hist {
  font-size: 10px; font-weight: 600;
  background: rgba(25,118,210,0.1); color: #1976d2;
  border: 1px solid rgba(25,118,210,0.2);
  padding: 2px 6px; border-radius: 4px;
}

/* ============================================================
   Dívidas
   ============================================================ */

/* Summary cards */
.summary-cards {
  display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.summary-card {
  flex: 1; min-width: 150px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 20px;
  box-shadow: var(--shadow-card);
}
.summary-card-red { border-left: 3px solid #dc2626; }
.summary-card-warn { border-left: 3px solid #d97706; }
.sc-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.sc-value { display: block; font-size: 22px; font-weight: 700; color: var(--text); }

/* Debt cards */
.debts-list { display: flex; flex-direction: column; gap: 16px; }

.debt-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
  box-shadow: var(--shadow-card);
}
.debt-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; gap: 12px;
}
.debt-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.debt-name { font-size: 16px; font-weight: 600; color: var(--text); }
.debt-creditor { font-size: 13px; color: var(--muted); }
.debt-type-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
}
.debt-type-parcelado { background: rgba(25,118,210,0.1); color: #1976d2; }
.debt-type-financiamento { background: rgba(220,38,38,0.08); color: #dc2626; }
.debt-type-rotativo { background: rgba(217,119,6,0.12); color: #d97706; }

.debt-values {
  display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px;
}
.debt-val-item { display: flex; flex-direction: column; gap: 2px; }
.debt-val-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.debt-val-num { font-size: 15px; font-weight: 600; color: var(--text); }
.debt-val-red { color: #dc2626; }

/* Progress bar */
.debt-progress-wrap { margin-top: 4px; }
.debt-progress-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 6px;
}
.debt-progress-fill {
  height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: 4px; transition: width 0.4s;
}
.debt-progress-labels {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
}
.debt-notas {
  margin-top: 10px; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--border); padding-top: 10px;
}

/* Form helpers */
.form-section-title {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 20px 0 10px;
}
.btn-danger-ghost { color: #dc2626; }
.btn-danger-ghost:hover { background: rgba(220,38,38,0.08); color: #dc2626; }

/* ============================================================
   Recorrentes
   ============================================================ */

.summary-card-green { border-left: 3px solid #16a34a; }

/* Gerar widget */
.rec-gerar-wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding: 16px 20px; margin-bottom: 0;
}
.rec-gerar-header { display: flex; flex-direction: column; gap: 2px; }
.rec-gerar-title { font-size: 14px; font-weight: 600; color: var(--text); }
.rec-gerar-sub { font-size: 12px; color: var(--muted); }
.rec-gerar-form { display: flex; gap: 8px; align-items: center; }
.form-control-sm { padding: 6px 10px; font-size: 13px; }

/* Lista de recorrentes */
.rec-list { display: flex; flex-direction: column; }

.rec-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.rec-row:last-child { border-bottom: none; }
.rec-row-inactive { opacity: 0.45; }

.rec-day-badge {
  min-width: 52px; text-align: center;
  background: rgba(0,0,0,0.04); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}

.rec-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-desc { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: 12px; color: var(--muted); }
.rec-badge-inactive {
  font-size: 10px; font-weight: 600; background: rgba(107,114,128,0.12);
  color: #6b7280; border-radius: 3px; padding: 1px 5px; margin-left: 4px;
}

.rec-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.rec-value { font-size: 15px; font-weight: 700; }
.rec-value-red { color: #dc2626; }
.rec-value-green { color: #16a34a; }

.rec-status-ok {
  font-size: 11px; font-weight: 600; color: #16a34a;
  background: rgba(22,163,74,0.1); border: 1px solid rgba(22,163,74,0.2);
  padding: 2px 7px; border-radius: 4px;
}
.rec-status-pend {
  font-size: 11px; font-weight: 600; color: #d97706;
  background: rgba(217,119,6,0.1); border: 1px solid rgba(217,119,6,0.2);
  padding: 2px 7px; border-radius: 4px;
}

.rec-actions { display: flex; gap: 4px; }

/* Form helpers */
.form-hint { font-size: 11px; color: var(--muted); margin-top: 3px; display: block; }
.form-check-group { display: flex; align-items: center; }
.form-check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.form-check-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--teal); }

@media (max-width: 600px) {
  .rec-gerar-wrap { flex-direction: column; align-items: flex-start; }
  .rec-row { flex-wrap: wrap; }
  .rec-right { width: 100%; justify-content: flex-start; padding-left: 64px; }
}

/* ============================================================
   Sonhos / Objetivos
   ============================================================ */

.summary-card-blue { border-left: 3px solid #1976d2; }

.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.goal-card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-card);
}
.goal-card-done { opacity: 0.75; }

.goal-header {
  display: flex; align-items: flex-start; gap: 12px;
}
.goal-emoji { font-size: 28px; line-height: 1; flex-shrink: 0; }
.goal-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.goal-name { font-size: 16px; font-weight: 600; color: var(--text); }
.goal-desc { font-size: 12px; color: var(--muted); }
.goal-actions { display: flex; gap: 4px; flex-shrink: 0; }

.goal-values {
  display: flex; flex-wrap: wrap; gap: 14px;
}
.goal-val-item { display: flex; flex-direction: column; gap: 2px; }
.goal-val-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.goal-val-num { font-size: 15px; font-weight: 600; color: var(--text); }
.goal-val-green { color: #16a34a; }
.goal-val-muted { color: var(--muted); }

/* Progress */
.goal-progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.goal-progress-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.goal-progress-fill {
  height: 100%; border-radius: 4px; transition: width 0.4s;
}
.goal-progress-labels {
  display: flex; justify-content: space-between; font-size: 12px; color: var(--muted);
}

/* Simulador (card) */
.goal-sim { display: flex; flex-direction: column; gap: 6px; }
.goal-sim-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.goal-sim-icon { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }
.goal-sim-warn { color: #d97706; }
.goal-sim-done { color: #16a34a; font-weight: 600; }

/* Aporte rápido */
.goal-deposit-form {
  display: flex; gap: 8px; align-items: center;
  border-top: 1px solid var(--border); padding-top: 12px;
}
.goal-deposit-form .form-control { flex: 1; }

/* Simulador (form) */
.sim-result {
  background: rgba(0,0,0,0.03); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 4px;
}
.sim-result-inner { display: flex; flex-direction: column; gap: 6px; }
.sim-item {
  font-size: 13px; color: var(--muted);
}
.sim-item.sim-warn { color: #d97706; }
.sim-done { font-size: 13px; color: #16a34a; font-weight: 600; }

/* Color picker */
.form-color {
  width: 48px; height: 36px; padding: 2px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-input); cursor: pointer;
}

@media (max-width: 600px) {
  .goals-grid { grid-template-columns: 1fr; }
}

/* Aporte investimento */
.aporte-form { padding-top: 4px; }
.aporte-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.aporte-grid .form-group-inline { flex-direction: column; align-items: flex-start; gap: 4px; }
.aporte-grid .form-group-inline label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.aporte-grid .form-group-inline input,
.aporte-grid .form-group-inline select {
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary);
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; width: 100%;
}
.inv-taxa-badge {
  font-size: 10px; font-weight: 700; background: rgba(25,118,210,0.1); color: #1976d2;
  border-radius: 3px; padding: 1px 5px; margin-left: 4px;
}
@media (max-width: 480px) { .aporte-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Posições de Investimento
   ============================================================ */

.pos-list { margin-bottom: 8px; }
.pos-list-header {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px; padding: 6px 0;
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.pos-row { border-bottom: 1px solid rgba(0,0,0,0.03); }
.pos-row:last-child { border-bottom: none; }

.pos-view {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px; align-items: center; padding: 10px 0;
}
.pos-name { font-size: 13px; font-weight: 500; color: var(--text); }
.pos-tipo { font-size: 12px; color: var(--muted); }
.pos-indice { font-size: 12px; color: var(--muted); }
.pos-valor { font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }
.pos-actions { display: flex; gap: 4px; justify-content: flex-end; }

.pos-edit { padding: 10px 0; }
.pos-edit-form {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: 6px; align-items: center;
}
.pos-edit-actions { display: flex; gap: 4px; }

.pos-nova-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.pos-nova-grid .form-group-inline { flex-direction: column; align-items: flex-start; gap: 3px; }
.pos-nova-grid .form-group-inline label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.pos-nova-grid .form-control,
.pos-edit-form .form-control { font-size: 12px; padding: 5px 8px; }

.btn-xs {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  font-weight: 500; cursor: pointer; border: 1px solid transparent;
  background: transparent; color: var(--muted);
}
.btn-xs:hover { background: rgba(0,0,0,0.045); color: var(--text); }
.btn-primary.btn-xs { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-primary.btn-xs:hover { opacity: 0.9; }

@media (max-width: 700px) {
  .pos-list-header, .pos-view { grid-template-columns: 1fr 1fr auto; }
  .pos-list-header span:nth-child(3),
  .pos-view .pos-indice { display: none; }
  .pos-edit-form { grid-template-columns: 1fr 1fr; }
  .pos-nova-grid { grid-template-columns: 1fr; }
}

/* Form inline sem quebrar alinhamento de botões */
.form-inline-btn { display: contents; }

.debt-type-emprestimo { background: rgba(22,163,74,0.1); color: #16a34a; }
.btn-indice { color: #1976d2; border-color: rgba(25,118,210,0.2); }
.btn-indice:hover { background: rgba(25,118,210,0.08); }

/* ============================================================
   Histórico mensal de investimentos
   ============================================================ */

.hist-table { margin-top: 4px; }
.hist-header {
  display: grid;
  grid-template-columns: 90px 130px 130px 1fr 120px;
  gap: 8px; padding: 6px 0;
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}
.hist-row { border-bottom: 1px solid rgba(0,0,0,0.03); }
.hist-row:last-child { border-bottom: none; }
.hist-view {
  display: grid;
  grid-template-columns: 90px 130px 130px 1fr 120px;
  gap: 8px; align-items: center; padding: 10px 0;
  font-size: 13px;
}
.hist-ym { font-weight: 600; color: var(--text-secondary); }
.hist-valor { font-weight: 600; }
.hist-var { font-size: 12px; }
.hist-pos { color: var(--green); }
.hist-neg { color: var(--red); }
.hist-notas { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-actions { display: flex; gap: 4px; justify-content: flex-end; }

.hist-edit { padding: 8px 0; display: none; }
.hist-edit-form {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.hist-edit-form input[type="month"],
.hist-edit-form input[type="text"] { flex: 1; min-width: 110px; }
.hist-edit-actions { display: flex; gap: 4px; }

@media (max-width: 700px) {
  .hist-header { grid-template-columns: 80px 1fr auto; }
  .hist-header span:nth-child(3),
  .hist-header span:nth-child(4) { display: none; }
  .hist-view { grid-template-columns: 80px 1fr auto; }
  .hist-view .hist-var,
  .hist-view .hist-notas { display: none; }
}

/* ============================================================
   Gestão de Usuários
   ============================================================ */

.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left; padding: 8px 12px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.users-table td { padding: 12px 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.users-name { font-weight: 600; }
.users-username { color: var(--text-muted); font-size: 12px; }
.users-actions { text-align: right; white-space: nowrap; }

.role-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.role-admin { background: rgba(25,118,210,0.1); color: #1976d2; }
.role-viewer { background: rgba(107,114,128,0.1); color: #6b7280; }

.sidebar-users-link {
  font-size: 11px; color: var(--text-muted); text-decoration: none;
  padding: 2px 0; transition: color 0.15s;
}
.sidebar-users-link:hover, .sidebar-users-link.active { color: var(--text-primary); }

/* ------------------------------------------------------------------ */
/* NAV GROUP (expansivel) — sidebar                                    */
/* ------------------------------------------------------------------ */
.nav-group { list-style: none; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-group-summary:hover { background: rgba(0,0,0,0.035); color: var(--text-primary); }
.nav-group-summary.active { background: rgba(25,118,210,0.08); color: var(--teal); }
.nav-group-summary > svg:first-child { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-chevron { width: 14px !important; height: 14px !important; margin-left: auto; transition: transform 0.15s; opacity: 0.6; }
.nav-group[open] .nav-chevron { transform: rotate(180deg); }

.nav-group-children {
  display: flex;
  flex-direction: column;
  padding-left: 8px;
  margin: 2px 0 6px 0;
}
.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 20px 7px 42px;
  color: var(--text-muted);
  font-size: 13px;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-subitem:hover {
  background: rgba(0,0,0,0.03);
  color: var(--text-primary);
}
.nav-subitem.active {
  color: var(--teal);
  border-left-color: var(--teal);
  background: rgba(25,118,210,0.08);
}
.nav-subitem .badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* ------------------------------------------------------------------ */
/* STATUS GRID — pagina /status                                        */
/* ------------------------------------------------------------------ */
.status-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 760px;
}
.status-grid thead th {
  text-align: center;
  padding: 10px 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}
.status-grid thead th.status-row-label {
  text-align: left;
  padding-left: 16px;
  min-width: 200px;
  background: #ffffff;
  z-index: 3;
}

.status-row { border-bottom: 1px solid var(--border-light); }
.status-row:last-child { border-bottom: none; }

.status-row > td.status-row-label {
  text-align: left;
  padding: 10px 16px;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-widget);
  position: sticky;
  left: 0;
}
.status-row-name { font-size: 13px; }
.status-row-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.status-row-cartao > td.status-row-label { color: var(--blue); }
.status-row-receita > td.status-row-label { color: var(--green); }

.status-cell-td {
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
}

.status-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 56px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 0 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.05s;
}
.status-cell:hover:not(:disabled) { transform: translateY(-1px); }
.status-cell:disabled { opacity: 0.6; cursor: wait; }

.status-cell-cinza {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-muted);
  cursor: default;
}
.status-cell-amarelo {
  background: rgba(217,119,6,0.1);
  border-color: rgba(217,119,6,0.35);
  color: var(--yellow);
  cursor: pointer;
}
.status-cell-amarelo:hover { background: rgba(217,119,6,0.18); }
.status-cell-verde {
  background: rgba(22,163,74,0.12);
  border-color: rgba(22,163,74,0.4);
  color: var(--green);
  cursor: pointer;
}
.status-cell-verde:hover { background: rgba(22,163,74,0.18); }

.status-cell-valor { white-space: nowrap; }
.status-cell-empty { color: var(--text-muted); opacity: 0.4; }

.status-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  padding: 12px 16px;
  background: #f9fafb;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.status-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.status-legend-note {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 768px) {
  .status-legend-note { width: 100%; margin-left: 0; margin-top: 6px; }
}

/* ------------------------------------------------------------------ */
/* STATUS DRILL-DOWN — icone na celula + modal de detalhe              */
/* ------------------------------------------------------------------ */

/* Icone da lupa dentro da celula (status-cell-amarelo / status-cell-verde) */
.status-cell-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: 6px;
  border-radius: 50%;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.12s, background 0.12s, transform 0.05s;
  background: transparent;
  flex-shrink: 0;
}
.status-cell-detail:hover,
.status-cell-detail:focus {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
  outline: none;
}
.status-cell-detail:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.status-cell-detail svg {
  display: block;
}
/* Em celulas estreitas (mobile / grade apertada), o icone fica colado */
@media (max-width: 768px) {
  .status-cell-detail {
    width: 20px;
    height: 20px;
    margin-left: 4px;
  }
  .status-cell-detail svg { width: 12px; height: 12px; }
}

/* Estado do click no body — trava scroll */
body.status-modal-open {
  overflow: hidden;
}

/* Container do modal */
.status-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  animation: status-modal-fade 0.18s ease-out;
}
.status-modal[hidden] { display: none; }

@keyframes status-modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.status-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.status-modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.15),
    0 10px 10px -5px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 880px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: status-modal-pop 0.18s ease-out;
}

@keyframes status-modal-pop {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.status-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 22px 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 2;
  flex-shrink: 0;
}
.status-modal-header-info {
  flex: 1;
  min-width: 0;
}
.status-modal-title {
  margin: 0 0 6px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.status-modal-subline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.status-modal-total {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.status-modal-state {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid currentColor;
  background: transparent;
}
.status-modal-state.status-cell-cinza   { color: var(--text-muted);  background: rgba(107,114,128,0.08); }
.status-modal-state.status-cell-amarelo { color: var(--yellow);      background: rgba(217,119,6,0.12); }
.status-modal-state.status-cell-verde   { color: var(--green);       background: rgba(22,163,74,0.12); }
.status-modal-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.status-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.status-modal-close:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.status-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.status-modal-loading,
.status-modal-empty {
  padding: 36px 22px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.status-modal-footnote {
  padding: 12px 22px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-light);
  text-align: center;
}

.status-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.status-modal-table thead th {
  position: sticky;
  top: 0;
  background: #f9fafb;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.status-modal-table tbody td {
  padding: 11px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}
.status-modal-table tbody tr:last-child td { border-bottom: none; }
.status-modal-table tbody tr:hover { background: var(--bg-hover); }

.status-modal-table .col-data   { width: 100px; white-space: nowrap; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.status-modal-table .col-desc   { min-width: 200px; }
.status-modal-table .col-cat    { width: 200px; }
.status-modal-table .col-conta  { width: 160px; color: var(--text-secondary); }
.status-modal-table .col-valor  { width: 130px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }

.modal-tx-cat {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.modal-tx-cat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.modal-tx-cat-name {
  font-size: 13px;
  color: var(--text-primary);
}
.modal-tx-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 18px;
  display: inline-block;
  margin-top: 2px;
}

.modal-tx-valor-receita { color: var(--success); }
.modal-tx-valor-despesa { color: var(--danger); }

.status-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}
.status-modal-footer .btn { flex-shrink: 0; }

@media (max-width: 768px) {
  .status-modal {
    padding: 0;
    align-items: stretch;
  }
  .status-modal-content {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .status-modal-header {
    padding: 14px 16px 12px 16px;
  }
  .status-modal-title { font-size: 15px; }
  .status-modal-total { font-size: 18px; }
  .status-modal-body { padding: 4px 0; }
  .status-modal-table { font-size: 12px; }
  .status-modal-table thead { display: none; }
  .status-modal-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "data valor"
      "desc valor"
      "cat  cat"
      "conta conta";
    gap: 2px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
  }
  .status-modal-table tbody td {
    border: none;
    padding: 0;
  }
  .status-modal-table .col-data  { grid-area: data; font-size: 11px; }
  .status-modal-table .col-desc  { grid-area: desc; font-weight: 500; }
  .status-modal-table .col-cat   { grid-area: cat; }
  .status-modal-table .col-conta { grid-area: conta; font-size: 11px; }
  .status-modal-table .col-valor { grid-area: valor; align-self: center; font-size: 14px; }
  .status-modal-footer {
    padding: 12px 16px;
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .status-modal-footer .btn { width: 100%; text-align: center; }
}

/* ------------------------------------------------------------------ */
/* 30. STICKY BAR (utility) — barras de filtros, headers de acao e   */
/*     toolbars ficam fixos no topo ao rolar. Aplicado em pages com  */
/*     scroll longo: status, contas, categorias, conta_detalhe.      */
/*     NAO usar em cards-grid grandes nem em listas/graficos.        */
/* ------------------------------------------------------------------ */

.sticky-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-body);
  /* sangra para os lados pra cobrir o padding lateral do main-content
     e evitar transparencia visivel nas bordas ao rolar */
  margin-left: -16px;
  margin-right: -16px;
  padding: 12px 16px 12px 16px;
  /* sombra sutil pra dar separacao visual quando ha conteudo passando por baixo */
  box-shadow: var(--shadow-sticky);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .sticky-bar {
    margin-left: -28px;
    margin-right: -28px;
    padding: 16px 28px 16px 28px;
    margin-bottom: 20px;
  }
}

/* Quando o sticky-bar abriga page-header + cards + filtros (como em
   conta_detalhe), neutraliza margin-bottom do ultimo bloco interno */
.sticky-bar > .cards-grid:last-child,
.sticky-bar > .filters-bar:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ */
/* 31. CONTA_DETALHE — estilos especificos                            */
/* ------------------------------------------------------------------ */

.conta-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid rgba(0,0,0,0.1);
}

.badge-inactive {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  background: rgba(107,114,128,0.12);
  color: var(--text-muted);
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ------------------------------------------------------------------ */
/* 32. PAGINATION (lista de transacoes paginada)                      */
/* ------------------------------------------------------------------ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* 33. SUPORTE A REGRESSAO DE STATUS — sticky no header do grid       */
/* ------------------------------------------------------------------ */

/* O status-grid ja tem thead sticky proprio (top:0 contra o widget).
   Quando o page-header tambem fica sticky acima, o thead sticky do
   grid passa por tras do header. Garantimos hierarquia correta. */
.status-grid thead th { z-index: 2; }

/* ------------------------------------------------------------------ */
/* 34. CATEGORIAS — Layout 2 colunas (Fase A subcategorias)           */
/* ------------------------------------------------------------------ */

/* Tabs Despesas / Receitas dentro do sticky-bar */
.cat-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.cat-tab {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cat-tab:hover { color: var(--text-primary); background: var(--bg-hover); border-color: var(--border-hover); }
.cat-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.cat-mes-label {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

/* Grid de 2 colunas (desktop) / empilha (mobile) */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 4px;
}

@media (min-width: 900px) {
  .cat-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.4fr);
    gap: 20px;
  }
}

.cat-col {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* COLUNA ESQUERDA — lista de categorias */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cat-list-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  width: 100%;
}

.cat-item:hover {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--border);
}

.cat-item.selected {
  background: var(--primary-light-bg);
  border-color: var(--primary);
}

.cat-item-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.cat-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cat-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-item-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.cat-item-total {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.cat-item-total.neg { color: var(--red); }
.cat-item-total.pos { color: var(--teal-light, #5eead4); }

.cat-list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.cat-list-total {
  font-weight: 600;
  color: var(--text-primary);
}

/* COLUNA DIREITA — painel de subcategorias */
.cat-sub-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.cat-sub-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-sub-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.subcat-tag {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
}

.subcat-tag-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: 6px;
}

/* Header info usado no form de subcategoria */
.subcat-header-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Tabela de subcategorias */
.subcat-table {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.subcat-table-header,
.subcat-table-row {
  display: grid;
  grid-template-columns: 1fr 70px 110px 70px 90px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.subcat-table-header {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.subcat-table-row {
  background: transparent;
  border-radius: var(--radius-sm);
}

.subcat-table-row:hover {
  background: rgba(0, 0, 0, 0.03);
}

.subcat-name {
  font-weight: 500;
  color: var(--text-primary);
}

.subcat-total {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
}

.subcat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.cat-sub-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state-soft {
  color: var(--text-muted);
  font-size: 13px;
  padding: 24px 12px;
  text-align: center;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
}

/* Mobile: tabela mais compacta */
@media (max-width: 600px) {
  .subcat-table-header,
  .subcat-table-row {
    grid-template-columns: 1fr 100px 80px;
    font-size: 12px;
    gap: 6px;
  }
  /* Esconde colunas "Tx (mes)" e "Tx (total)" no mobile pra caber */
  .subcat-table-header > :nth-child(2),
  .subcat-table-header > :nth-child(4),
  .subcat-table-row > :nth-child(2),
  .subcat-table-row > :nth-child(4) {
    display: none;
  }
}

/* Form help text geral (usado no transaction_form e subcategoria_form) */
.form-help {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.form-help a { color: var(--teal-light, #5eead4); text-decoration: underline; }

/* ================================================================== */
/* 35. CAT BADGE — Circulo colorido com icone branco dentro            */
/*     Reaproveitavel em /transacoes, /contas/<id>, /cartoes/<id>,    */
/*     /dashboard, /configuracoes/categorias.                         */
/* ================================================================== */

.cat-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  line-height: 0;
}

.cat-badge .cat-badge-icon,
.cat-badge .lucide-icon {
  color: #fff;
  display: block;
}

.cat-badge-sm { width: 18px; height: 18px; }
.cat-badge-md { width: 24px; height: 24px; }
.cat-badge-lg { width: 32px; height: 32px; }
.cat-badge-xl { width: 40px; height: 40px; }

/* Lucide icon base */
.lucide-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Pill texto + badge (usado em pequenos lugares) */
.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-pill-text {
  font-size: 13px;
  color: var(--text-primary);
}

/* ================================================================== */
/* 36. ICON PICKER — grid agrupado por categoria visual                */
/* ================================================================== */

.icon-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.02);
  padding: 12px;
}

.icon-picker-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.icon-picker-preview-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.icon-picker-preview-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
}

.icon-picker-preview-name {
  font-size: 13px;
  color: var(--text-primary);
  font-family: monospace;
  flex: 1;
  min-width: 0;
}

.icon-picker-clear { margin-left: auto; }

.icon-picker-group {
  margin-top: 6px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}
.icon-picker-group:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.icon-picker-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}
.icon-picker-group-title:hover { color: var(--text-primary); }

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.icon-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s, border-color 0.12s, transform 0.08s;
  padding: 0;
}
.icon-pick-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
  border-color: var(--text-muted);
}
.icon-pick-btn:active { transform: scale(0.94); }

.icon-pick-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.icon-pick-svg { color: inherit; }

/* ================================================================== */
/* 37. PREVIEW BADGE no form de categoria/subcategoria                 */
/* ================================================================== */

.cat-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.cat-preview-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ================================================================== */
/* 38. CATEGORIAS — refinamento estilo Minhas Financas                 */
/* ================================================================== */

/* Botao laranja destacado pra "+ Nova subcategoria" */
.btn.btn-orange {
  background: #ef6c00;
  color: #fff;
  border-color: #ef6c00;
}
.btn.btn-orange:hover {
  background: #e65100;
  border-color: #e65100;
}
.btn-nova-sub {
  display: inline-flex !important;
  align-items: center;
  font-weight: 600;
  box-shadow: 0 2px 8px -2px rgba(239, 108, 0, 0.55);
}

/* Header do painel de subcategorias mais arejado */
.cat-sub-header-info {
  flex: 1;
  min-width: 0;
}

/* Ajuste do cat-item-info quando ha badge maior */
.cat-item {
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
}
.cat-item .cat-item-info {
  min-width: 0;
}

/* Item hover sutil */
.cat-item:hover .cat-item-name {
  color: var(--text-primary);
}

/* Mobile tabs (Categorias / Subcategorias) — so visiveis em mobile */
.cat-mobile-tabs {
  display: none;
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.cat-mobile-tab {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cat-mobile-tab:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}
.cat-mobile-tab.active {
  background: var(--primary);
  color: #fff;
}
.cat-mobile-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 899px) {
  .cat-mobile-tabs { display: flex; }

  /* No mobile so 1 coluna visivel por vez via .active-mobile */
  .cat-col-categorias,
  .cat-col-subcats {
    display: none;
  }
  .cat-col-categorias.active-mobile,
  .cat-col-subcats.active-mobile {
    display: block;
  }
}

/* No subcat-table, nome agora vem com badge — ajuste gap */
.subcat-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Subcat actions: substituido por ícone, sem texto */
.subcat-actions .action-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.subcat-actions .action-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-primary);
}

/* ================================================================== */
/* 39. TX-TABLE com COLUNA SUBCATEGORIA                                */
/* ================================================================== */

/* Default grid pra /transacoes (com subcategoria) */
.tx-tr-grid {
  display: grid;
  grid-template-columns: 88px 1fr 110px 110px 110px 90px 110px 90px 60px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

/* Texto da subcategoria com elipsis */
.tx-subcat,
.tx-subcat-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12.5px;
}
.tx-subcat-text {
  display: inline;
}

.tx-desc-full {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
}
.tx-desc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tablet/mobile: esconde subcategoria pra caber */
@media (max-width: 1024px) {
  .tx-table-with-subcat .tx-subcat-col {
    display: none !important;
  }
  /* Em /transacoes, recalcula o grid sem a coluna subcat (4o filho) */
  .tx-tr-grid {
    grid-template-columns: 88px 1fr 110px 110px 90px 110px 90px 60px;
  }
}

@media (max-width: 768px) {
  /* Em mobile, header da tx-table some (ja existia em outro lugar mas garante) */
  .tx-table-with-subcat .tx-table-header { display: none; }
}

/* === NerdTech Period Selector — 2026-06-08 === */
/* ============================================================
   PERIOD SELECTOR — Nekos Finance
   Dropdown + painel (desktop) / modal full-screen (mobile)
   Substitui o "month-nav + period-toggle" anterior.
   ============================================================ */

.period-selector {
  position: relative;
  display: inline-block;
}

.period-dropdown-btn {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.period-dropdown-btn:hover {
  border-color: var(--border-hover);
}

.period-dropdown-btn[aria-expanded="true"] {
  border-color: var(--primary);
}

/* Label central: agora e o botao real que abre o painel */
.period-dropdown-label-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  min-height: 38px;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.period-dropdown-label-btn:hover {
  background: var(--bg-hover);
}

.period-dropdown-label-btn[aria-expanded="true"] {
  background: var(--primary-light-bg);
  color: var(--primary);
}

.period-dropdown-label-btn .period-icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.period-dropdown-label-btn[aria-expanded="true"] .period-icon { color: var(--primary); }

.period-dropdown-label-btn .period-dropdown-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.period-dropdown-label-btn .period-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.period-dropdown-label-btn[aria-expanded="true"] .period-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Setas de navegacao mes anterior / proximo mes */
.period-nav-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.period-nav-arrow:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.period-nav-arrow:active {
  background: var(--primary-light-bg);
  color: var(--primary);
}

.period-nav-prev {
  border-right: 1px solid var(--border);
}

.period-nav-next {
  border-left: 1px solid var(--border);
}

.period-selector.has-arrows .period-dropdown-label-btn {
  flex: 1;
}

/* ---------- Painel (desktop) ---------- */

.period-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 460px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  overflow: hidden;
}

.period-panel-header {
  display: none; /* so aparece em mobile */
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.period-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.period-panel-close {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 50%;
}
.period-panel-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.period-panel-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.period-presets,
.period-custom {
  padding: 14px 16px;
}

.period-presets { border-right: 1px solid var(--border); }

.period-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

.period-preset-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.period-preset-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.period-preset-item:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.period-preset-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.period-preset-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.period-preset-item.is-active {
  background: var(--primary-light-bg);
  color: var(--primary);
  font-weight: 600;
}

.period-preset-item.is-active .period-preset-dot {
  border-color: var(--primary);
  background: radial-gradient(circle, var(--primary) 0 5px, var(--bg-card) 6px);
}

.period-preset-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Custom form ---------- */

.period-custom-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.period-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.period-field > span {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.period-field input[type="date"] {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
}

.period-field input[type="date"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}

.period-apply-btn {
  margin-top: 4px;
  align-self: stretch;
}

.period-error {
  margin-top: 8px;
  padding: 8px 10px;
  background: var(--danger-light-bg);
  color: var(--danger);
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
}

/* ---------- Overlay (so usado em mobile) ---------- */

.period-overlay {
  display: none;
}

/* ---------- Mobile: full-screen modal ---------- */

@media (max-width: 720px) {
  .period-selector { width: 100%; }

  .period-dropdown-btn {
    width: 100%;
    justify-content: space-between;
  }

  .period-dropdown-label-btn {
    flex: 1;
    justify-content: space-between;
  }

  .period-dropdown-label-btn .period-dropdown-label {
    max-width: none;
    flex: 1;
    text-align: left;
  }

  .period-nav-arrow {
    min-width: 48px;
    padding: 0 12px;
  }

  .period-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 60;
  }

  .period-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 70;
    min-width: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.25);
    animation: periodPanelSlideUp 0.22s ease-out;
  }

  .period-panel-header {
    display: flex;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 2;
  }

  .period-panel-body {
    grid-template-columns: 1fr;
  }

  .period-presets {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .period-preset-item {
    padding: 12px 10px;
    font-size: 15px;
  }

  .period-field input[type="date"] {
    padding: 12px 10px;
    font-size: 16px; /* evita zoom no iOS */
  }

  body.period-panel-open {
    overflow: hidden;
  }
}

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

/* ---------- Container: alinhamento dentro do page-header ---------- */

.page-header .period-selector,
.filters-bar .period-selector {
  margin-right: 8px;
}


/* ------------------------------------------------------------------ */
/* 35. TX SEARCH BAR (transactions.html — busca por texto)            */
/* ------------------------------------------------------------------ */

.tx-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 320px;
}

.tx-search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.tx-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 32px 7px 32px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tx-search-input::placeholder {
  color: var(--text-muted);
  font-size: 12.5px;
}

.tx-search-input:focus {
  outline: none;
  border-color: var(--primary, #2563EB);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* Esconde o x nativo do type=search no Chrome/Safari pra usar so o nosso */
.tx-search-input::-webkit-search-cancel-button,
.tx-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.tx-search-clear {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}
.tx-search-clear:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text-primary);
}
.tx-search-clear svg {
  width: 14px;
  height: 14px;
}

/* Filtros colapsaveis (default = aberto inline no desktop) */
.tx-filters-collapse {
  display: contents; /* desktop: filhos viram filhos diretos do .filters-form */
}
.tx-filters-summary {
  display: none; /* desktop: esconde o Filtros — campos ja sao visiveis */
}
.tx-filters-fields {
  display: contents; /* desktop: selects ficam inline no flex do form */
}

/* Mobile: colapsa filtros num botao */
@media (max-width: 768px) {
  .tx-search-wrap {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
    order: -1; /* busca sempre no topo */
  }

  .tx-filters-collapse {
    display: block;
    flex: 1 1 100%;
    min-width: 0;
  }

  .tx-filters-summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    list-style: none;
    user-select: none;
  }
  .tx-filters-summary::-webkit-details-marker { display: none; }
  .tx-filters-summary svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
  }
  .tx-filters-collapse[open] .tx-filters-summary {
    border-color: var(--primary, #2563EB);
    color: var(--primary, #2563EB);
  }
  .tx-filters-collapse[open] .tx-filters-summary svg {
    color: var(--primary, #2563EB);
  }

  .tx-filters-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
  }
  .tx-filters-fields select {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .tx-filters-fields {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ */
/* 36. COLUMN FILTERS (expenses.html / incomes.html — header dropdowns) */
/* ------------------------------------------------------------------ */

/* Grid sem coluna Origem (receitas) — coluna a menos */
.tx-tr-grid-no-origem {
  grid-template-columns: 90px 1fr 130px 140px 130px 110px 110px 70px !important;
}

.col-filter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.col-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 2px 4px;
  margin: -2px -4px;
  font-size: inherit;
  color: inherit;
  font-weight: inherit;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
  white-space: nowrap;
  max-width: 100%;
  transition: background 0.15s;
}
.col-filter-btn:hover {
  background: rgba(37,99,235,0.08);
}
.col-filter-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-filter-icon {
  width: 12px;
  height: 12px;
  opacity: 0.55;
  flex-shrink: 0;
  display: block;
  overflow: visible;
}
.col-filter-wrap.col-filter-active .col-filter-btn {
  color: var(--primary, #2563EB);
}
.col-filter-wrap.col-filter-active .col-filter-icon {
  opacity: 1;
  color: var(--primary, #2563EB);
}
.col-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  background: var(--primary, #2563EB);
  color: #fff;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

.col-filter-pop[hidden] { display: none; }
.col-filter-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.col-filter-options {
  padding: 6px 0;
  max-height: 280px;
  overflow-y: auto;
}
.col-filter-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 400;
  cursor: pointer;
  transition: background 0.1s;
}
.col-filter-opt:hover {
  background: rgba(37,99,235,0.06);
}
.col-filter-opt input[type=checkbox] {
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--primary, #2563EB);
}
.col-filter-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}
.col-filter-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
}
.col-filter-footer button {
  flex: 1;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.col-filter-footer button:hover {
  background: rgba(0,0,0,0.04);
}
.col-filter-apply {
  background: var(--primary, #2563EB) !important;
  border-color: var(--primary, #2563EB) !important;
  color: #fff !important;
  font-weight: 600;
}
.col-filter-apply:hover {
  filter: brightness(0.95);
}

/* Form que envolve a tabela: zera margens/contornos pra nao quebrar layout */
.col-filters-form {
  margin: 0;
  padding: 0;
  border: none;
}

/* Botao "Filtros" mobile na sticky-bar */
.tx-filters-btn-mobile {
  display: none;
  align-items: center;
  gap: 6px;
  position: relative;
}
.tx-filters-btn-mobile svg {
  width: 14px;
  height: 14px;
}
.tx-filters-btn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary, #2563EB);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

/* ------------------------------------------------------------------ */
/* 37. MOBILE — header dropdowns viram bottom-sheet                    */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  /* No mobile, o header da coluna NAO abre dropdown (tabela tem scroll-x).
     Os botoes ficam la apenas mostrando o estado, sem ser clicaveis. */
  .col-filter-btn { pointer-events: none; }
  .col-filter-pop { display: none !important; }

  .tx-filters-btn-mobile { display: inline-flex; }

  /* Garante grid no-origem nao quebra no mobile */
  .tx-tr-grid-no-origem {
    grid-template-columns: 90px 1fr 130px 140px 130px 110px 110px 70px !important;
  }
}

/* Bottom-sheet */
.tx-mobile-sheet[hidden] { display: none; }
.tx-mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.tx-mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}
.tx-mobile-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.2);
}
.tx-mobile-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.tx-mobile-sheet-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: inline-flex;
}
.tx-mobile-sheet-close svg { width: 18px; height: 18px; }
.tx-mobile-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 0;
}
.tx-mobile-section {
  border-bottom: 1px solid var(--border);
  padding: 4px 0;
}
.tx-mobile-section:last-of-type { border-bottom: none; }
.tx-mobile-section > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  list-style: none;
}
.tx-mobile-section > summary::-webkit-details-marker { display: none; }
.tx-mobile-section > summary span:first-child { flex: 1; }
.tx-mobile-section > summary svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.tx-mobile-section[open] > summary svg { transform: rotate(180deg); }
.tx-mobile-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary, #2563EB);
  color: #fff;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.tx-mobile-options {
  padding: 4px 4px 12px;
  max-height: 240px;
  overflow-y: auto;
}
.tx-mobile-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.tx-mobile-opt:hover {
  background: rgba(37,99,235,0.06);
}
.tx-mobile-opt input[type=checkbox] {
  margin: 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--primary, #2563EB);
}
.tx-mobile-sheet-footer {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
}
.tx-mobile-sheet-footer .btn { flex: 1; }


/* ================================================================== */
/* 41. TX-TABLE v2 — Redesign 2026-06-29 (estilo Minhas Financas)      */
/* ================================================================== */

/* Grid unico para despesas e receitas (origem removida) */
/* Colunas: [STATUS 40px] [DATA 76px] [DESC 1fr] [CAT 130px] [SUBCAT 130px] [CONTA 160px] [VALOR 100px] [ACOES 60px] */
.tx-tr-grid-v2 {
  display: grid !important;
  grid-template-columns: 40px 76px 1fr 130px 130px 160px 100px 60px;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.tx-table-v2 .tx-table-header.tx-tr-grid-v2 {
  padding: 10px 14px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.tx-table-v2 .tx-table-row.tx-tr-grid-v2 {
  transition: background 0.1s;
}
.tx-table-v2 .tx-table-row.tx-tr-grid-v2:hover { background: rgba(0,0,0,0.025); }
.tx-table-v2 .tx-table-row.tx-tr-grid-v2.tx-previsto { opacity: 1; }
/* substitui o opacity:.65 antigo — agora o status visual ja eh o icone */

/* ===== Coluna 1: icone de status ===== */
.tx-status-col-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tx-status-icon-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tx-status-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tx-status-icon svg {
  width: 16px; height: 16px;
  display: block;
}
.tx-status-pago {
  background: rgba(22,163,74,0.14);
  color: #15803d;
}
.tx-status-previsto {
  background: rgba(220,38,38,0.10);
  color: #dc2626;
}
.tx-status-atrasado {
  background: rgba(245,158,11,0.16);
  color: #b45309;
}

/* Header do status (so o icone do filtro centralizado) */
.tx-table-v2 .tx-status-col-header .col-filter-btn {
  padding: 4px;
  margin: 0;
}
.tx-table-v2 .tx-status-col-header .col-filter-label { display: none; }
.tx-table-v2 .tx-status-col-header .col-filter-icon { width: 14px; height: 14px; opacity: 0.8; }
.tx-table-v2 .tx-status-col-header .col-filter-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  font-size: 9px;
}

/* ===== Data ===== */
.tx-table-v2 .tx-date {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 12.5px;
}

/* ===== Descricao ===== */
.tx-table-v2 .tx-desc-full {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tx-table-v2 .tx-desc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-weight: 500;
}

/* ===== Categoria / Subcategoria como pill colorido ===== */
.tx-cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: color-mix(in srgb, var(--cat-color, #6b7280) 14%, transparent);
  color: color-mix(in srgb, var(--cat-color, #6b7280) 100%, #000 20%);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  max-width: 100%;
  min-width: 0;
  line-height: 1.2;
}
.tx-cat-badge-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tx-cat-badge-chev {
  width: 11px; height: 11px;
  flex-shrink: 0;
  opacity: 0.7;
}
.tx-cat-badge-sub {
  background: color-mix(in srgb, var(--cat-color, #6b7280) 8%, transparent);
  font-weight: 500;
  font-size: 11.5px;
  padding: 4px 9px;
}
/* Fallback pra browsers sem color-mix (Safari < 16.4): pinta uniforme */
@supports not (background: color-mix(in srgb, red 10%, transparent)) {
  .tx-cat-badge { background: rgba(107,114,128,0.12); color: #1f2937; }
  .tx-cat-badge-sub { background: rgba(107,114,128,0.07); }
}
.tx-cat-empty { color: var(--text-muted); }

/* ===== Conta com avatar ===== */
.tx-account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.tx-account-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.tx-account-avatar svg {
  width: 13px; height: 13px;
}
.tx-account-name {
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ===== Valor ===== */
.tx-table-v2 .tx-value-col {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}

/* ===== Headers ocupando a celula inteira (botoes de filtro) ===== */
.tx-table-v2 .tx-table-header .col-filter-btn {
  width: 100%;
  justify-content: space-between;
}

/* ===== Responsivo ===== */
/* Tablet: esconde subcategoria — coluna a menos */
@media (max-width: 1100px) {
  .tx-tr-grid-v2 {
    grid-template-columns: 40px 76px 1fr 120px 150px 100px 60px;
  }
  .tx-table-v2 .tx-subcat-col {
    display: none !important;
  }
}

/* Mobile (<= 768px): vira stack como ja era */
@media (max-width: 768px) {
  .tx-table-v2 .tx-table-header { display: none; }
  .tx-table-v2 .tx-table-row.tx-tr-grid-v2 {
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 4px 10px;
    padding: 12px 14px;
  }
  .tx-table-v2 .tx-status-icon-cell { grid-row: 1 / 4; align-self: center; }
  .tx-table-v2 .tx-date {
    grid-column: 2; grid-row: 1;
    font-size: 11px;
    color: var(--text-muted);
  }
  .tx-table-v2 .tx-desc-full {
    grid-column: 2; grid-row: 2;
  }
  .tx-table-v2 .tx-cat,
  .tx-table-v2 .tx-account {
    grid-column: 2; grid-row: 3;
    display: inline-flex;
  }
  .tx-table-v2 .tx-account { justify-content: flex-end; }
  .tx-table-v2 .tx-value-col {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    font-size: 14px;
  }
  .tx-table-v2 .tx-actions {
    grid-column: 3;
    grid-row: 3;
    justify-content: flex-end;
  }
}

/* =========================================================
   Toggle "marcar como pago" — botao em volta do icone de status
   (Conta corrente apenas; cartao fica inerte com aria-disabled)
   ========================================================= */
.tx-status-icon-btn {
  /* button reset */
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  /* mantem layout do .tx-status-icon (circulo colorido) */
  /* touch target >= 44px sem mudar o visual: hit area via outline */
  position: relative;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.tx-status-icon-btn::after {
  /* aumenta a area clicavel para 44x44 mantendo o visual de 28x28 */
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
}
.tx-status-icon-btn:hover {
  filter: brightness(0.95);
  transform: scale(1.08);
}
.tx-status-icon-btn:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 2px;
}
.tx-status-icon-btn:active {
  transform: scale(0.95);
}
.tx-status-icon-btn[disabled],
.tx-status-icon-btn.tx-status-loading {
  cursor: progress;
  opacity: 0.6;
}
.tx-status-icon-disabled {
  cursor: default;
  opacity: 0.65;
}

/* =========================================================
   /cartoes/<id> — fatura mensal (bloco agrupado por debit_date)
   ========================================================= */
.card-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-month-header-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-month-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fatura-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
}
.fatura-badge svg { width: 14px; height: 14px; }
.fatura-badge-aberta {
  background: rgba(220,38,38,0.10);
  color: #b91c1c;
}
.fatura-badge-paga {
  background: rgba(22,163,74,0.14);
  color: #15803d;
}
.fatura-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.fatura-action-btn svg { width: 16px; height: 16px; }
.fatura-action-marcar {
  background: #15803d; color: #fff; border-color: #15803d;
}
.fatura-action-marcar:hover { background: #166534; border-color: #166534; }
.fatura-action-reabrir {
  background: #fff; color: #b91c1c; border-color: #fecaca;
}
.fatura-action-reabrir:hover { background: #fef2f2; border-color: #fca5a5; }
.fatura-action-btn[disabled] { opacity: 0.6; cursor: progress; }
