/* ============================================================
   MEU GESTOR — style.css
   Versão organizada e comentada para estudo
   Responsivo: Desktop (sidebar fixa) + Mobile (barra inferior)

   ÍNDICE:
   1. Variáveis de tema (Light e Dark)
   2. Reset & Base
   3. Layout — Sidebar (nav)
   4. Layout — Cabeçalho (header)
   5. Layout — Conteúdo principal
   6. Layout — Overlay do menu mobile
   7. Componente — Login
   8. Componente — Dashboard (cards de resumo)
   9. Componente — Tabelas
  10. Componente — Coluna de ações fixas na tabela
  11. Componente — Formulários
  12. Componente — Botões
  13. Componente — Card de Empréstimo
  14. Componente — Freemium: Paywall, Planos, Banner, Chip
  15. Animações (@keyframes)
  16. Dark Mode (todas as correções unificadas)
  17. Responsivo — Mobile (≤ 800px)
  18. Responsivo — Telas muito pequenas (≤ 380px)
  19. Responsivo — Desktop (≥ 801px)
   ============================================================ */


/* ============================================================
   1. VARIÁVEIS DE TEMA
   Centraliza todas as cores e tamanhos. Trocar aqui reflete
   em todo o app automaticamente.
   ============================================================ */
:root {
  /* Cores principais */
  --primary:        #2563eb;   /* azul principal (botões, links, sidebar) */
  --primary-dark:   #1e40af;   /* azul escuro (hover) */
  --success:        #16a34a;   /* verde (salvar, quitado) */
  --danger:         #dc2626;   /* vermelho (excluir, atraso) */
  --warning:        #f59e0b;   /* amarelo (atenção) */

  /* Cores de texto */
  --text:           #747474;   /* texto padrão */
  --text-muted:     #6b7280;   /* texto secundário (subtítulos, labels) */

  /* Cores de fundo e bordas */
  --bg:             #f1f5f9;   /* fundo da página */
  --card-bg:        #ffffff;   /* fundo dos cards e modais */
  --border:         #e5e7eb;   /* cor das bordas */

  /* Navegação lateral */
  --nav-bg:         #0f172a;
  --nav-text:       rgba(255,255,255,.8);
  --nav-hover:      rgba(255,255,255,.07);
  --nav-active:     rgba(96,165,250,.18);
  --nav-active-border: #60a5fa;

  /* Cabeçalho */
  --header-bg:      #1e3a8a;

  /* Dimensões fixas do layout */
  --nav-width:      240px;     /* largura da sidebar */
  --header-h:       64px;      /* altura do cabeçalho */
  --bottom-nav-h:   64px;      /* altura da barra inferior mobile */
}

/* Dark Mode: redefine as variáveis. Não precisa reescrever regras! */
body.dark-mode {
  --primary:      #3b82f6;
  --primary-dark: #2563eb;
  --text:         #727272;
  --text-muted:   #9ca3af;
  --bg:           #111827;
  --card-bg:      #1f2937;
  --border:       #374151;
  --nav-bg:       #0d1117;
  --nav-hover:    rgba(255,255,255,.06);
  --nav-active:   rgba(96,165,250,.15);
  --header-bg:    #0d1117;
}


/* ============================================================
   2. RESET & BASE
   Remove margens padrão do navegador e define a fonte global.
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box; /* padding e border não aumentam o tamanho do elemento */
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: #727272;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Herda a fonte do body para não quebrar botões */
button {
  font-family: inherit;
}

/* Classe utilitária para esconder qualquer elemento */
.hidden {
  display: none !important;
}

/* Títulos de seção dentro dos cards */
h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -.3px;
}

.section-title {
  color: #1e3a8a;
  margin: 0 0 4px;
  font-size: 1.1rem;
  font-weight: 700;
}


/* ============================================================
   3. LAYOUT — SIDEBAR (nav)
   Posição fixa à esquerda, altura total, com scroll vertical.
   No mobile ela fica escondida e desliza para dentro.
   ============================================================ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-width);
  height: 100vh;              /* ocupa toda a altura da tela */
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding-top: 16px;
  padding-bottom: 80px;       /* espaço para o logo no rodapé */
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s ease; /* animação de deslizar no mobile */
}

