/* ============================================================
   FINANCEL — DASHBOARD V3 ORIGINAL PREMIUM
   Tudo o que o HTML do dashboard espera encontrar
   ============================================================ */

:root {
  --bg: #020617;
  --bg-soft: #020617;
  --navy: #0f172a;
  --gold: #facc15;
  --gold-soft: rgba(250, 204, 21, 0.24);
  --accent: #38bdf8;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --danger: #ef4444;
  --success: #22c55e;
  --radius-lg: 1.6rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(250, 204, 21, 0.18), transparent 55%),
    linear-gradient(135deg, #020617 0%, #020617 40%, #020617 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Aurora de fundo */

.bg-aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.18), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(250, 204, 21, 0.16), transparent 55%);
  mix-blend-mode: screen;
  animation: auroraMove 18s ease-in-out infinite alternate;
}

@keyframes auroraMove {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(24px, -18px, 0) scale(1.04);
  }
  100% {
    transform: translate3d(-18px, 18px, 0) scale(1.02);
  }
}

/* Container da página */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.6rem 1.4rem calc(5.5rem + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
}

.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* ============================================================
   HEADER PREMIUM
   ============================================================ */

.header {
  width: min(100% - 24px, 1180px);
  margin: 0 auto;
  max-width: 1180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0.9rem 1.2rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at 0% 0%, rgba(248, 250, 252, 0.06), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(251, 191, 36, 0.10), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.32);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.9);
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 1rem);
  z-index: 50;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(0);
  transition: padding 0.18s ease, box-shadow 0.18s ease, border-radius 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
  margin-bottom: 10px; /* garante espaço do conteúdo abaixo em todas as páginas */
}

.header--compact {
  padding: 0.55rem 1rem;
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
  transition: padding 0.18s ease, box-shadow 0.18s ease, border-radius 0.18s ease;
}

.header--compact .logo-circle {
  width: 38px;
  height: 38px;
  animation: none;
  box-shadow:
    0 0 14px rgba(250, 204, 21, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.85);
}

.header--compact .logo-circle img {
  width: 26px;
  height: 26px;
}

.header--compact .logo-name {
  height: 19px;
  max-width: 130px;
}

.header--compact .brand-tagline {
  display: none;
}

.header--compact .header-middle {
  font-size: 0.76rem;
}

.header--compact .header-right .btn-main,
.header--compact .header-right .btn-header-logout,
.header--compact .header-right .btn-header-ghost,
.header--compact .header-right .btn-header-ghost-alt,
.header--compact .header-right .user-pill {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.header .header-middle { font-size: 0.95rem; }
.header .header-subtag { font-size: 0.78rem; opacity: 0.85; }
.header .header-right button, .header .user-pill { font-size: 14px; }
.header .user-pill span { font-weight: 600; }

.header--hidden {
  transform: translateY(-150%);
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   MOBILE / RESPONSIVE (aplica em todas as páginas do app)
   ============================================================ */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
    top: 8px;
  }

  .header-left,
  .header-middle,
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .header-right {
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand-text { max-width: 100%; }

  .page,
  .dashboard-container {
    padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom, 0px));
    gap: 1rem;
  }

  .dash-top-summary,
  .dash-fluxo-grid,
  .lanc-grid,
  .fatura-card-grid,
  .compras-list {
    grid-template-columns: 1fr !important;
  }

  .dash-card,
  .patrimonio-total-container,
  .dash-top-summary,
  .dash-fluxo-grid,
  .lanc-grid {
    padding: 14px;
  }

  .fatura-card,
  .compra-card,
  .fatura-itens .item,
  .dash-top-right-buttons,
  .dash-top-badges {
    grid-template-columns: 1fr;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dash-card-title { gap: 6px; }
  .lanc-grid > * { min-width: 0; }

  .header--hidden {
    transform: translateY(-180%);
  }
}

