html,
body {
  overflow-x: hidden; /* Mata o scroll horizontal fantasma no celular */
}

/* ==========================================================================
   AURALIS — DESIGN SYSTEM
   Versão responsiva completa: mobile-first com ótima experiência no desktop
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. FONTES (Inter local)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter_18pt-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter_18pt-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter_18pt-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter_18pt-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

/* --------------------------------------------------------------------------
   2. VARIÁVEIS DO SISTEMA
   Cores/temas: carregadas pelo arquivo em /geral/temas/{tema}.css
   -------------------------------------------------------------------------- */
:root {
  /* Espaçamentos que escalam com viewport */
  --space-page-x: clamp(0.875rem, 4vw, 3rem);
  --space-card: clamp(0.875rem, 2vw, 1.5rem);

  /* Tipografia fluída */
  --fs-hero: clamp(1.2rem, 3vw, 1.65rem);
  --fs-card-val: clamp(1.3rem, 3.5vw, 1.875rem);
  --fs-label: clamp(0.625rem, 1.3vw, 0.725rem);
  --fs-body: clamp(0.8rem, 1.4vw, 0.9375rem);
  --fs-small: clamp(0.7rem, 1.1vw, 0.8125rem);
}

/* --------------------------------------------------------------------------
   3. BASE
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", sans-serif;
  font-size: var(--fs-body);
  background-color: var(--bg-dark);
  background-image: var(--bg-texture, none);
  background-attachment: fixed;
  background-size: cover;
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   4. NAVBAR
   -------------------------------------------------------------------------- */
.navbar {
  background-color: var(--navbar-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-brand img {
  height: clamp(26px, 4vw, 34px);
  width: auto;
}

.navbar-brand i {
  filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.4));
}

.navbar-nav .custom-link {
  position: relative;
}

.navbar-nav .custom-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  background-color: var(--accent);
  transition: all 0.3s ease-in-out;
  transform: translateX(-50%);
}

.navbar-nav .custom-link:hover::after,
.navbar-nav .custom-link.active::after {
  width: 80%;
}

.dropdown-menu {
  animation: slideDropdown 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  transform-origin: top center;
}