/* Botões do menu lateral */
nav button {
  all: unset;                 /* remove todos os estilos padrão de botão */
  cursor: pointer;
  color: var(--nav-text);
  width: 100%;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: .1px;
  transition: background .2s;
  box-sizing: border-box;
  position: relative;          /* para o badge ser posicionado dentro */
}

nav button:hover  {
  background: var(--nav-hover);
  color: #fff;
}
nav button.active {
  background: var(--nav-active);
  border-left: 3px solid var(--nav-active-border, #60a5fa);
  color: #fff;
}

nav button i,
nav button span { color: inherit; }
nav button i    { font-size: 18px; min-width: 20px; opacity: .75; }
nav button.active i { opacity: 1; }

/* Badge de notificação dentro do botão do menu */
nav .badge {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  display: none;               /* escondido por padrão */
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--nav-bg);
  pointer-events: none;
}
nav .badge.show { display: inline-flex; } /* JS adiciona .show quando há avisos */

/* Logo no rodapé da sidebar */
.nav-logo {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo img       { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.nav-logo-text      { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.7); white-space: nowrap; }


/* ============================================================
   4. LAYOUT — CABEÇALHO (header)
   Fixo no topo, começa após a sidebar.
   ============================================================ */
header {
  position: fixed;
  top: 0;
  left: var(--nav-width);    /* começa depois da sidebar */
  right: 0;
  height: var(--header-h);
   background: linear-gradient(135deg, #0f172a 0%, #1a2f6e 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 400;
  border-radius: 0 0 16px 16px;
  margin: 0;
  right: 0;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
}

/* Logo + nome do app no cabeçalho */
.titulo-app {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: #fff;
}
.titulo-app img { height: 40px; width: auto; }

/* Botão hamburguer — só aparece no mobile */
#btnMenuToggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  line-height: 1;
}

/* Chip de plano no canto do header (ex: "Pro", "Grátis") */
.chip-plano {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: .4px;
}
.chip-plano.free { background: rgba(255,255,255,.2); color: #fff; border: 1px solid rgba(255,255,255,.4); }
.chip-plano.pro  { background: #fbbf24; color: #78350f; }


/* ============================================================
   5. LAYOUT — CONTEÚDO PRINCIPAL
   O #telaPrincipal empurra o conteúdo para fora da sidebar.
   O .conteudo respeita o cabeçalho fixo com margin-top.
   ============================================================ */
#telaPrincipal {
  margin-left: var(--nav-width); /* evita que o conteúdo fique embaixo da sidebar */
  min-height: 100vh;
}

.conteudo {
  margin-top: calc(var(--header-h) + 20px); /* começa abaixo do cabeçalho */
  padding: 0 24px 40px;
  max-width: 1060px;
  margin-left: auto;
  margin-right: auto;
}


/* ============================================================
   6. LAYOUT — OVERLAY DO MENU MOBILE
   Escurece o fundo quando a sidebar está aberta no mobile.
   ============================================================ */
#navOverlay {
  display: none;
  position: fixed;
  inset: 0;                   /* ocupa toda a tela */
  background: rgba(0,0,0,.45);
  z-index: 999;
}
#navOverlay.show { display: block; }


/* ============================================================
   7. COMPONENTE — LOGIN
   Card centralizado com logo, inputs e botão de entrar.
   ============================================================ */
.card-login {
  max-width: 380px;
  width: 92%;
  margin: 60px auto;
  background: var(--card-bg);
  padding: 36px 28px;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  text-align: center;
}

.card-login h2 {
  color: var(--primary);
  margin: 0 0 24px;
  font-size: 1.8rem;
  font-weight: 700;
}

.card-login input {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
  transition: border .2s;
}
.card-login input:focus { border-color: var(--primary); outline: none; }

.card-login button {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s, transform .15s;
  font-family: inherit;
}
.card-login button:hover    { background: var(--primary-dark); transform: scale(1.02); }
.card-login button:disabled { opacity: .65; cursor: not-allowed; transform: none; }


/* ============================================================
   8. COMPONENTE — DASHBOARD
   Grid de cards com métricas (total emprestado, quitados…).
   ============================================================ */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* colunas flexíveis */
  gap: 16px;
  margin-top: 90px;
}

