body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  /* Evita estouro horizontal por textos longos */
  overflow-wrap: break-word;
}

.navbar-brand {
  font-weight: 700;
}

/* Transição suave ao alternar tema */
body,
.navbar,
.card,
.table,
.form-control,
.form-select,
.badge,
.alert {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

/* =========================================================
   Mobile-first — base de toque confortável
   ========================================================= */

/* Evita zoom automático do iOS e mantém inputs legíveis */
.form-control,
.form-select {
  font-size: 1rem;
}

/* Botões quebram texto em vez de estourar a largura */
.btn {
  white-space: normal;
}

/* Utilitário: permite que flex children quebrem textos longos */
.min-w-0 {
  min-width: 0;
}

/* =========================================================
   Telas pequenas (< 768px) — celular
   ========================================================= */
@media (max-width: 767.98px) {
  /* Área de toque mínima de ~44px */
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .btn-sm {
    min-height: 40px;
  }

  .form-control,
  .form-select {
    min-height: 44px;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  /* Tabelas viram cartões empilhados.
     Uso: <table class="table table-cards"> com data-label em cada <td>. */
  .table-cards {
    display: block;
    width: 100%;
  }

  .table-cards thead {
    display: none;
  }

  .table-cards tbody {
    display: block;
    width: 100%;
  }

  .table-cards tr {
    display: block;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.875rem;
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }

  .table-cards tr:last-child {
    margin-bottom: 0;
  }

  .table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--bs-border-color);
    overflow-wrap: anywhere;
  }

  .table-cards td:last-child {
    border-bottom: 0;
  }

  .table-cards td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    color: var(--bs-secondary-color);
  }

  /* Grupo de ações dentro de um card (Editar/Excluir, etc.) */
  .table-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    justify-content: flex-end;
  }

  /* Conteúdo da célula (nome + apelido, etc.) agrupado à direita */
  .table-card-content {
    min-width: 0;
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    text-align: right;
  }
}
