:root {
  --sidebar-bg: #1f2937;
  --brand: #4f46e5;
}

body {
  background-color: #f4f5f7;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  min-height: 100vh;
  background-color: var(--sidebar-bg);
  transition: width 0.15s ease;
  overflow-x: hidden;
}

.sidebar .nav-link {
  display: flex;
  align-items: flex-start;
  color: #cbd5e1;
  border-radius: 8px;
}

.sidebar .nav-link i {
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  border: none;
  background: transparent;
  padding: 0.25rem 0.4rem;
  line-height: 1;
}

.sidebar-toggle-btn:hover {
  color: #fff !important;
}

.sidebar.collapsed {
  width: 72px;
}

.sidebar.collapsed .nav-label {
  display: none;
}

.sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  position: relative;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.sidebar.collapsed .nav-link i {
  margin-right: 0 !important;
}

.sidebar.collapsed .nav-group-toggle::before {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  margin-right: 0;
}

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

.sidebar .nav-link.active {
  background-color: var(--brand);
  color: #fff;
}

.sidebar .nav-caret {
  transition: transform 0.15s ease;
}

.sidebar .nav-link[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.sidebar.collapsed .nav-caret {
  display: none;
}

.sidebar.collapsed .nav-group-toggle::before {
  content: ">";
  font-size: 0.7rem;
  color: #cbd5e1;
  margin-right: 2px;
}

.sidebar .ms-3 .nav-link {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.content {
  min-height: 100vh;
  min-width: 0;
}

.flash-container {
  margin-bottom: 1rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.card-kpi {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  min-width: 0;
  overflow: hidden;
  container-type: inline-size;
}

.card-kpi .kpi-value {
  font-size: clamp(1.05rem, 11cqw, 1.8rem);
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.2;
}

.kpi-clickable {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}

.kpi-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.cursor-pointer {
  cursor: pointer;
}

.table-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #1f2937);
}

.login-card {
  width: 380px;
  border: none;
  border-radius: 16px;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  padding: 1rem;
}

.badge-statut {
  text-transform: capitalize;
}

/* Empêche la flèche de tri de chevaucher le libellé de la colonne suivante :
   le libellé et l'icône ne se compressent plus l'un dans l'autre. */
.sortable-th {
  white-space: nowrap;
}

.sortable-th > a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Empêche le champ de recherche client (filtre besoins) de s'étirer même
   si le nom saisi/sélectionné est très long, et positionne sa liste de
   suggestions en dessous. */
.client-filter-wrap {
  position: relative;
}

.client-filter-input {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.client-filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0.75rem;
  z-index: 1050;
  width: 220px;
  max-height: 260px;
  overflow-y: auto;
  margin-top: 0.15rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.client-filter-dropdown.show {
  display: block;
}

.client-filter-dropdown .list-group-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

/* Limite la hauteur des listes (tableaux et grilles de cartes) pour qu'elles
   tiennent sur une page, avec défilement interne au-delà. */
.table-scroll {
  max-height: 75vh;
  overflow-y: auto;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #fff;
}

.card-scroll {
  max-height: 75vh;
  overflow-y: auto;
}