.card-dashboard {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  border: 1px solid #f1f5f9;
  text-align: center;
  transition: box-shadow .2s, transform .2s;
}
.card-dashboard:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  transform: translateY(-3px);
}

/* Bordas coloridas à esquerda para indicar status */
.card-dashboard.verde    { border-left: 5px solid #10b981; }
.card-dashboard.vermelho { border-left: 5px solid #ef4444; }
.card-dashboard.amarelo  { border-left: 5px solid #f59e0b; }

.card-dashboard h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #94a3b8;
  font-weight: 600;
  margin: 0 0 8px;
}

.card-dashboard p {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.5px;
  margin: 0;
}


/* ============================================================
   9. COMPONENTE — TABELAS
   Sem grade estilo Excel: linhas sutis, header cinza claro.
   ============================================================ */

/* Wrapper com scroll horizontal para telas pequenas */
.table-wrap {
  display: flex;              /* flex para alinhar tabela + coluna de ações fixa */
  overflow: visible;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-top: 12px;
}

/* A parte da tabela que pode rolar horizontalmente */
.table-scroll {
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch; /* scroll suave no iOS */
}
.table-scroll table {
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  background: var(--card-bg);
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-radius: 12px;
  overflow: hidden;
}

/* Cabeçalho da tabela */
thead { background: var(--bg); }
thead th {
  padding: 14px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .6px;
  background: #f8fafc;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

/* Linhas do corpo da tabela */
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover      { background: #f8faff; }

tbody td {
  padding: 14px 12px;
  font-size: 14px;
  color: #1e293b;
  vertical-align: middle;
  border: none;
  border-bottom: 1px solid #f1f5f9;
}
tbody tr:last-child td { border-bottom: none; }


/* ============================================================
   10. COMPONENTE — COLUNA DE AÇÕES FIXAS NA TABELA
   Fica grudada à direita enquanto a tabela rola.
   ============================================================ */
.table-acoes-fixas {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 12px rgba(0,0,0,.1); /* sombra para indicar que está fixa */
  z-index: 5;
  flex-shrink: 0;
}

/* Cabeçalho da coluna fixa */
.th-fixo {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 12px;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Cada linha de botões alinhada com a linha da tabela */
.td-fixo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 1px solid #f1f5f9;
  padding: 14px 10px;
  box-sizing: border-box;
}
.td-fixo:last-child { border-bottom: none; }


/* ============================================================
   11. COMPONENTE — FORMULÁRIOS
   Sistema de grid de 2 e 3 colunas que vira 1 coluna no mobile.
   ============================================================ */
.ui-form {
  background: var(--card-bg);
  padding: 24px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Grids responsivos */
.ui-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ui-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* Campo individual com label + input */
.ui-field         { display: flex; flex-direction: column; gap: 6px; }
.ui-field label   { font-weight: 600; color: #374151; font-size: 14px; }
.ui-field input,
.ui-field select {
  height: 44px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: var(--card-bg);
  color: var(--text);
  transition: border .2s;
  font-family: inherit;
  width: 100%;
}
.ui-field input:focus,
.ui-field select:focus { border-color: var(--primary); outline: none; }

/* Campo de valor com prefixo "R$" */
.ui-campo-valor {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  height: 44px;
}
.ui-campo-valor > span {
  background: var(--bg);
  padding: 0 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1.5px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
}
.ui-campo-valor > input {
  border: none;
  flex: 1;
  padding: 0 12px;
  height: 100%;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}

/* Linha de ações (botões Salvar / Cancelar) */
.ui-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

input[type="checkbox"] { accent-color: var(--primary); }

/* Card de gerenciar empréstimo */
.card-emprestimo {
  background: var(--card-bg);
  padding: 28px 24px;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  max-width: 560px;
  margin: 20px auto;
}
.card-emprestimo p { margin: 6px 0; font-size: 15px; line-height: 1.6; }


/* ============================================================
   12. COMPONENTE — BOTÕES
   Cada variante tem cor e tamanho adequados à sua função.
   ============================================================ */

/* Salvar (verde) */
.btn-salvar {
  background: var(--success);
  color: #fff;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  font-family: inherit;
}
.btn-salvar:hover    { background: #15803d; }
.btn-salvar:disabled { opacity: .6; cursor: not-allowed; }

/* Cancelar (cinza) */
.btn-cancelar {
  background: var(--border);
  color: var(--text);
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
.btn-cancelar:hover { background: #d1d5db; }

/* Gerenciar (azul — abre detalhes do empréstimo) */
.btn-gerenciar {
  background: var(--primary);
  color: #fff;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  cursor: pointer;
  transition: background .2s;
  white-space: nowrap;
}
.btn-gerenciar:hover { background: var(--primary-dark); }

/* Editar (amarelo suave) */
.btn-editar {
  background: #fef3c7;
  color: #92400e;
  padding: 0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-editar:hover { background: #fde68a; }

/* Excluir (vermelho suave) */
.btn-excluir {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-excluir:hover { background: #fecaca; }

/* Upgrade (gradiente roxo-azul) */
.btn-upgrade {
  display: block;
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 10px;
  font-family: inherit;
  transition: opacity .2s, transform .15s;
}
.btn-upgrade:hover { opacity: .9; transform: scale(1.02); }

/* Fechar paywall (discreto) */
.btn-fechar-paywall {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  padding: 8px;
}
.btn-fechar-paywall:hover { color: #64748b; }

/* Banner de upgrade (botão interno) */
.btn-banner {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}


/* ============================================================
   13. COMPONENTE — FREEMIUM
   Paywall (modal bloqueante), tela de planos e banner inline.
   ============================================================ */

/* --- Paywall (modal que aparece ao atingir o limite do plano) --- */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.paywall-box {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: fadeUp .25s ease;
}

.paywall-emoji { font-size: 52px; margin-bottom: 8px; }
.paywall-box h2 { font-size: 1.5rem; font-weight: 800; color: #1e293b; margin: 0 0 10px; }
.paywall-box p  { color: #64748b; font-size: 15px; line-height: 1.6; margin: 0 0 24px; }

/* --- Tela de planos (Grátis / Mensal / Anual) --- */
.planos-wrap   { padding: 80px 0; }
.planos-header { text-align: center; margin-bottom: 36px; }
.planos-header h2 { font-size: 2rem; font-weight: 800; color: var(--text); margin: 0 0 10px; }
.planos-header p  { color: var(--text-muted); font-size: 16px; margin: 0; }

.planos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  max-width: 680px;
  margin: 0 auto;
}

.plano-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 32px 24px;
  text-align: center;
  transition: box-shadow .2s, transform .2s;
  position: relative;
}
.plano-card:hover    { box-shadow: 0 10px 36px rgba(0,0,0,.1); transform: translateY(-5px); }
.plano-card.destaque { border-color: var(--primary); box-shadow: 0 8px 32px rgba(37,99,235,.15); }

/* Badge "⭐ Popular" flutuante acima do card */
.plano-badge {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 18px;
  border-radius: 99px;
  white-space: nowrap;
  letter-spacing: .5px;
}

.plano-nome  { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin: 0 0 14px; }
.plano-preco { font-size: 3rem; font-weight: 800; color: var(--text); line-height: 1; margin: 0 0 4px; }
.plano-preco span { font-size: 1rem; font-weight: 500; color: var(--text-muted); }
.plano-desc  { font-size: 13px; color: var(--text-muted); margin: 0 0 22px; }

.plano-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.plano-features li          { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.plano-features li.disabled { color: var(--text-muted); }
.feat-ok { color: #16a34a; }
.feat-no { color: #d1d5db; }

.plano-btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .2s, transform .15s;
}
.plano-btn:hover { opacity: .88; transform: scale(1.02); }
.plano-btn.free  { background: var(--border); color: var(--text); }
.plano-btn.pago  { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; }

/* --- Banner de upgrade (faixa dentro do app) --- */
.banner-upgrade {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
  border: 1.5px solid #c7d2fe;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.banner-upgrade .banner-txt           { flex: 1; min-width: 180px; }
.banner-upgrade .banner-txt strong    { display: block; font-size: 15px; color: #1e3a8a; margin-bottom: 2px; }
.banner-upgrade .banner-txt span      { font-size: 13px; color: #64748b; }


/* ============================================================
   14. ANIMAÇÕES
   Agrupadas aqui para fácil localização.
   ============================================================ */

/* Entrada suave de modais (paywall, confirmações) */
@keyframes fadeUp {
  from { opacity: 0; transform: scale(.92) translateY(14px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);     }
}

/* Entrada do conteúdo principal ao trocar de tela */
@keyframes fadeInDashboard {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0);    }
}
#conteudo { animation: fadeInDashboard .6s ease; }

/* Pulsação no chip "Pro" para chamar atenção */
.chip-plano.pro { animation: glowPro 2s ease-in-out infinite alternate; }
@keyframes glowPro {
  from { box-shadow: 0 0 5px gold; }
  to   { box-shadow: 0 0 20px gold; }
}

/* Pulsação no badge de plano Pro (sidebar ou outro lugar) */
.pro { animation: pulsePro 1.5s infinite; }
@keyframes pulsePro {
  0%   { box-shadow: 0 0 0 0   rgba(255,215,0,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(255,215,0,0);   }
  100% { box-shadow: 0 0 0 0   rgba(255,215,0,0);   }
}


/* ============================================================
   15. DARK MODE — CORREÇÕES UNIFICADAS
   As variáveis de cor já cuidam da maior parte (seção 1).
   As regras abaixo corrigem estilos hardcoded no JavaScript
   e no HTML inline (ex: style="background:#fff").
   ============================================================ */

/* --- Inputs, selects e textareas --- */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}
body.dark-mode input::placeholder { color: #6b7280 !important; }

/* Placeholder para inputs dentro dos headers escuros */
[style*="background:rgba(255,255,255,.1)"]::placeholder,
[style*="background:rgba(255,255,255, .1)"]::placeholder { color: rgba(255,255,255,.4) !important; }

/* Campos específicos de filtros */
body.dark-mode #filtroCliente,
body.dark-mode #filtroMes,
body.dark-mode #filtroStatus,
body.dark-mode #filtroTipo,
body.dark-mode #buscaCliente {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
  border-color: #374151 !important;
}

/* --- Campos do sistema de form (.ui-field) --- */
body.dark-mode .ui-field input,
body.dark-mode .ui-field select,
body.dark-mode .ui-campo-valor > input {
  background: #374151 !important;
  color: #f3f4f6 !important;
  border-color: #4b5563 !important;
}
body.dark-mode .ui-campo-valor > span {
  background: #374151 !important;
  border-color: #4b5563 !important;
  color: #9ca3af !important;
}
body.dark-mode .ui-field label { color: #d1d5db !important; }

/* --- Formulário Novo Empréstimo (.novo-emp) --- */
body.dark-mode .novo-emp .form-emprestimo,
body.dark-mode .ui-form {
  background: #1f2937 !important;
}
body.dark-mode .novo-emp input,
body.dark-mode .novo-emp select {
  background: #374151 !important;
  color: #f3f4f6 !important;
  border-color: #4b5563 !important;
}
body.dark-mode .novo-emp input::placeholder { color: #6b7280 !important; }
body.dark-mode .novo-emp input[readonly],
body.dark-mode .novo-emp input:disabled     { background: #4b5563 !important; color: #9ca3af !important; }
body.dark-mode .novo-emp label              { color: #d1d5db !important; }
body.dark-mode .novo-emp .campo-valor       { background: #374151 !important; border-color: #4b5563 !important; }
body.dark-mode .novo-emp .campo-valor span  { background: #4b5563 !important; border-color: #4b5563 !important; color: #9ca3af !important; }
body.dark-mode .novo-emp .calc-modo        { background: #374151 !important; border-color: #4b5563 !important; }
body.dark-mode .novo-emp .calc-modo label  { color: #d1d5db !important; }
body.dark-mode .novo-emp .btn-cancelar     { background: #374151 !important; color: #f3f4f6 !important; }

/* --- Botão cancelar genérico --- */
body.dark-mode .btn-cancelar,
body.dark-mode [style*="background:#f3f4f6"],
body.dark-mode [style*="background: #f3f4f6"],
body.dark-mode [style*="background:#e5e7eb"] {
  background: #374151 !important;
  color: #f2f6ff !important;
}

/* --- Configurações --- */
body.dark-mode #formConfig                          { background: var(--card-bg) !important; }
body.dark-mode #formConfig label                    { color: #d1d5db !important; }
body.dark-mode #formConfig input,
body.dark-mode #formConfig select                   { background: #374151 !important; color: #f3f4f6 !important; border-color: #4b5563 !important; }

/* --- Labels e textos de formulários --- */
body.dark-mode label                               { color: #d1d5db !important; }
body.dark-mode .ui-field label,
body.dark-mode [style*="font-weight:600;color:#374151"],
body.dark-mode [style*="color:#374151"]            { color: #d1d5db !important; }

/* --- Tabelas --- */
body.dark-mode thead th {
  background: #1e293b !important;
  color: #94a3b8 !important;
}
body.dark-mode tbody td {
  color: #e2e8f0 !important;
  border-bottom-color: #1e293b !important;
}
body.dark-mode tbody tr:hover    { background: #263548 !important; }
body.dark-mode tbody tr:hover td { color: #f3f4f6 !important; }
body.dark-mode .th-fixo          { background: #1e293b; color: #64748b; border-bottom-color: #334155; }

/* --- Cabeçalho da tabela de relatório --- */
body.dark-mode [style*="background:#f1f5f9;"] { background: #1e293b !important; }

/* --- Textos hardcoded escuros (cores inline no JS) --- */
body.dark-mode h2,
body.dark-mode h3                              { color: #f3f4f6 !important; }
body.dark-mode [style*="color:#0f172a"],
body.dark-mode [style*="color:#1e293b"],
body.dark-mode [style*="color:#111827"],
body.dark-mode [style*="color:#374151"],
body.dark-mode [style*="color:#1e3a8a"],
body.dark-mode [style*="color:#232a37"]        { color: #f3f4f6 !important; }
body.dark-mode [style*="color:#334155"]        { color: #9ca3af !important; }
body.dark-mode [style*="color:#64748b"],
body.dark-mode [style*="color:#6b7280"],
body.dark-mode [style*="color:#475569"],
body.dark-mode [style*="color:#94a3b8"]        { color: #ffffff !important; }

/* Texto azul virado para azul claro */
body.dark-mode [style*="color:#1e3a8a"]        { color: #93c5fd !important; }

/* --- Fundos brancos e cinzas claros hardcoded --- */
body.dark-mode [style*="background:#fff"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background:white"],
body.dark-mode [style*="background:#ffffff"],
body.dark-mode [style*="background:#f8fafc"],
body.dark-mode [style*="background:#f9fafb"],
body.dark-mode [style*="background:#f1f5f9"],
body.dark-mode [style*="background:#fff;border-radius"],
body.dark-mode [style*="background:#fff; border-radius"],
body.dark-mode [style*="background:white;border-radius"] { background: #1f2937 !important; }

/* Fundo cinza para radio/checkbox */
body.dark-mode [style*="background:#f9fafb"],
body.dark-mode [style*="background: #f9fafb"] { background: #374151 !important; color: #f3f4f6 !important; }

/* --- Dashboard — cards de status (inline styles gerados por JS) --- */
body.dark-mode [style*="color:#0f172a"],
body.dark-mode [style*="color:#1e293b"] { color: #f3f4f6 !important; }
body.dark-mode [style*="color:#334155"] { color: #9ca3af !important; }
body.dark-mode [style*="background:#fef2f2"],
body.dark-mode [style*="background:#fffbeb"] { background: #374151 !important; }
body.dark-mode [style*="border:1px solid #e0f2fe"],
body.dark-mode [style*="border:1px solid #fee2e2"],
body.dark-mode [style*="border:1px solid #fef3c7"] { border-color: #374151 !important; background: #1f2937 !important; }
body.dark-mode [style*="background:#eff6ff"],
body.dark-mode [style*="background:#fef2f2"],
body.dark-mode [style*="background:#fffbeb"],
body.dark-mode [style*="background:#f0fdf4"] { background: #374151 !important; }

/* --- Cards do dashboard (.card-dashboard) --- */
body.dark-mode .card-dashboard h3 { color: #9ca3af !important; }
body.dark-mode .card-dashboard p  { color: #f3f4f6 !important; }

/* --- Linhas de status coloridas na tabela de empréstimos --- */
body.dark-mode [style*="background:#fef9c3"] { background: #422006 !important; color: #fde68a !important; }
body.dark-mode [style*="background:#ffedd5"] { background: #431407 !important; color: #fed7aa !important; }
body.dark-mode [style*="background:#fee2e2"] { background: #450a0a !important; color: #fca5a5 !important; }

/* --- Cards de relatório (cores de fundo variadas) --- */
body.dark-mode [style*="background:#eff6ff"],
body.dark-mode [style*="background:#fef9c3"],
body.dark-mode [style*="background:#fef08a"],
body.dark-mode [style*="background:#dcfce7"],
body.dark-mode [style*="background:#f0fdf4"],
body.dark-mode [style*="background:#fae8ff"],
body.dark-mode [style*="background:#ede9fe"],
body.dark-mode [style*="background:#fff7ed"],
body.dark-mode [style*="background:#e0f2fe"],
body.dark-mode [style*="background:lightyellow"],
body.dark-mode [style*="background:lightgreen"] { background: #1f2937 !important; }

/* Textos coloridos nos cards de relatório — clareados para legibilidade */
body.dark-mode [style*="color:#b45309"],
body.dark-mode [style*="color:#15803d"],
body.dark-mode [style*="color:#7c3aed"],
body.dark-mode [style*="color:#0369a1"],
body.dark-mode [style*="color:#1d4ed8"] { filter: brightness(1.4) !important; }

/* --- Cards de empréstimo e histórico --- */
body.dark-mode .card-emprestimo,
body.dark-mode [style*="background:#fff"],
body.dark-mode [style*="background: #fff"],
body.dark-mode [style*="background:white"]         { background: #1f2937 !important; color: #f3f4f6 !important; }
body.dark-mode .card-emprestimo p,
body.dark-mode .card-emprestimo b,
body.dark-mode .card-emprestimo span,
body.dark-mode .card-emprestimo strong             { color: #f3f4f6 !important; }
body.dark-mode [style*="background:#f5f6fa"]        { background: #1f2937 !important; color: #f3f4f6 !important; }
body.dark-mode [style*="background:#f3f4f6;border"] { background: #374151 !important; color: #f3f4f6 !important; }

/* Campos readonly do gerenciar empréstimo */
body.dark-mode [style*="background:#f1f5f9;color:#64748b"] { background: #374151 !important; color: #9ca3af !important; }
body.dark-mode [style*="background:#f1f5f9;color:#2563eb"] { background: #374151 !important; }

/* --- Texto genérico de parágrafos --- */
body.dark-mode p { color: #9ca3af; }

/* --- Planos e paywall --- */
body.dark-mode .plano-card   { border-color: #374151 !important; background: #1f2937 !important; }
body.dark-mode .paywall-box  { background: #1f2937 !important; }
body.dark-mode .paywall-box h2 { color: #f3f4f6 !important; }
body.dark-mode .paywall-box p  { color: #9ca3af !important; }
body.dark-mode .banner-upgrade { background: #1e293b !important; border-color: #334155 !important; }
body.dark-mode .banner-upgrade .banner-txt strong { color: #f3f4f6 !important; }

/* --- Notificações (lista de avisos) --- */
body.dark-mode #listaAvisos strong { color: #f1f5f9 !important; }
body.dark-mode #listaAvisos div    { color: #cbd5e1 !important; }
body.dark-mode #listaAvisos small  { color: #94a3b8 !important; }

/* --- Gráficos Chart.js --- */
body.dark-mode canvas { filter: brightness(1.1); }


/* ============================================================
   16. RESPONSIVO — MOBILE (≤ 800px)
   A sidebar vira um painel deslizante e aparece a barra
   de navegação inferior.
   ============================================================ */
@media (max-width: 800px) {

  /* Sidebar escondida por padrão, desliza da esquerda */
  nav {
    transform: translateX(-100%);
    padding-top: 80px;    /* espaço para o header por cima */
    z-index: 1001;
  }
  nav.nav-aberta { transform: translateX(0); }

  /* Remove a margem da sidebar do layout */
  #telaPrincipal { margin-left: 0; }

  /* Header ocupa toda a largura */
  header { left: 0; padding: 0 14px; }

  /* Botão hamburguer aparece no header */
  #btnMenuToggle { display: flex; align-items: center; justify-content: center; }

  /* Título e logo menores */
  .titulo-app     { font-size: 1.05rem; }
  .titulo-app img { height: 30px; }

  /* Espaço extra embaixo para a barra de navegação inferior */
  .conteudo {
    padding: 0 12px 90px;
    margin-top: calc(var(--header-h) + 12px);
  }

  /* Paywall menor */
  .paywall-box { padding: 28px 18px 22px; }

  /* Planos em coluna única */
  .planos-grid { grid-template-columns: 1fr; }

  /* Banner em coluna */
  .banner-upgrade        { flex-direction: column; align-items: flex-start; }
  .btn-banner            { width: 100%; text-align: center; }

  /* Dashboard em 2 colunas */
  .dashboard             { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-dashboard        { padding: 14px; }
  .card-dashboard p      { font-size: 22px; }

  /* Formulários em 1 coluna */
  .ui-grid-2, .ui-grid-3 { grid-template-columns: 1fr; }
  .ui-actions            { flex-direction: column; }
  .ui-actions button     { width: 100%; justify-content: center; }

  /* Card de empréstimo */
  .card-emprestimo       { padding: 18px 14px; margin: 10px 0; border-radius: 14px; }

  /* Tabelas com scroll horizontal */
  .table-wrap       { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .table-wrap table { min-width: 520px; }

  /* --- Barra de navegação inferior --- */
  #barraInferior {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    height: var(--bottom-nav-h);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(37,99,235,.12);
    box-shadow: 0 -1px 0 rgba(37,99,235,.08), 0 -8px 24px rgba(0,0,0,.06);
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  #barraInferior button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    transition: color .2s;
    position: relative;
  }
  #barraInferior button i {
    font-size: 20px;
    transition: transform .2s;
  }
  #barraInferior button.active {
    color: var(--primary);
  }
  #barraInferior button.active i {
    transform: scale(1.15);
  }

  /* Badge de notificação na barra inferior */
  #barraInferior .badge-bottom {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }
  #barraInferior .badge-bottom.show { display: inline-flex; }

  /* --- Coluna de ações fixa — compacta no mobile --- */
  .table-acoes-fixas { width: 64px !important; }
  .th-fixo           { padding: 10px 6px !important; font-size: 10px !important; }
  .td-fixo           { padding: 10px 6px !important; gap: 4px !important; flex-direction: column !important; }

  /* Botão gerenciar: só ícone, sem texto */
  .btn-gerenciar {
    font-size: 0 !important;   /* esconde o texto */
    padding: 8px !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 10px !important;
  }
  .btn-gerenciar i { font-size: 16px !important; }

  /* Botões editar/excluir menores */
  .btn-editar,
  .btn-excluir {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
  }
}


/* ============================================================
   17. RESPONSIVO — TELAS MUITO PEQUENAS (≤ 380px)
   ============================================================ */
@media (max-width: 380px) {
  /* Esconde o texto do título, deixa só o logo */
  .titulo-app > span:not(img) { display: none; }

  /* Dashboard em 1 coluna */
  .dashboard { grid-template-columns: 1fr; }
}


/* ============================================================
   18. RESPONSIVO — DESKTOP (≥ 801px)
   A barra inferior nunca aparece no desktop.
   ============================================================ */
@media (min-width: 801px) {
  #barraInferior { display: none !important; }
}
/* Opções dos selects no modo escuro */
body.dark-mode select option {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
}

/* Opções dos selects — tema claro e escuro */
select option {
  background: #ffffff;
  color: #1f2937;
}
body.dark-mode select option {
  background: #1f2937 !important;
  color: #f3f4f6 !important;
}