/* 🔹 Estilos generales */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
}

section {
  margin-bottom: 30px;
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  background-color: #fff;
}

h2, h3 {
  margin-top: 0;
  color: #0ba9c5;
}

/* 🔹 Labels e inputs */
label {
  display: inline-block;
  width: 120px;
  margin-right: 10px;
}

input[type="text"],
input[type="number"],
select {
  padding: 6px;
  margin-bottom: 10px;
  width: 200px;
  box-sizing: border-box;
}

/* 🔹 Tabla */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th, td {
  border: 1px solid #999;
  padding: 8px;
  text-align: left;
}

th {
  background-color: #f2f2f2;
}

tr:hover {
  background-color: #d0f0f8;
  cursor: pointer;
}

/* 🔹 Botones */
.boton {
  padding: 10px 20px;
  margin-right: 10px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.boton:hover {
  background-color: #45a049;
}

/* 🔹 Totales */
#totales span {
  font-weight: bold;
  font-size: 16px;
}

/* 🔹 Fila servicio */
.fila-articulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.fila-articulo label {
  min-width: 130px;
}

.fila-articulo input {
  flex: 1;
}

/* 🔹 Fila cantidad/precio */
.fila-cantidad-precio {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.fila-cantidad-precio .grupo {
  display: flex;
  flex-direction: column;
}

/* 🔹 Registro flex */
.registro-flex {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.contenedor-agregar,
.contenedor-totales {
  flex: 1 1 45%;
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  background-color: #f9f9f9;
  min-width: 280px;
}

.contenedor-totales p {
  font-weight: bold;
  margin: 5px 0;
}

/* 🔹 Acciones */
.acciones {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ========================= */
/* 🔹 RESPONSIVE AJUSTES     */
/* ========================= */
@media (max-width: 768px) {
  body {
    margin: 10px;
  }

  /* Labels encima de inputs */
  label {
    display: block;
    width: 100%;
    margin-bottom: 5px;
  }

  input[type="text"],
  input[type="number"],
  select {
    width: 100%;
  }

  /* Fila servicio y cantidad/precio en columna */
  .fila-articulo,
  .fila-cantidad-precio {
    flex-direction: column;
    align-items: flex-start;
  }

  .fila-articulo input,
  .fila-articulo button {
    width: 100%;
  }

  .fila-cantidad-precio .grupo {
    width: 100%;
  }

  /* Registro-flex en columna */
  .registro-flex {
    flex-direction: column;
  }

  .contenedor-agregar,
  .contenedor-totales {
    flex: 1 1 100%;
  }

  /* Botones de acción en columna */
  .acciones {
    flex-direction: column;
  }

  .acciones .boton {
    width: 100%;
  }

  /* Tabla con scroll horizontal */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  th, td {
    font-size: 0.85rem;
    padding: 6px;
  }
}