@keyframes slideDropdown {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   5. TIPOGRAFIA
   -------------------------------------------------------------------------- */
h1 {
  font-size: clamp(1.4rem, 4vw, 2.25rem);
}
h2 {
  font-size: clamp(1.1rem, 2.8vw, 1.5rem);
}
h3 {
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
}
h4 {
  font-size: clamp(0.875rem, 1.8vw, 1.125rem);
}
h5 {
  font-size: clamp(0.8125rem, 1.5vw, 1rem);
}

h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-gold,
.text-primary {
  color: var(--accent) !important;
}

.fs-7 {
  font-size: 0.8125rem !important;
}
.tracking-wide {
  letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------------
   6. CARDS
   -------------------------------------------------------------------------- */
.card {
  background-color: var(--bg-card);
  border-color: var(--card-border-color) !important;
}

.card-body {
  padding: var(--space-card) !important;
}

.card-header {
  padding-inline: var(--space-card) !important;
  padding-block: calc(var(--space-card) * 0.75) !important;
}

.feature-card {
  background-color: var(--bg-card);
  border: 1px solid var(--card-border-feature);
  border-radius: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.5),
    0 10px 10px -5px var(--card-glow);
  border-color: var(--accent);
}

/* --------------------------------------------------------------------------
   7. BOTÕES
   -------------------------------------------------------------------------- */
.btn-primary {
  background-color: var(--accent);
  border: none;
  color: #121418 !important;
  font-weight: 700;
}

.btn-primary:hover {
  background-color: var(--accent-light);
  color: #000 !important;
}

/* --------------------------------------------------------------------------
   8. TABELA
   -------------------------------------------------------------------------- */

/* Sobrescreve as BS-vars do table-dark usando as vars do tema ativo */
.auralis-table {
  font-size: var(--fs-body);
  --bs-table-color:       var(--text-main);
  --bs-table-bg:          var(--bg-card);
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-hover-color: var(--text-main);
  --bs-table-hover-bg:    var(--bg-hover);
  --bs-table-active-bg:   var(--bg-hover);
  --bs-table-active-color: var(--text-main);
  background-color: var(--bg-card) !important;
  color: var(--text-main) !important;
}

.auralis-table th {
  font-size: var(--fs-label);
  color: var(--text-muted) !important;
  background-color: var(--bg-hover) !important;
}

.auralis-table td,
.auralis-table th {
  padding-inline: clamp(0.5rem, 2vw, 1rem) !important;
  padding-block: 0.75rem !important;
  border-color: var(--bs-border-color) !important;
}

/* Painel de expansão de linha */
.bg-charcoal-analysis {
  background-color: var(--bg-charcoal-analysis) !important;
}

/* --------------------------------------------------------------------------
   9. ANIMAÇÕES DE SCROLL
   -------------------------------------------------------------------------- */
.card-animado {
  opacity: 0;
  transition: all 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.surgir-baixo {
  transform: translateY(50px);
}

.mostrar {
  opacity: 1 !important;
  transform: translate(0, 0) !important;
}

/* --------------------------------------------------------------------------
   10. UTILITÁRIOS
   -------------------------------------------------------------------------- */
.transition-hover {
  transition:
    opacity 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */

/* --------------------------------------------------------------------------
   TABLET (≤ 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  /* Navbar colapsada */
  .navbar-collapse {
    background-color: var(--navbar-collapse-bg);
    border-radius: 0.75rem;
    padding: 0.875rem;
    margin-top: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .navbar-nav .custom-link::after {
    display: none;
  }

  .navbar-nav .nav-link {
    padding-block: 0.625rem;
  }

  .dropdown-menu {
    position: static !important;
    transform: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding-left: 1rem;
    animation: none;
  }

  /* Dashboard: linha de ações fica abaixo do título */
  .dash-actions-row {
    width: 100%;
    flex-wrap: wrap;
  }

  /* Botões de nova transação: cada um cresce igualmente */
  .btn-nova-receita,
  .btn-nova-despesa {
    flex: 1;
    justify-content: center;
  }
}

/* --------------------------------------------------------------------------
   MOBILE (≤ 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  :root {
    --space-page-x: 0.875rem;
    --space-card: 0.875rem;
  }

  /* Cards de resumo: 1 por linha no mobile */
  .summary-col {
    width: 100% !important;
    max-width: 100%;
    flex: 0 0 100%;
  }

  /* Cabeçalho dashboard: empilha em coluna */
  .dash-top-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.625rem;
  }

  .dash-top-bar .dash-left,
  .dash-top-bar .dash-right {
    width: 100%;
  }

  /* Seletor de mês: ocupa linha toda */
  .month-nav {
    width: 100%;
    justify-content: space-between;
  }

  /* Dropdown de carteira: full-width */
  .dropdown.w-100,
  .carteira-select-wrap {
    width: 100% !important;
  }

  /* Botões Receita/Despesa: lado a lado 50%/50% */
  .btn-nova-receita,
  .btn-nova-despesa {
    flex: 1;
  }

  /* Tabela: colunas escondidas via Bootstrap d-none já aplicadas,
       aqui só afinamos o restante */
  .auralis-table th,
  .auralis-table td {
    padding-inline: 0.5rem !important;
    font-size: 0.8125rem;
  }

  /* Análises: gráfico de rosca menor para não ocupar tela toda */
  .donut-wrapper {
    max-width: 220px !important;
  }

  .analises-list {
    max-height: 260px !important;
  }

  /* Valor no formulário nova_transacao menor */
  .valor-input {
    font-size: clamp(1.75rem, 10vw, 3rem) !important;
  }

  /* Modais mais compactos */
  .modal-body {
    padding: 1rem !important;
  }
  .modal-header,
  .modal-footer {
    padding: 0.875rem 1rem !important;
  }

  /* Separador vertical desnecessário */
  .dash-vr {
    display: none !important;
  }

  /* Painel de detalhe de transação */
  .transacao-detail-panel {
    flex-direction: column !important;
    gap: 0.875rem !important;
  }

  .transacao-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .transacao-actions .btn {
    flex: 1;
    justify-content: center;
    min-width: 80px;
  }
}

/* ==========================================================================
   NOTIFICATION WIDGET
   ========================================================================== */

/* ── Bell FAB ── */
#notif-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1060;
}

#notif-bell {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--card-border-color);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s;
  font-size: 1.2rem;
}

#notif-bell:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.6);
}

#notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #E63946;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 17px;
  text-align: center;
  line-height: 1.5;
  border: 2px solid var(--bg-card);
  pointer-events: none;
}

/* ── Panel ── */
#notif-panel {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  right: 0;
  width: 370px;
  max-width: calc(100vw - 2rem);
  max-height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--card-border-color);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* display:flex above beats UA's [hidden]{display:none} — force it */