/* Ajustes adicionais mobile: encolher header e botões */
@media (max-width: 640px) {
  .header {
    padding: 8px 10px;
    gap: 8px;
  }

  .header-left { gap: 12px; }
  .logo-circle { width: 40px; height: 40px; }
  .logo-circle img { width: 24px; height: 24px; }
  .logo-name { height: 18px; max-width: 120px; }
  .brand-text { display: none; }

  .header-middle {
    order: 3;
    width: 100%;
    align-items: flex-start;
    font-size: 0.78rem;
    gap: 4px;
  }

  .header-right {
    width: 100%;
    justify-content: flex-end;
    gap: 6px;
  }

  .header-right .btn-main,
  .header-right .btn-header-logout,
  .header-right .btn-header-ghost,
  .header-right .btn-header-ghost-alt,
  .header-right .user-pill {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .user-pill span { display: none; }
  .header--compact { padding: 8px 10px; }
}

@media (max-width: 480px) {
  .header {
    padding: 8px;
    gap: 6px;
  }

  .header-right .btn-main,
  .header-right .btn-header-logout,
  .header-right .btn-header-ghost,
  .header-right .btn-header-ghost-alt,
  .header-right .user-pill {
    min-height: 38px;
    padding: 8px 9px;
    font-size: 12px;
  }

  .header-middle { font-size: 0.72rem; }
  .header--hidden { transform: translateY(-200%); }
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0; /* permite encolher corretamente */
  flex-shrink: 1; /* permite compressão em telas médias */
}

.logo-circle {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, #0f172a, #020617 55%, #000 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 20px rgba(250, 204, 21, 0.8),
    0 8px 24px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: logoPulse 3s ease-in-out infinite;
  flex-shrink: 0;
}

.logo-circle img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

@keyframes logoPulse {
  0% {
    box-shadow:
      0 0 16px rgba(250, 204, 21, 0.45),
      0 8px 24px rgba(0, 0, 0, 0.95);
    transform: translateY(0) scale(1);
  }
  50% {
    box-shadow:
      0 0 26px rgba(250, 204, 21, 0.9),
      0 10px 28px rgba(0, 0, 0, 0.95);
    transform: translateY(-1px) scale(1.03);
  }
  100% {
    box-shadow:
      0 0 16px rgba(250, 204, 21, 0.45),
      0 8px 24px rgba(0, 0, 0, 0.95);
    transform: translateY(0) scale(1);
  }
}

.logo-name {
  height: 22px;
  max-width: 150px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.9));
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-name {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.brand-tagline {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 260px;
}

.header-middle {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.header-middle strong {
  color: var(--gold);
}

.header-middle .header-middle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.header-middle-icon {
  width: 16px;
  height: 16px;
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  white-space: nowrap;
  flex-shrink: 1;
}

.user-pill {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.96);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 170px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-pill-icon {
  width: 16px;
  height: 16px;
}

/* Botões do header */

.btn-header-primary,
.btn-header-ghost,
.btn-header-logout {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.16s ease;
}

.btn-header-primary svg,
.btn-header-ghost svg,
.btn-header-logout svg {
  width: 14px;
  height: 14px;
}

.btn-header-primary {
  border: none;
  background: linear-gradient(90deg, #fbbf24, #facc15, #f97316);
  color: #111827;
  font-weight: 700;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.9),
    0 0 20px rgba(250, 204, 21, 0.7);
}

.btn-header-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-header-ghost {
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.95);
  color: var(--muted);
  font-weight: 500;
}

.btn-header-ghost:hover {
  background: rgba(250, 204, 21, 0.12);
  color: var(--gold);
}

.btn-header-logout {
  border: 1px solid rgba(248, 113, 113, 0.7);
  background: rgba(15, 23, 42, 0.96);
  color: #fecaca;
  font-weight: 600;
}

.btn-header-logout:hover {
  background: rgba(239, 68, 68, 0.16);
  color: #fee2e2;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.55);
}

/* ============================================================
   RESUMO SUPERIOR
   ============================================================ */

.dash-top-summary {
  margin-top: 1.4rem;
  padding: 1.1rem 1rem;
  border-radius: 1.4rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(248, 250, 252, 0.04), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(250, 204, 21, 0.08), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.32);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.9);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr);
  gap: 1.2rem;
  align-items: center;
}

.dash-top-left-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f9fafb;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dash-top-left-title .highlight {
  color: var(--gold);
}

.dash-top-left-text {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 460px;
  line-height: 1.55;
}

