/* Responsividade Básica */
@media (max-width: 1440px) {
  .main-content {
    padding: 16px 24px;
  }

  .page-title {
    font-size: 26px !important;
  }

  .card-patrimonio {
    padding: 20px !important;
    min-height: 140px !important;
  }

  .card-patrimonio .valor-principal {
    font-size: 28px !important;
  }

  .cartao-compacto {
    padding: 16px !important;
  }

  .grafico-circular {
    width: 110px !important;
    height: 110px !important;
  }

  .grafico-circular::before {
    width: 75px !important;
    height: 75px !important;
  }

  .grafico-circular .texto-centro .pct {
    font-size: 22px !important;
  }

  .kpi-wrapper {
    gap: 10px !important;
    padding-left: 16px !important;
  }

  .kpi-wrapper .mini-kpi .texto span {
    font-size: 9px !important;
  }

  .kpi-wrapper .mini-kpi .texto strong {
    font-size: 14px !important;
  }

  .dash-grid {
    gap: 16px !important;
  }

  /* Coloca os KPIs em 2x2 para não espremer e cortar */
  .receber-resumo {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Ajusta o tamanho da fonte para caber bonito no card */
  .receber-card .info .valor {
    font-size: 20px !important;
  }
}

@media (max-width: 1100px) {
  /* Dashboard vira coluna única */
  .dash-grid {
    grid-template-columns: 1fr !important;
  }

  /* Ajuste do gráfico de orçamento */
  .orcamento-content {
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
  }

  .grafico-wrapper {
    margin-bottom: 0 !important;
  }

  .grafico-circular {
    width: 140px !important;
    height: 140px !important;
  }

  .grafico-circular::before {
    width: 95px !important;
    height: 95px !important;
  }

  .kpi-wrapper {
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
    padding-left: 0 !important;
    padding-top: 16px !important;
    width: 100% !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
  }

  /* CONTAS A RECEBER E PAGAR: Drawer desce para baixo */
  .receber-layout {
    grid-template-columns: 1fr !important;
    /* Força coluna única */
  }

  .receber-layout .drawer-detalhes {
    position: static !important;
    /* Remove o sticky */
    margin-top: 20px;
    min-height: auto !important;
  }

  /* Os cards de KPI ficam 2x2 em vez de 4x1 */
  .receber-resumo {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    height: 60px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    align-items: center;
    flex: 1;
    margin-top: 10px;

    /* ADICIONE ESTAS LINHAS */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    padding-bottom: 20px;
    /* Espaço para o botão de sair não colar no fim */
  }

  /* Esconde a barra de rolagem visualmente no Chrome/Safari, mas permite rolar */
  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav button {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .side-nav button::after {
    display: none;
  }

  .main-content {
    padding: 12px;
  }

  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .wallet-container {
    flex-direction: column;
    gap: 16px;
  }

  .cartao-compacto {
    min-width: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .kpi-wrapper {
    grid-template-columns: 1fr !important;
  }

  .card-patrimonio .valor-principal {
    font-size: 24px !important;
  }

  .page-title {
    font-size: 22px !important;
  }

  .receber-resumo {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

.filtros-bar i {
  pointer-events: none;
  /* Faz os cliques passarem direto para o input */
}

.filtros-bar input:focus + i,
.filtros-bar:focus-within i {
  color: var(--accent) !important;
  /* Muda a cor da lupa quando clica no campo */
}

/* Ajuste para os cards de resumo de transações */
.resumo-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resumo-card .label {
  margin-bottom: 2px;
}

/* Garante que a lupa fique correta na tela de transações */
.filtros-bar div input {
  background: var(--bg);
  /* Mantém o fundo original */
}

.badge-cat i {
  margin-right: 2px;
  transform: translateY(1px);
  /* Alinha o ícone com o texto */
}

/* Cabeçalho do painel - Alinha o avatar/texto à esquerda e o X à direita */
.drawer-detalhes .cabecalho {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  width: 100%;
}

/* Bloco do avatar e texto */
.drawer-detalhes .cabecalho > div {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  /* Permite o corte do texto com "..." */
}

/* Ajuste no texto para não empurrar o botão */
.drawer-detalhes .cabecalho h3,
.drawer-detalhes .cabecalho .sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
  /* Limite de largura */
}

/* Força o botão X a ficar redondo no canto superior direito */
.drawer-detalhes .cabecalho .fechar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  /* Impede que o ícone esmague o botão */
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: 0.2s;
  margin-left: 10px;
  /* Dá um respiro do texto */
}

.drawer-detalhes .cabecalho .fechar:hover {
  background: var(--card-hover);
  color: var(--txt);
}