#notif-panel[hidden] { display: none !important; }

/* Panel header */
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--card-border-color);
  flex-shrink: 0;
  gap: 0.5rem;
}

.notif-panel-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.notif-count-pill {
  background: #E6394620;
  color: #E63946;
  border: 1px solid #E6394640;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 8px;
  margin-left: 4px;
}

.notif-head-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}
.notif-head-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 5px;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.notif-head-actions button:hover { background: var(--bg-hover); color: var(--text-main); }
#notif-toggle-hist.notif-hist-ativo { color: var(--accent) !important; }

/* Notification list */
#notif-list {
  overflow-y: auto;
  flex: 1;
}

/* Empty state */
.notif-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
}
.notif-empty i { font-size: 2rem; display: block; margin-bottom: 0.75rem; opacity: 0.5; }
.notif-empty p { font-size: 0.85rem; margin: 0; }

/* ── Individual item ── */
.notif-item {
  border-bottom: 1px solid var(--card-border-color);
  transition: background 0.12s, opacity 0.32s;
}
.notif-item:last-child { border-bottom: none; }

/* Read items hidden by default; visible in history mode */
.notif-item.lida { display: none; }
#notif-panel.ver-historico .notif-item.lida { display: block; opacity: 0.55; }
#notif-panel.ver-historico .notif-item.lida .notif-item-header:hover { opacity: 1; }

/* Fade-out when transitioning to read */
.notif-item.notif-saindo { opacity: 0 !important; pointer-events: none; }

.notif-item.nao-lida { background: color-mix(in srgb, var(--accent) 5%, var(--bg-card)); }

/* Empty-unread state */
#notif-sem-novas { padding: 1.5rem 1rem; text-align: center; }
#notif-sem-novas p { font-size: 0.83rem; color: var(--text-muted); margin: 0.25rem 0 0.75rem; }
#notif-sem-novas button {
  background: var(--bg-hover);
  border: 1px solid var(--card-border-color);
  color: var(--text-main);
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  font-size: 0.78rem;
  cursor: pointer;
}
#notif-sem-novas button:hover { color: var(--accent); border-color: var(--accent); }

/* History section label */
.notif-hist-sep {
  padding: 0.35rem 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--card-border-color);
  letter-spacing: 0.04em;
  display: none;
}
#notif-panel.ver-historico .notif-hist-sep { display: block; }

.notif-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.notif-item-header:hover { background: var(--bg-hover); }

.notif-envelope {
  font-size: 1rem;
  flex-shrink: 0;
  transition: color 0.18s;
}
.notif-item.nao-lida .notif-envelope { color: var(--accent); }
.notif-item.lida      .notif-envelope { color: var(--text-muted); }