.dash-top-badges {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.dash-top-badge {
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.96);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dash-top-badge svg {
  width: 14px;
  height: 14px;
}

.dash-top-right-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.dash-top-right-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

/* Botões hero */

.btn-main {
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  border: none;
  cursor: pointer;
  background: linear-gradient(90deg, #fbbf24, #facc15, #f97316);
  color: #111827;
  font-weight: 700;
  font-size: 0.9rem;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.9),
    0 0 22px rgba(250, 204, 21, 0.75);
  transition: 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-main svg {
  width: 15px;
  height: 15px;
}

.btn-main:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-ghost {
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.96);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: 0.15s ease;
}

.btn-ghost svg {
  width: 15px;
  height: 15px;
}

.btn-ghost:hover {
  background: rgba(250, 204, 21, 0.08);
  color: var(--gold);
}

.dash-top-right-note {
  font-size: 0.76rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.dash-top-right-note span {
  color: var(--gold);
  font-weight: 500;
}

/* ============================================================
   GRID PRINCIPAL / CARDS
   ============================================================ */

.dash-main-grid {
  margin-top: 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: flex-start;
}

.dash-secondary-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr);
  gap: 1rem;
  align-items: flex-start;
}

.dash-card {
  border-radius: 1.2rem;
  padding: 0.9rem 0.95rem 1rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(248, 250, 252, 0.06), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(251, 191, 36, 0.1), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.75);
  min-width: 0;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.dash-card-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 0;
}

.dash-card-title-icon {
  width: 16px;
  height: 16px;
}

.dash-card-subtitle {
  font-size: 0.76rem;
  color: var(--muted);
}

.dash-pill-soft {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.96);
  white-space: nowrap;
  min-width: 0;
}

/* Slots que o JS usa */

#kpis {
  margin-top: 0.4rem;
}

#charts {
  margin-top: 0.9rem;
}

#movimentacoes-container {
  margin-top: 0.6rem;
}

#mini-charts {
  margin-top: 0.3rem;
}

#filters-container {
  margin-top: 1.2rem;
}

/* BLOCO "A RECEBER" / PREVISÕES */

.receber-highlight {
  margin-top: 0.5rem;
  padding: 0.75rem 0.8rem;
  border-radius: 1.1rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1px dashed rgba(250, 204, 21, 0.4);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.receber-highlight-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--gold);
  font-size: 0.82rem;
}

.receber-highlight-header svg {
  width: 16px;
  height: 16px;
}

.receber-highlight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.areceber-resumo-mini {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.areceber-resumo-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.areceber-resumo-line strong {
  color: #f9fafb;
}

.areceber-resumo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.areceber-resumo-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.areceber-resumo-list li:last-child {
  border-bottom: none;
}

.areceber-resumo-list li strong {
  color: var(--gold);
  font-weight: 600;
}

/* Links / botões leves */

.btn-link-light {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: 0.15s ease;
}

.btn-link-light svg {
  width: 14px;
  height: 14px;
}

.btn-link-light:hover {
  border-color: rgba(250, 204, 21, 0.7);
  color: var(--gold);
  background: rgba(250, 204, 21, 0.06);
}

.dash-note-small {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

.dash-note-small span {
  color: var(--gold);
  font-weight: 500;
}

/* ============================================================
   BOTTOM NAV
   ============================================================ */

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  width: min(100% - 24px, 1180px);
  border-radius: 18px;
  border: 1px solid rgba(15, 23, 42, 0.98);
  background: linear-gradient(
    145deg,
    rgba(15, 23, 42, 0.98),
    rgba(15, 23, 42, 0.94)
  );
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.9);
  padding: calc(0.55rem + env(safe-area-inset-bottom, 0px)) 0.8rem 0.55rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  z-index: 12;
  backdrop-filter: blur(22px);
}

.bottom-links {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.4rem;
  scrollbar-width: none;
}

.bottom-links::-webkit-scrollbar {
  display: none;
}

.bottom-link {
  text-decoration: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  min-width: 64px;
  padding: 0.2rem 0.35rem;
  border-radius: 999px;
  transition: 0.16s ease;
  flex: 0 0 auto;
}

.bottom-link-icon {
  width: 18px;
  height: 18px;
  opacity: 0.92;
}

.bottom-link span {
  font-size: 0.72rem;
  white-space: nowrap;
}

