/* Estilo COEX: claro y legible, pensado para usuarios no tecnicos. */
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Segoe UI", system-ui, sans-serif;
  background: #f2f4f7; color: #1c2733; font-size: 16px;
}
.cabecera {
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  background: #7a1f2b; color: #fff; padding: 0.6rem 1.2rem;
}
.marca { font-size: 1.3rem; font-weight: 700; }
.marca span { font-size: 0.85rem; font-weight: 400; opacity: 0.85; margin-left: 0.5rem; }
.cabecera nav { display: flex; gap: 0.4rem; }
.cabecera nav a {
  color: #fff; text-decoration: none; padding: 0.45rem 0.9rem;
  border-radius: 6px; font-weight: 600;
}
.cabecera nav a:hover { background: rgba(255, 255, 255, 0.18); }
.usuario { margin-left: auto; font-size: 0.9rem; display: flex; gap: 0.8rem; align-items: center; }
.usuario .salir { color: #ffd9dd; }

main { max-width: min(1650px, 97vw); margin: 1.2rem auto; padding: 0 1rem; }

h1 { font-size: 1.45rem; margin: 0.3rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 0.6rem; }

.aviso { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.aviso.exito { background: #e2f4e5; color: #1d6b2c; border: 1px solid #b4dfbc; }
.aviso.error { background: #fde8e8; color: #9b1c1c; border: 1px solid #f5c2c2; }

.tarjeta {
  background: #fff; border: 1px solid #dde3ea; border-radius: 10px;
  padding: 1.1rem 1.3rem; margin-bottom: 1.2rem;
}

.subtabs { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.subtabs a {
  color: #7a1f2b; text-decoration: none; font-weight: 600;
  padding: 0.5rem 1rem; border-radius: 8px 8px 0 0;
  border: 1px solid #dde3ea; border-bottom: none; background: #eef1f5;
}
.subtabs a.activa { background: #fff; border-bottom: 1px solid #fff; margin-bottom: -1px; }

.grupo-informes {
  border: 1px solid #dde3ea; border-radius: 12px; background: #eef1f5;
  padding: 0.1rem 1.1rem 1.2rem; margin: 1.4rem 0 1.6rem;
}
.grupo-informes h2 { margin: 0.9rem 0 0.9rem; }
.tarjetas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.tarjetas-grid .tarjeta { margin-bottom: 0; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid #e6eaef; }
th { background: #eef1f5; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: #4a5a6a; }
tr:hover td { background: #f7f9fb; }
.tabla-envoltura { overflow-x: auto; background: #fff; border: 1px solid #dde3ea; border-radius: 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.centro { text-align: center; }

label { display: block; font-size: 0.85rem; font-weight: 600; color: #44525f; margin-bottom: 0.2rem; }
input, select, textarea {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid #c3ccd6;
  border-radius: 6px; font-size: 1rem; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #7a1f2b33; border-color: #7a1f2b; }
.campo { margin-bottom: 0.9rem; }
.fila-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; }
.fila-campos.ancha { grid-template-columns: 1fr; }
.fila-campos.dos-columnas { grid-template-columns: 1fr 1fr; }
.campo-con-boton { display: flex; gap: 0.4rem; align-items: end; }
.campo-con-boton .campo { flex: 1; margin-bottom: 0; }
.campo-con-boton .boton { white-space: nowrap; }

.boton {
  display: inline-block; background: #7a1f2b; color: #fff; border: 0;
  padding: 0.55rem 1.2rem; border-radius: 8px; font-size: 1rem;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.boton:hover { background: #641823; }
.boton.secundario { background: #eef1f5; color: #1c2733; border: 1px solid #c3ccd6; }
.boton.secundario:hover { background: #e2e7ee; }
.boton.peligro { background: #fff; color: #9b1c1c; border: 1px solid #e4b6b6; }
.boton.peligro:hover { background: #fdf0f0; }
.boton.mini { padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.barra-acciones { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.filtros { display: flex; gap: 0.7rem; align-items: end; flex-wrap: wrap; margin-bottom: 1rem; }
.filtros .campo { margin: 0; min-width: 130px; }

dialog {
  border: 1px solid #dde3ea; border-radius: 10px; padding: 1.1rem 1.3rem;
  max-width: 420px;
}
dialog::backdrop { background: rgba(20, 26, 33, 0.45); }

.login-caja { max-width: 400px; margin: 8vh auto; }
.login-caja .marca-grande { text-align: center; font-size: 2rem; font-weight: 800; color: #7a1f2b; margin-bottom: 1rem; }

.etiqueta { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 99px; font-size: 0.78rem; font-weight: 700; }
.etiqueta.emergencia { background: #fdeaea; color: #9b1c1c; }
.etiqueta.zona { background: #e8eef8; color: #2b4a7a; }

.grafica-fila { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.grafica-etiqueta { width: 190px; flex-shrink: 0; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grafica-pista { flex: 1; background: #eef1f5; border-radius: 5px; height: 1.15rem; overflow: hidden; }
.grafica-relleno { background: #7a1f2b; height: 100%; border-radius: 5px; min-width: 2px; }
.grafica-valor { width: 160px; flex-shrink: 0; font-size: 0.82rem; color: #4a5568; text-align: right; }

dl.ficha { display: grid; grid-template-columns: 200px 1fr; gap: 0.3rem 1rem; margin: 0; }
dl.ficha dt { font-weight: 600; color: #44525f; }
dl.ficha dd { margin: 0; }
.ficha-dos-columnas {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem 2rem;
  align-items: start;
}

/* Rejilla de medios empleados (estilo hoja de datos de Access).
   Casillas ajustadas para que quepa entera sin barra horizontal. */
table.rejilla th, table.rejilla td { padding: 0.25rem 0.25rem; font-size: 0.88rem; white-space: nowrap; }
table.rejilla input, table.rejilla select { padding: 0.2rem 0.2rem; font-size: 0.88rem; }
table.rejilla .c-num { width: 3rem; text-align: center; }
table.rejilla .c-dieta { width: 2.2rem; text-align: center; }
table.rejilla .total-num { text-align: center; }
table.rejilla .c-hora { width: 4.1rem; }   /* justo para "20:30" */
table.rejilla .c-act { width: 3.4rem; }
table.rejilla .c-cod { width: 6.5rem; }
table.rejilla .js-nombre { min-width: 14rem; white-space: normal; }
table.rejilla .c-buscar {
  width: 100%; min-width: 14rem; text-overflow: ellipsis;
}
/* Al enfocar, se ensancha para poder leer descripciones largas (materiales,
   matriculas...); el "title" (tooltip al pasar el raton) cubre el resto. */
table.rejilla .c-buscar:focus { position: relative; z-index: 1; min-width: 28rem; }
table.rejilla .c-buscar:disabled { background: transparent; border-color: transparent; color: #1c2530; }

/* Casillas de hora sin el icono de reloj: se teclea la hora directamente y
   se pasa a la siguiente casilla (como en Access). */
input[type=time]::-webkit-calendar-picker-indicator { display: none; }
input[type=time] { -webkit-appearance: none; -moz-appearance: textfield; appearance: none; }

/* Indicador de guardado automatico */
.estado-guardado { font-size: 0.85rem; font-weight: 600; margin-left: 0.6rem; }
.estado-guardado.ok { color: #1d6b2c; }
.estado-guardado.error { color: #9b1c1c; }