.notif-item-meta {
  flex: 1;
  min-width: 0;
}
.notif-item-title {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notif-item-date {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-chevron {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

/* Expanded body */
.notif-item-body {
  padding: 0 1rem 1rem;
}

.notif-item-content {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.6;
  margin-bottom: 0.75rem;
  word-break: break-word;
}

/* ── Survey ── */
.notif-survey-form { margin-top: 0.5rem; }

.notif-survey-items { display: flex; flex-direction: column; gap: 1rem; }

.notif-survey-item {
  border-top: 1px solid var(--card-border-color);
  padding-top: 0.75rem;
}

.notif-survey-q {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.notif-survey-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px 0;
}
.notif-survey-opt input { flex-shrink: 0; accent-color: var(--accent); }

.notif-survey-text {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--card-border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  resize: vertical;
}

.notif-survey-submit {
  margin-top: 0.75rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 999px;
  padding: 6px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  width: 100%;
}
.notif-survey-submit:hover:not(:disabled) { opacity: 0.85; }
.notif-survey-submit:disabled { opacity: 0.6; cursor: default; }

.notif-survey-done {
  font-size: 0.82rem;
  color: #4ade80;
  padding: 0.5rem 0;
  display: flex;
  align-items: center;
}

/* ── Mobile adjustments ── */
@media (max-width: 575.98px) {
  #notif-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 75vh;
    border-radius: 20px 20px 0 0;
  }
  #notif-container {
    bottom: 1rem;
    right: 1rem;
  }
}

/* --------------------------------------------------------------------------
   MOBILE PEQUENO (≤ 479px)
   -------------------------------------------------------------------------- */
@media (max-width: 479px) {
  :root {
    --space-page-x: 0.75rem;
    --space-card: 0.75rem;
  }

  .navbar-brand img {
    height: 24px;
  }

  /* Oculta "Olá, Nome" para ganhar espaço */
  .navbar-greeting {
    display: none !important;
  }

  /* Gerenciar categorias e Configurações: cols ficam full-width */
  .col-md-5,
  .col-md-7,
  .col-lg-6 {
    width: 100% !important;
    max-width: 100%;
    flex: 0 0 100%;
  }

  /* Ícone de análise menor */
  .analise-icon {
    padding: 0.5rem !important;
  }
  .analise-icon i {
    font-size: 1.25rem !important;
  }

  /* Botões dentro do painel de transação: coluna */
  .transacao-actions {
    flex-direction: column;
  }
  .transacao-actions .btn {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   CORREÇÃO: linha de collapse da tabela — sem borda/espaço residual
   -------------------------------------------------------------------------- */
.table > tbody > tr.border-0,
.table > tbody > tr[style*="border: 0"] {
  border: 0 !important;
}

.table > tbody > tr.border-0 > td,
.table > tbody > tr[style*="border: 0"] > td {
  padding: 0 !important;
  border: 0 !important;
}

/* Mobile: header do dashboard em coluna limpa */
@media (max-width: 575.98px) {
  .dash-month-pill {
    width: 100%;
    justify-content: space-between;
  }
  .dash-actions-wrap {
    width: 100%;
  }
  .dash-actions-wrap .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ==========================================================================
   NAVBAR AUTH — Controle segmentado Login / Criar conta
   ========================================================================== */

.nav-auth-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 4px;
}

.nav-auth-login,
.nav-auth-signup {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.25s ease;
}

/* Login — opção fantasma */
.nav-auth-login {
  color: rgba(255, 255, 255, 0.65);
}

.nav-auth-login:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Criar conta — opção em destaque dourado */
.nav-auth-signup {
  background: linear-gradient(135deg, #ffd035, #d1a71f);
  color: #121418 !important;
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.2);
}

.nav-auth-signup:hover {
  background: linear-gradient(135deg, #f9e596, #d4af37);
  color: #121418 !important;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
  transform: scale(1.03);
}

/* Mobile (navbar colapsada) */
@media (max-width: 991.98px) {
  .nav-auth-pill {
    width: 100%;
    border-radius: 1rem;
    padding: 6px;
    gap: 6px;
    flex-direction: column;
  }

  .nav-auth-login,
  .nav-auth-signup {
    width: 100%;
    justify-content: center;
    border-radius: 0.75rem;
    padding: 12px 18px;
    font-size: 0.9rem;
  }

  .nav-auth-login {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
  }

  .nav-auth-signup {
    box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
  }
}

/* ==========================================================================
   PREFERÊNCIA DE NAVEGAÇÃO — cards de seleção em configuracoes.php
   ========================================================================== */

.nav-pref-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: 2px solid var(--card-border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: transparent;
  min-width: 120px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  user-select: none;
}

.nav-pref-card:hover {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.05);
  color: var(--text-main);
}

.nav-pref-card.active {
  border-color: var(--accent);
  background: rgba(212, 175, 55, 0.08);
  color: var(--text-main);
}

.nav-pref-preview {
  width: 80px;
  height: 52px;
  border-radius: 7px;
  border: 1px solid var(--card-border-color);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.15s;
}

.nav-pref-card:hover .nav-pref-preview,
.nav-pref-card.active .nav-pref-preview {
  border-color: var(--accent);
}

/* ==========================================================================
   SIDEBAR — Layout lateral (usuários logados)
   ========================================================================== */

/* Sidebar — fixed para cobrir a altura total da página sem gap abaixo */
.auralis-sidebar {
  width: 240px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--card-border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible; /* permite dropdown sair dos limites da sidebar */
  z-index: 100;
}

.auralis-sidebar.sidebar-collapsed {
  width: 64px;
}

/* Conteúdo recuado da largura da sidebar */
.auralis-content {
  margin-left: 240px;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
  overflow-x: hidden;
}

/* Reduz margem quando sidebar está colapsada */
#auralis-sidebar.sidebar-collapsed ~ .auralis-content {
  margin-left: 64px;
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--card-border-color);
  flex-shrink: 0;
  min-height: 60px;
}

.sidebar-logo a {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo img {
  height: 30px;
  width: auto;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: 'Aquire', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s, width 0.22s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 160px;
}

/* Nav items — overflow-x: hidden aqui para clicar labels sem afetar dropdown */
.sidebar-nav {
  flex: 1;
  padding: 10px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.sidebar-item.active {
  color: var(--accent);
  background: rgba(212, 175, 55, 0.08);
}

.sidebar-item i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

/* Label + badge fade on collapse */
.sidebar-label {
  transition: opacity 0.15s;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.sidebar-badge {
  flex-shrink: 0;
  transition: opacity 0.15s;
}

/* Selo numérico ancorado no canto do ícone (ex.: convites pendentes) — ao contrário do
   .sidebar-badge de texto (que só faz sentido ao lado do label), esse continua visível
   mesmo com a sidebar colapsada, igual um badge de notificação de app. */
.sidebar-icon-badge-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.sidebar-icon-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #60a5fa;
  color: #06111f;
  border: 2px solid var(--bg-card);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
}

.auralis-sidebar.sidebar-collapsed .sidebar-label,
.auralis-sidebar.sidebar-collapsed .sidebar-badge {
  opacity: 0;
  pointer-events: none;
  flex: 0 0 0px;
  width: 0;
  max-width: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* Logo text: opacity + width 0 para remover o espaço no layout */
.auralis-sidebar.sidebar-collapsed .sidebar-logo-text {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  overflow: hidden;
}

.auralis-sidebar.sidebar-collapsed .sidebar-item {
  justify-content: center;
  gap: 0;
  padding: 9px;
}

.auralis-sidebar.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 14px 0 12px;
}

/* Remove gap do flex quando o texto some, para centralizar o ícone */
.auralis-sidebar.sidebar-collapsed .sidebar-logo a {
  gap: 0;
}

/* Bottom section: user + toggle — overflow visible para dropdown escapar */
.sidebar-bottom {
  border-top: 1px solid var(--card-border-color);
  padding: 8px;
  flex-shrink: 0;
  overflow: visible;
}

.sidebar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-main);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
  overflow: visible;
  min-width: 0;
}

.sidebar-user-btn:hover {
  background: var(--bg-hover);
}

.auralis-sidebar.sidebar-collapsed .sidebar-user-btn {
  justify-content: center;
  padding: 8px;
}

.auralis-sidebar.sidebar-collapsed .sidebar-user-btn::after {
  display: none;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  margin-top: 4px;
  width: 100%;
}

.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* Mobile topbar */
.auralis-mobile-topbar {
  display: none;
  align-items: center;
  padding: 0 12px;
  height: 52px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--card-border-color);
  position: sticky;
  top: 0;
  z-index: 900;
  flex-shrink: 0;
}

/* Overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1040;
}

.sidebar-overlay.active {
  display: block;
}

/* Responsive */
@media (max-width: 991.98px) {
  .auralis-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.22s;
    width: 240px !important;
    z-index: 1050;
  }

  .auralis-sidebar.mobile-open {
    transform: translateX(0);
  }

  /* No mobile sidebar sobrepõe — sem margem */
  .auralis-content,
  #auralis-sidebar.sidebar-collapsed ~ .auralis-content {
    margin-left: 0 !important;
  }

  /* No mobile, botão vira "fechar sidebar" — ícone trocado via JS */
  .sidebar-toggle {
    display: flex !important;
    width: auto !important;
    padding: 10px 16px !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
    font-size: 1.1rem !important;
  }

  .auralis-mobile-topbar {
    display: flex;
  }
}

/* ==========================================================================
   PRINT — Relatórios e Faturas
   ========================================================================== */
@media print {
  /* Esconder elementos de navegação e interação */
  nav, .navbar, footer, .modal, .offcanvas,
  .btn, .dropdown-menu, .toast-container,
  .no-print, #installModal, [data-bs-toggle]:not(tr):not(td),
  .alert-dismissible .btn-close,
  #notif-container,
  .auralis-sidebar, #sidebarOverlay {
    display: none !important;
  }

  /* A sidebar (position:fixed, 240px) some acima, mas o conteúdo ainda reserva o espaço
     dela via margin-left — sem isso sobra uma barra em branco à esquerda de toda página,
     e o logo/menu da sidebar aparecia por cima do conteúdo em cada página impressa. */
  .auralis-content {
    margin-left: 0 !important;
  }

  /* Forçar fundo branco e texto escuro */
  html, body {
    background: #fff !important;
    color: #1a1a1a !important;
    font-size: 12pt;
  }

  /* Cards e tabelas com bordas limpas */
  .card {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .table-dark, .table-dark td, .table-dark th {
    background: #fff !important;
    color: #1a1a1a !important;
    border-color: #ccc !important;
  }
  .table-hover tbody tr:hover td {
    background: #f5f5f5 !important;
  }
  .text-secondary, .text-muted { color: #555 !important; }
  .text-light, .text-white     { color: #1a1a1a !important; }
  .text-success { color: #166534 !important; }
  .text-danger  { color: #991b1b !important; }

  /* Cabeçalho de impressão com logo e título */
  .print-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 12px;
    margin-bottom: 20px;
  }
  .print-header-logo { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
  .print-header-meta { font-size: 0.8rem; color: #555; text-align: right; }

  /* Mostrar colunas responsivas ocultas (Categoria, Data, Status) */
  .d-none.d-md-table-cell { display: table-cell !important; }

  /* Garantir que tabelas não quebrem em páginas */
  table { page-break-inside: auto; }
  tr    { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }

  /* Detalhamento de despesas/receitas em Análises — tinham max-height + overflow-auto
     (rolagem interna), que na impressão simplesmente corta o conteúdo que passa da altura
     fixa em vez de rolar. Libera a altura total e deixa cada item quebrar de página de
     forma limpa (nunca no meio de uma linha). */
  .analises-list {
    max-height: none !important;
    overflow: visible !important;
  }
  .analise-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Canvas (Chart.js) — fundo branco para impressão */
  canvas { background: #fff !important; }

  /* Ícones coloridos dos cards de análise */
  .bg-danger.bg-opacity-10  { background: #fee2e2 !important; }
  .bg-success.bg-opacity-10 { background: #dcfce7 !important; }
  .bg-warning.bg-opacity-10 { background: #fef9c3 !important; }
  .bg-info.bg-opacity-10    { background: #e0f2fe !important; }

  /* Remover padding excessivo de container */
  main.container { padding: 0 !important; max-width: 100% !important; }
  .container     { max-width: 100% !important; padding: 0 12px !important; }

  /* Paleta semântica fixa pro papel — o app tem vários temas (dark, cosmos, aurora...) e
     essas variáveis (usadas via var(--color-x) em toda a página, inclusive inline) refletem
     a cor do tema ativo na tela. Sem isso, um tema mais saturado imprime cores erradas/
     ilegíveis no PDF. Sobrescrevendo aqui, cobre todo mundo que usa var(--color-x) de uma vez. */
  :root {
    --color-income-text:     #166534;
    --color-income-bg:       #dcfce7;
    --color-income-border:   #86efac;
    --color-expense-text:    #991b1b;
    --color-expense-bg:      #fee2e2;
    --color-expense-border:  #fca5a5;
    --color-pending-text:    #1e40af;
    --color-pending-bg:      #dbeafe;
    --color-today-text:      #92400e;
    --color-today-bg:        #fef3c7;
    --color-card-text:       #5b21b6;
    --color-card-bg:         #ede9fe;
    --color-card-border:     #c4b5fd;
    --primary-gold-analysis: #b8860b;
    --accent:                #b8860b;
  }

  /* Força a impressão de cores de fundo (barra de progresso, badges) mesmo quando o
     navegador não tem "imprimir gráficos de fundo" marcado — sem isso a barra de
     progresso das metas/orçamento por categoria simplesmente some no PDF. */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Cada linha de categoria em "Orçamento/Meta por Categoria" não pode ser cortada
     ao meio entre duas páginas do PDF. */
  .meta-cat-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Cards com listas de tamanho variável (Orçamento/Meta por Categoria, Detalhamento de
     despesas/receitas) podem facilmente ficar mais altos que uma página inteira. O
     break-inside:avoid genérico de ".card" (acima) força o navegador a tentar não quebrar
     um bloco que não cabe de jeito nenhum numa página só — o resultado, na prática, é
     conteúdo sobreposto entre páginas em vez de uma quebra limpa. Aqui liberamos a quebra
     só nesses cards especificamente; as linhas de dentro já têm proteção própria
     (.meta-cat-row acima, .analise-item mais abaixo). */
  .card:has(.analises-list),
  #metas-categoria .card {
    break-inside: auto;
    page-break-inside: auto;
  }

  /* No papel sobra espaço horizontal — nomes de categoria não devem truncar com "..." */
  .text-truncate {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
  }

  /* Margem consistente pro PDF gerado via "Salvar como PDF" do navegador */
  @page {
    margin: 14mm 12mm;
  }
}