.bottom-link.active {
  color: var(--gold);
  background: rgba(250, 204, 21, 0.08);
}

.bottom-link.active .bottom-link-icon {
  opacity: 1;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */

@media (max-width: 960px) {
  .dash-top-summary {
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
  }

  .dash-main-grid,
  .dash-secondary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .header-middle {
    display: none;
  }

  .header {
    border-radius: 1.4rem;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .header-right {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .page {
    padding-inline: 1rem;
    padding-bottom: calc(5.4rem + env(safe-area-inset-bottom, 0px));
  }

  .header {
    padding-inline: 1rem;
    gap: 10px;
  }

  .brand-tagline {
    max-width: 180px;
  }

  .dash-top-summary {
    padding: 0.9rem 0.9rem 1rem;
  }

  .dash-top-left-title {
    font-size: 1rem;
  }

  .dash-top-left-text {
    font-size: 0.86rem;
  }

  .dash-card-header {
    flex-wrap: wrap;
  }

  .dash-pill-soft {
    white-space: normal;
    line-height: 1.25;
  }

  .btn-main {
    padding-inline: 1.2rem;
  }

  .bottom-nav {
    padding-inline: 0.6rem;
  }

  .bottom-links {
    gap: 0.4rem;
  }

  .bottom-link {
    min-width: 58px;
  }
}

/* Extra ajuste para telas muito pequenas: header empilha com mais folga */
@media (max-width: 480px) {
  .header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-left {
    justify-content: center;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-pill {
    max-width: 130px;
  }
}

@media (max-width: 400px) {
  .page {
    padding-inline: 0.8rem;
  }
  .header {
    padding: 0.8rem;
    gap: 8px;
  }
  .bottom-link {
    min-width: 54px;
    padding: 0.15rem 0.25rem;
  }
  .bottom-link span {
    font-size: 0.68rem;
  }
}

/* FILTROS DO DASHBOARD */
.dash-filters-row {
  display: flex;
  gap: 1.2rem;
  align-items: end;
  margin-top: 0.8rem;
  flex-wrap: wrap;
}

.dash-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 140px;
  flex: 1;
}

.dash-filter-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}

.dash-filter-field input,
.dash-filter-field select {
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.dash-filter-field input:focus,
.dash-filter-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.2);
  background: rgba(15, 23, 42, 0.95);
}

.dash-filter-field input[type="month"] {
  cursor: pointer;
}

.dash-filter-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23fbbf24' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* MINI CHARTS POR CATEGORIA */
.mini-charts-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.mini-chart-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(250, 204, 21, 0.15);
  transition: all 0.2s ease;
}

.mini-chart-item:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(250, 204, 21, 0.3);
  transform: translateX(2px);
}

.mini-chart-bar {
  flex: 1;
  height: 8px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.mini-chart-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
}

.mini-chart-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 120px;
}

.mini-chart-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-chart-value {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gold);
}

.mini-chart-percent {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   RESPONSIVO - iPhone Pro/Max e telas pequenas (<= 540px)
   ============================================================ */
@media (max-width: 540px) {
  html, body {
    overflow-x: hidden;
  }

  .page {
    width: 100%;
    max-width: 100%;
    padding: 1rem 1rem calc(5.8rem + env(safe-area-inset-bottom, 0px));
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
  }

  .header-left {
    width: 100%;
    justify-content: center;
    gap: 12px;
  }

  .logo-name {
    max-width: 120px;
    height: 18px;
  }

  .header-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-header-ghost,
  .btn-header-logout,
  .btn-main {
    min-height: 44px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
  }

  .user-pill {
    width: 100%;
    justify-content: center;
  }

  .dash-top-summary {
    grid-template-columns: 1fr;
    padding: 0.9rem;
    gap: 0.9rem;
    text-align: center;
  }

  .dash-top-left-title {
    justify-content: center;
  }

  .dash-top-left-text {
    max-width: none;
  }

  .dash-top-badges {
    justify-content: center;
  }

  .dash-top-right-actions {
    align-items: center;
  }

  .dash-main-grid,
  .dash-secondary-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .dash-card {
    padding: 0.85rem;
  }

  .bottom-nav {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.4rem);
  }
}
