.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #ffffff;
  border-radius: 16px;
  min-width: 360px;
  max-width: 520px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.12);
  animation: modal-in 0.2s ease-out;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--color-text);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form dans la modale */

.modal-body form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fafbfc;
  color: var(--color-text);
  font-size: 15px;
  transition: all 0.2s ease-out;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Historique */

.history-list {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 16px;
  background: #fafbfc;
}

.history-item {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.history-item:last-child {
  border-bottom: none;
}

.history-type-entree {
  color: var(--color-success);
  font-weight: 500;
}

.history-type-sortie {
  color: var(--color-danger);
  font-weight: 500;
}

@keyframes modal-in {
  from {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
