* {
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

.contenedor-800 {
  max-width: 800px;
  margin: 0 auto;
}

.contenedor-reportes {
  max-width: 100%;
}

.contenido {
  background: #F8FAFC;
}

#tabla-reporte {
  width: 100%;
  table-layout: fixed;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

#tabla-reporte thead th {
  background: #1E3A8A;
  color: white;
  padding: 0.6rem 0.9rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  position: sticky;
  top: 0;
  text-align: center;
}

#tabla-reporte tbody tr {
  border-bottom: 1px solid #e2e8f0;
}

#tabla-reporte tbody tr:nth-child(even) {
  background: #f8f9fb;
}

#tabla-reporte tbody tr:hover {
  background: #eef2ff;
}

#tabla-reporte td {
  padding: 0.55rem 1.2rem;
  font-size: 0.95rem;
  vertical-align: middle;
  text-align: center;
}

/* Columnas clave: Ración, Libras consumo, % — más grandes y en negrita (solo tabla principal, no el historial anidado) */
#tabla-reporte > tbody > tr > td:nth-child(5),
#tabla-reporte > tbody > tr > td:nth-child(6),
#tabla-reporte > tbody > tr > td:nth-child(7) {
  font-weight: 700;
  font-size: 1.05rem;
  color: #1E3A8A;
}

/* Columnas de texto largo (lecturas): permitir salto de línea */
#tabla-reporte > tbody > tr > td:nth-child(8),
#tabla-reporte > tbody > tr > td:nth-child(9) {
  max-width: 170px;
  white-space: normal;
  line-height: 1.4;
}

/* Ajuste 1 y Ajuste 2: los inputs se controlan por su propio ancho fijo en el JS, no por la columna */
.col-ajuste {
  width: 70px;
}

/* Botones de exportar con iconos más grandes */
#btn-exportar-excel,
#btn-copiar-imagen {
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

#form-reporte {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.campo-reporte {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 160px;
}

.campo-reporte label {
  font-size: 0.85rem;
  color: #374151;
}

.campo-reporte input,
.campo-reporte select {
  padding: 0.5rem;
  border: 1px solid #cbd2d9;
  border-radius: 4px;
}

section {
  background: white;
  border-radius: 8px;
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section.formulario {
  padding: 1.25rem 1.5rem;
}

section.formulario h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.3rem;
}

form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

input {
  padding: 0.5rem;
  border: 1px solid #cbd2d9;
  border-radius: 4px;
  flex: 1;
  min-width: 150px;
}

#tabla-reporte input {
  min-width: 0 !important;
  flex: none !important;
}

button {
  background: #2563eb;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background: #1d4ed8;
}

.mensaje-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

th, td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid #e4e7eb;
}

.btn-eliminar {
  background: #dc2626;
}

.btn-eliminar:hover {
  background: #b91c1c;
}

.btn-editar {
  background: #6b7280;
  margin-right: 0.5rem;
}


/* ===== Responsive: pantallas chicas (celular/tablet) ===== */
@media (max-width: 768px) {

  .contenido {
    padding: 1rem !important;
  }

  section {
    padding: 0.75rem 1rem !important;
  }

  /* Filtros: uno debajo del otro, ancho completo */
  #form-reporte {
    flex-direction: column;
    align-items: stretch;
  }

  .campo-reporte {
    min-width: 100%;
  }

  #form-reporte button {
    width: 100%;
  }

  /* Encabezado de Resultados + botones: apilados */
  .contenedor-reportes > div:first-child {
    flex-direction: column;
    align-items: stretch !important;
  }

  #btn-exportar-excel,
  #btn-copiar-imagen {
    width: 100%;
    justify-content: center;
  }

  /* Tabla: fuente y espacios más chicos para que quepa más */
  #tabla-reporte thead th {
    padding: 0.4rem 0.5rem;
    font-size: 0.65rem;
  }

  #tabla-reporte td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
  }

/* Ración día siguiente: un poco más ancho */
#tabla-reporte input[id^="racion-siguiente"] {
  width: 55px !important;
  padding: 0.3rem !important;
  font-size: 0.8rem;
}

/* Ajuste 1 y 2: más angostos */
/*
#tabla-reporte input[id^="ajuste1"],
#tabla-reporte input[id^="ajuste2"] {
  width: 45px !important;
}
*/

  /* Círculos de O2/Temperatura, un poco más chicos */
  #tabla-reporte span[style*="border-radius:50%"] {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.7rem !important;
  }

  /* Badges de texto (BARRIDA, PAUSA, etc.) más compactos */
  #tabla-reporte span {
    font-size: 0.65rem !important;
  }
}

/* Scroll horizontal más suave en iOS para la tabla */
.contenedor-reportes div[style*="overflow-x:auto"] {
  -webkit-overflow-scrolling: touch;
}